/**
 * RLI EverWebinar Registration Form Styles
 * MindValley-inspired design
 */

/* Reset theme interference */
.rli-ew-form-container,
.rli-ew-form-container * {
    box-sizing: border-box;
}

.rli-ew-form-container button,
.rli-ew-form-container input,
.rli-ew-form-container select,
.rli-ew-form-container textarea {
    font-family: inherit;
    margin: 0;
}

/* Container */
.rli-ew-form-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 20px 24px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Header */
.rli-ew-form-header {
    text-align: center;
    margin-bottom: 16px;
}

.rli-ew-timezone-notice {
    display: inline-block;
    padding: 6px 12px;
    background: #f0f9ff;
    color: #0369a1;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    margin: 0;
}

/* Form Fields */
.rli-ew-field {
    margin-bottom: 14px;
}

.rli-ew-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 5px;
}

.rli-ew-field label .required {
    color: #dc2626;
}

.rli-ew-field label .optional {
    color: #9ca3af;
    font-weight: 400;
    font-size: 13px;
}

/* International Phone Input Styling */
.rli-ew-phone-field .iti {
    width: 100%;
}

.rli-ew-phone-field .iti__tel-input {
    width: 100%;
    padding: 11px 14px 11px 85px !important;
    font-size: 15px;
    color: #1f2937;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.rli-ew-phone-field .iti__tel-input:focus {
    border-color: #E07A4F;
    box-shadow: 0 0 0 2px rgba(224, 122, 79, 0.15);
}

.rli-ew-phone-field .iti__country-container {
    padding: 0;
}

.rli-ew-phone-field .iti__selected-country {
    padding: 11px 6px 11px 12px;
    background: transparent;
    border-radius: 8px 0 0 8px;
}

.rli-ew-phone-field .iti__selected-dial-code {
    font-size: 14px;
    color: #4b5563;
    margin-left: 6px;
}

.rli-ew-phone-field .iti__arrow {
    border-top-color: #6b7280;
}

.rli-ew-phone-field .iti__country-list {
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    max-height: 200px;
}

.rli-ew-phone-field .iti__country {
    padding: 8px 12px;
    font-size: 13px;
}

.rli-ew-phone-field .iti__country:hover,
.rli-ew-phone-field .iti__country--highlight {
    background: #f0f9ff;
}

.rli-ew-phone-field .iti__flag-box {
    margin-right: 8px;
}

.rli-ew-phone-field .iti__dial-code {
    color: #6b7280;
}

.rli-ew-field input[type="text"],
.rli-ew-field input[type="email"],
.rli-ew-field input[type="tel"] {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    color: #1f2937;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    min-height: 44px;
}

.rli-ew-field input:focus {
    border-color: #E07A4F;
    box-shadow: 0 0 0 2px rgba(224, 122, 79, 0.15);
}

.rli-ew-field input::placeholder {
    color: #9ca3af;
}

.rli-ew-field input.rli-ew-invalid {
    border-color: #dc2626;
}

/* Schedule Dropdown */
.rli-ew-schedules {
    display: block;
}

.rli-ew-schedule-dropdown {
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    color: #1f2937;
    background: #ffffff;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
    min-height: 44px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.rli-ew-schedule-dropdown:focus {
    border-color: #E07A4F;
    box-shadow: 0 0 0 2px rgba(224, 122, 79, 0.15);
}

.rli-ew-schedule-dropdown:hover {
    border-color: #d1d5db;
}

/* Loading State */
.rli-ew-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    color: #6b7280;
    font-size: 13px;
}

.rli-ew-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #e5e7eb;
    border-top-color: #E07A4F;
    border-radius: 50%;
    animation: rli-ew-spin 0.8s linear infinite;
}

@keyframes rli-ew-spin {
    to { transform: rotate(360deg); }
}

.rli-ew-no-schedules {
    text-align: center;
    padding: 14px;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 6px;
    font-size: 13px;
}

