/**
 * Battalion 1851 Leads - Frontend Styles
 * 
 * @package Battalion1851_Leads
 * @version 1.0.2
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    --b1851-primary: #1a5276;
    --b1851-primary-hover: #154360;
    --b1851-primary-light: #e8f4fc;
    --b1851-accent: #d4af37;
    --b1851-accent-hover: #b8960f;
    --b1851-success: #28a745;
    --b1851-success-light: #d4edda;
    --b1851-error: #dc3545;
    --b1851-error-light: #f8d7da;
    --b1851-text: #333333;
    --b1851-text-light: #666666;
    --b1851-border: #dee2e6;
    --b1851-bg: #ffffff;
    --b1851-overlay: rgba(0, 0, 0, 0.6);
    --b1851-radius: 8px;
    --b1851-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --b1851-transition: 0.3s ease;
}

/* ==========================================================================
   Body Lock
   ========================================================================== */
body.b1851-body-locked {
    overflow: hidden;
}

/* ==========================================================================
   Wrapper - CRITICAL: Full width for alignment to work
   ========================================================================== */
.b1851-wrapper {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    align-self: stretch !important;
    direction: rtl;
    font-family: inherit;
    box-sizing: border-box !important;
}

.b1851-wrapper *,
.b1851-wrapper *::before,
.b1851-wrapper *::after {
    box-sizing: inherit;
}

/* Alignment */
.b1851-wrapper.b1851-align-right {
    justify-content: flex-start;
}

.b1851-wrapper.b1851-align-center {
    justify-content: center;
}

.b1851-wrapper.b1851-align-left {
    justify-content: flex-end;
}

/* ==========================================================================
   CTA Button
   ========================================================================== */
.b1851-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;
    color: var(--b1851-bg);
    background: var(--b1851-primary);
    border: none;
    border-radius: var(--b1851-radius);
    cursor: pointer;
    transition: all var(--b1851-transition);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    flex-shrink: 0;
    font-family: inherit;
}

.b1851-btn:hover,
.b1851-btn:focus {
    background: var(--b1851-primary-hover);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-2px);
}

.b1851-btn:active {
    transform: translateY(0);
}

.b1851-btn:focus {
    outline: 3px solid var(--b1851-accent);
    outline-offset: 2px;
}

/* Button Sizes */
.b1851-btn-sm {
    padding: 10px 20px;
    font-size: 14px;
}

.b1851-btn-lg {
    padding: 18px 36px;
    font-size: 18px;
}

/* Button Styles */
.b1851-btn-outline {
    background: transparent;
    color: var(--b1851-primary);
    border: 2px solid var(--b1851-primary);
    box-shadow: none;
}

.b1851-btn-outline:hover,
.b1851-btn-outline:focus {
    background: var(--b1851-primary);
    color: var(--b1851-bg);
}

/* ==========================================================================
   Modal Overlay
   ========================================================================== */
.b1851-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: var(--b1851-overlay);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--b1851-transition), visibility var(--b1851-transition);
}

.b1851-overlay.b1851-overlay-visible {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Modal Dialog
   ========================================================================== */
.b1851-modal {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 40px);
    background: var(--b1851-bg);
    border-radius: var(--b1851-radius);
    box-shadow: var(--b1851-shadow);
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: transform var(--b1851-transition);
}

.b1851-overlay.b1851-overlay-visible .b1851-modal {
    transform: scale(1) translateY(0);
}

.b1851-modal::-webkit-scrollbar {
    width: 6px;
}

.b1851-modal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.b1851-modal::-webkit-scrollbar-thumb {
    background: var(--b1851-border);
    border-radius: 3px;
}

/* ==========================================================================
   Close Button
   ========================================================================== */
.b1851-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all var(--b1851-transition);
    z-index: 10;
    font-size: 24px;
    line-height: 1;
}

.b1851-close:hover,
.b1851-close:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.b1851-close:focus {
    outline: 2px solid var(--b1851-accent);
    outline-offset: 2px;
}

/* ==========================================================================
   Modal Header
   ========================================================================== */
.b1851-header {
    padding: 30px 30px 20px;
    background: linear-gradient(135deg, var(--b1851-primary), var(--b1851-primary-hover));
    color: var(--b1851-bg);
    text-align: center;
}

.b1851-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: inherit;
}

.b1851-subtitle {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.5;
}

/* ==========================================================================
   Modal Content
   ========================================================================== */
.b1851-content {
    padding: 25px 30px 30px;
}

/* ==========================================================================
   Form Styles
   ========================================================================== */
.b1851-form {
    direction: rtl;
}

.b1851-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.b1851-field {
    position: relative;
}

.b1851-field-half {
    grid-column: span 1;
}

.b1851-field-full {
    grid-column: span 2;
}

.b1851-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--b1851-text);
}

.b1851-required {
    color: var(--b1851-error);
}

.b1851-field input[type="text"],
.b1851-field input[type="email"],
.b1851-field input[type="tel"],
.b1851-field textarea {
    display: block;
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    color: var(--b1851-text);
    background: var(--b1851-bg);
    border: 1px solid var(--b1851-border);
    border-radius: 6px;
    transition: border-color var(--b1851-transition), box-shadow var(--b1851-transition);
}

.b1851-field input:focus,
.b1851-field textarea:focus {
    outline: none;
    border-color: var(--b1851-primary);
    box-shadow: 0 0 0 3px rgba(26, 82, 118, 0.1);
}

.b1851-field-invalid input,
.b1851-field-invalid textarea {
    border-color: var(--b1851-error);
}

.b1851-field-invalid input:focus,
.b1851-field-invalid textarea:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.b1851-field textarea {
    resize: vertical;
    min-height: 80px;
}

/* Error Messages */
.b1851-error {
    display: block;
    min-height: 18px;
    margin-top: 4px;
    font-size: 12px;
    color: var(--b1851-error);
}

/* ==========================================================================
   Checkbox Styles
   ========================================================================== */
.b1851-checkbox-field {
    grid-column: span 2;
}

.b1851-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: var(--b1851-text);
    font-weight: normal;
}

.b1851-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.b1851-checkmark {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
    background: var(--b1851-bg);
    border: 2px solid var(--b1851-border);
    border-radius: 4px;
    transition: all var(--b1851-transition);
    position: relative;
}

.b1851-checkbox:hover .b1851-checkmark {
    border-color: var(--b1851-primary);
}

.b1851-checkbox input:checked + .b1851-checkmark {
    background: var(--b1851-primary);
    border-color: var(--b1851-primary);
}

.b1851-checkbox input:checked + .b1851-checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.b1851-checkbox input:focus + .b1851-checkmark {
    outline: 2px solid var(--b1851-accent);
    outline-offset: 2px;
}

/* ==========================================================================
   Submit Button
   ========================================================================== */
.b1851-actions {
    margin-top: 24px;
}

.b1851-submit {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: var(--b1851-text);
    background: linear-gradient(135deg, var(--b1851-accent), var(--b1851-accent-hover));
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--b1851-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.b1851-submit:hover:not(:disabled),
.b1851-submit:focus:not(:disabled) {
    background: linear-gradient(135deg, var(--b1851-accent-hover), #9a7d0a);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
    transform: translateY(-1px);
}

.b1851-submit:focus {
    outline: 3px solid var(--b1851-primary);
    outline-offset: 2px;
}

.b1851-submit:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.b1851-submit-text,
.b1851-submit-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.b1851-submit-loading[aria-hidden="true"],
.b1851-submit-text[aria-hidden="true"] {
    display: none;
}

.b1851-spinner {
    animation: b1851-spin 1s linear infinite;
}

@keyframes b1851-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Result Messages
   ========================================================================== */
.b1851-result {
    display: none;
    text-align: center;
    padding: 30px 20px;
}

.b1851-result[aria-hidden="false"] {
    display: block;
}

.b1851-result svg {
    margin-bottom: 16px;
}

.b1851-result p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: var(--b1851-text);
    line-height: 1.6;
}

/* Success */
.b1851-success svg {
    color: var(--b1851-success);
}

.b1851-close-btn {
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--b1851-text);
    background: #f5f5f5;
    border: 1px solid var(--b1851-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--b1851-transition);
}

.b1851-close-btn:hover,
.b1851-close-btn:focus {
    background: #eee;
    border-color: #ccc;
}

.b1851-close-btn:focus {
    outline: 2px solid var(--b1851-primary);
    outline-offset: 2px;
}

/* Error Result */
.b1851-error-msg svg {
    color: var(--b1851-error);
}

.b1851-retry-btn {
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: #fff;
    background: var(--b1851-primary);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--b1851-transition);
}

.b1851-retry-btn:hover,
.b1851-retry-btn:focus {
    background: var(--b1851-primary-hover);
}

.b1851-retry-btn:focus {
    outline: 2px solid var(--b1851-accent);
    outline-offset: 2px;
}

/* ==========================================================================
   Form Error
   ========================================================================== */
.b1851-form-error {
    display: none;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: var(--b1851-error);
    background: var(--b1851-error-light);
    border: 1px solid #f5c6cb;
    border-radius: 6px;
}

.b1851-form-error[aria-hidden="false"] {
    display: block;
}

/* ==========================================================================
   Honeypot
   ========================================================================== */
.b1851-hp {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 600px) {
    .b1851-overlay {
        padding: 10px;
    }
    
    .b1851-modal {
        max-height: calc(100vh - 20px);
    }
    
    .b1851-header {
        padding: 25px 20px 15px;
    }
    
    .b1851-title {
        font-size: 20px;
        padding-left: 30px;
    }
    
    .b1851-content {
        padding: 20px;
    }
    
    .b1851-fields {
        grid-template-columns: 1fr;
    }
    
    .b1851-field-half,
    .b1851-field-full,
    .b1851-checkbox-field {
        grid-column: span 1;
    }
    
    .b1851-close {
        top: 8px;
        left: 8px;
        width: 32px;
        height: 32px;
    }
    
    .b1851-btn {
        padding: 12px 24px;
        font-size: 15px;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .b1851-overlay,
    .b1851-modal,
    .b1851-btn,
    .b1851-submit,
    .b1851-field input,
    .b1851-field textarea {
        transition: none;
    }
    
    .b1851-spinner {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .b1851-field input,
    .b1851-field textarea {
        border-width: 2px;
    }
    
    .b1851-btn,
    .b1851-submit {
        border: 2px solid currentColor;
    }
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
    .b1851-overlay,
    .b1851-wrapper {
        display: none !important;
    }
}