/* Submit Button - High specificity to override theme */
.rli-ew-form-container .rli-ew-form .rli-ew-submit,
.rli-ew-form-container .rli-ew-form button.rli-ew-submit,
.rli-ew-form-container button[type="submit"].rli-ew-submit,
button.rli-ew-submit {
    width: 100% !important;
    max-width: 100% !important;
    padding: 14px 24px !important;
    margin: 14px 0 0 0 !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px !important;
    text-transform: uppercase !important;
    color: #ffffff !important;
    background: linear-gradient(180deg, #F0945A 0%, #E07A4F 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: block !important;
    text-align: center !important;
    box-shadow: 0 4px 14px rgba(224, 122, 79, 0.35) !important;
    outline: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    line-height: 1.4 !important;
}

.rli-ew-form-container .rli-ew-form .rli-ew-submit:hover,
button.rli-ew-submit:hover {
    background: linear-gradient(180deg, #F5A572 0%, #E8895A 100%) !important;
    box-shadow: 0 6px 20px rgba(224, 122, 79, 0.45) !important;
    transform: translateY(-1px) !important;
    border: none !important;
    outline: none !important;
}

.rli-ew-form-container .rli-ew-form .rli-ew-submit:focus,
button.rli-ew-submit:focus {
    outline: none !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(224, 122, 79, 0.35), 0 0 0 3px rgba(224, 122, 79, 0.2) !important;
}

.rli-ew-form-container .rli-ew-form .rli-ew-submit:active,
button.rli-ew-submit:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 8px rgba(224, 122, 79, 0.3) !important;
    border: none !important;
    outline: none !important;
}

.rli-ew-form-container .rli-ew-form .rli-ew-submit:disabled,
button.rli-ew-submit:disabled {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(224, 122, 79, 0.2) !important;
}

/* Remove any red/orange outlines from theme */
.rli-ew-form-container *:focus,
.rli-ew-form-container *:active {
    outline-color: #E07A4F !important;
}

.rli-ew-form-container button,
.rli-ew-form-container input,
.rli-ew-form-container select {
    outline: none;
}

.rli-ew-form-container button:focus-visible {
    outline: 2px solid #E07A4F !important;
    outline-offset: 2px !important;
}

.rli-ew-submit-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.rli-ew-submit-loading {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.rli-ew-submit.is-loading .rli-ew-submit-text {
    display: none;
}

.rli-ew-submit.is-loading .rli-ew-submit-loading {
    display: flex;
}

.rli-ew-submit-loading .rli-ew-spinner {
    border-color: rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
}

/* Messages */
.rli-ew-message {
    padding: 10px 14px;
    margin-top: 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.rli-ew-message.rli-ew-success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.rli-ew-message.rli-ew-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* Disclaimer */
.rli-ew-disclaimer {
    margin-top: 14px;
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    line-height: 1.4;
}

/* ==============================================
   MOBILE OPTIMIZATION
   ============================================== */
@media (max-width: 600px) {
    .rli-ew-form-container {
        padding: 20px 16px;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
    }

    .rli-ew-form-header {
        margin-bottom: 14px;
    }

    /* Larger field spacing for thumb-friendly tapping */
    .rli-ew-field {
        margin-bottom: 16px;
    }

    .rli-ew-field label {
        font-size: 14px;
        margin-bottom: 6px;
    }

    /* 16px font prevents iOS auto-zoom on focus
       48px min-height ensures touch-friendly targets */
    .rli-ew-field input[type="text"],
    .rli-ew-field input[type="email"],
    .rli-ew-field input[type="tel"] {
        padding: 14px 14px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 10px;
    }

    /* Phone input mobile fixes */
    .rli-ew-phone-field .iti__tel-input {
        font-size: 16px !important;
        min-height: 48px !important;
        padding: 14px 14px 14px 85px !important;
    }

    .rli-ew-phone-field .iti__selected-country {
        padding: 14px 6px 14px 12px;
    }

    .rli-ew-phone-field .iti__country-list {
        max-height: 260px;
    }

    .rli-ew-phone-field .iti__country {
        padding: 12px 14px;
        font-size: 15px;
    }

    /* Native select on mobile - use OS picker (iOS wheel / Android spinner) */
    .rli-ew-schedule-dropdown {
        -webkit-appearance: menulist !important;
        -moz-appearance: menulist !important;
        appearance: menulist !important;
        background-image: none !important;
        font-size: 16px;
        min-height: 48px;
        padding: 14px 14px;
        border-radius: 10px;
    }

    /* Bigger, fatter submit button on mobile */
    .rli-ew-form-container .rli-ew-form .rli-ew-submit,
    button.rli-ew-submit {
        padding: 16px 20px !important;
        font-size: 16px !important;
        min-height: 54px !important;
        border-radius: 10px !important;
        margin-top: 18px !important;
    }

    .rli-ew-disclaimer {
        margin-top: 14px;
        font-size: 11px;
        padding: 0 4px;
    }

    .rli-ew-timezone-notice {
        font-size: 11px;
    }

    /* Messages bigger on mobile */
    .rli-ew-message {
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* Small phones (iPhone SE, etc) */
@media (max-width: 375px) {
    .rli-ew-form-container {
        padding: 16px 12px;
    }

    .rli-ew-form-container .rli-ew-form .rli-ew-submit,
    button.rli-ew-submit {
        font-size: 15px !important;
        letter-spacing: 0.2px !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .rli-ew-form-container {
        /* Keep light background for form even in dark mode */
        background: #ffffff;
    }
}

/* Print styles */
@media print {
    .rli-ew-form-container {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}
