/*
╔════════════════════════════════════════════════════════════════════╗
║  ROOTED VITALITY, INC.                                             ║
║  File: styles/dark-mode/dark-mode-forms.css                        ║
║  Purpose: Dark mode styling for forms, modals, and dropdowns       ║
║  Holistic Wellness · Modern Connection Platform                    ║
║  rootedvitality.health | 2025                                      ║
╚════════════════════════════════════════════════════════════════════╝

TABLE OF CONTENTS
  1. Basic Modals & Dropdowns
  2. Auth Modal & Forms
  3. BEM-Style Modals
  4. Form Inputs & Controls
*/

@media (prefers-color-scheme: dark) {
    /* ========================================== */
    /* 1. BASIC MODALS & DROPDOWNS */
    /* ========================================== */

    .modal {
        background-color: rgba(26, 23, 20, 0.95) !important;
    }

    .modal-overlay {
        background-color: rgba(0, 0, 0, 0.7) !important;
    }

    .modal-content {
        background-color: var(--dm-bg-card) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    }

    .modal-header {
        border-bottom-color: var(--dm-border-primary) !important;
        background-color: var(--dm-bg-card) !important;
    }

    .modal-header h2 {
        color: #ffffff !important;
    }

    .modal-title {
        color: #ffffff !important;
    }

    .modal-close {
        color: #b8b3b0 !important;
    }

    .modal-close:hover {
        color: #77883e !important;
    }

    .modal-close:focus-visible,
    .modal-close-btn:focus-visible {
        outline: 2px solid var(--dm-accent-gold) !important;
        outline-offset: 2px;
        border-radius: 4px;
    }

    .modal-body {
        background-color: var(--dm-bg-card) !important;
        color: var(--dm-text-primary) !important;
    }

    .modal-body p,
    .modal-body ul {
        color: var(--dm-text-primary) !important;
    }

    .modal-body ul li {
        color: #b8b3b0 !important;
    }

    .modal-footer {
        border-top-color: var(--dm-border-primary) !important;
        background-color: var(--dm-bg-card-secondary) !important;
    }

    .modal-note {
        border-top-color: var(--dm-border-primary) !important;
        color: #b8b3b0 !important;
    }

    /* Dropdown menus */
    .dropdown-menu {
        background-color: var(--dm-bg-card) !important;
        border-color: var(--dm-border-primary) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    }

    .dropdown-item {
        color: var(--dm-text-primary) !important;
    }

    .dropdown-item:hover {
        background-color: var(--dm-bg-card-secondary) !important;
        color: #ffffff !important;
    }

    .dropdown-divider {
        border-color: var(--dm-border-primary) !important;
    }

    /* ========================================== */
    /* 2. AUTH MODAL & FORMS */
    /* ========================================== */

    /* Auth overlay - dark semi-transparent background */
    .rv-auth-overlay {
        background-color: rgba(0, 0, 0, 0.7) !important;
    }

    /* Auth modal container */
    .rv-auth-modal {
        background-color: var(--dm-bg-card) !important;
        color: var(--dm-text-primary) !important;
        border-color: var(--dm-border-primary) !important;
        border-radius: 12px !important;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6) !important;
    }

    /* Auth modal title */
    .rv-auth-modal h2 {
        color: #ffffff !important;
    }

    /* Auth modal subtitle */
    .rv-auth-subtitle {
        color: #b8b3b0 !important;
    }

    /* Auth form labels */
    .rv-auth-modal label {
        color: var(--dm-text-primary) !important;
    }

    /* Auth form inputs */
    .rv-auth-modal input[type="email"],
    .rv-auth-modal input[type="password"],
    .rv-auth-modal input[type="text"] {
        background-color: var(--dm-bg-card-secondary) !important;
        color: #ffffff !important;
        border-color: var(--dm-border-primary) !important;
    }

    .rv-auth-modal input::placeholder {
        color: #8f8b87 !important;
    }

    .rv-auth-modal input:focus {
        background-color: var(--dm-bg-card-secondary) !important;
        border-color: #77883e !important;
        box-shadow: 0 0 0 3px rgba(119, 136, 62, 0.2) !important;
        outline: none !important;
    }

    /* Override browser autofill styling in auth modals */
    .rv-auth-modal input[type="email"]:-webkit-autofill,
    .rv-auth-modal input[type="email"]:-webkit-autofill:hover,
    .rv-auth-modal input[type="email"]:-webkit-autofill:focus,
    .rv-auth-modal input[type="email"]:-webkit-autofill:active,
    .rv-auth-modal input[type="password"]:-webkit-autofill,
    .rv-auth-modal input[type="password"]:-webkit-autofill:hover,
    .rv-auth-modal input[type="password"]:-webkit-autofill:focus,
    .rv-auth-modal input[type="password"]:-webkit-autofill:active {
        -webkit-box-shadow: 0 0 0 30px var(--dm-bg-card-secondary) inset !important;
        -webkit-text-fill-color: #ffffff !important;
        color: #ffffff !important;
    }

    /* Auth checkbox */
    .rv-auth-modal input[type="checkbox"] {
        background-color: var(--dm-bg-card-secondary) !important;
        border-color: var(--dm-border-primary) !important;
        accent-color: #77883e !important;
        appearance: checkbox;
        -webkit-appearance: checkbox;
        -moz-appearance: checkbox;
        flex-shrink: 0;
        pointer-events: auto;
    }

    /* Auth actions (remember me, forgot password) */
    .rv-auth-actions {
        color: var(--dm-text-primary) !important;
    }

    .rv-auth-actions label {
        display: flex;
        align-items: center;
        gap: 8px;
        cursor: pointer;
        user-select: none;
    }

    .rv-auth-actions input[type="checkbox"] {
        margin: 0;
        width: 18px;
        height: 18px;
        min-width: 18px;
        flex-shrink: 0;
    }

    /* Checkbox focus indicator */
    input[type="checkbox"]:focus-visible {
        outline: 2px solid var(--dm-accent-gold) !important;
        outline-offset: 2px;
    }

    input[type="radio"]:focus-visible {
        outline: 2px solid var(--dm-accent-gold) !important;
        outline-offset: 2px;
    }

    .rv-auth-actions a,
    .rv-forgot {
        color: #d9cc94 !important;
    }

    .rv-auth-actions a:hover,
    .rv-forgot:hover {
        color: #e8c547 !important;
    }

    /* Auth submit button */
    .rv-auth-submit {
        background-color: #77883e !important;
        color: #ffffff !important;
        border-color: #77883e !important;
    }

    .rv-auth-submit:hover {
        background-color: #5f7030 !important;
        border-color: #5f7030 !important;
    }

    .rv-auth-submit:disabled {
        background-color: var(--dm-bg-card-secondary) !important;
        color: #8a8580 !important;
        border-color: var(--dm-bg-card-secondary) !important;
        opacity: 0.6 !important;
    }

    /* Auth close button */
    .rv-auth-close {
        color: #b8b3b0 !important;
        background: transparent !important;
        border: none !important;
    }

    .rv-auth-close:hover {
        color: #d9cc94 !important;
    }

    /* Auth footer */
    .rv-auth-footer {
        color: var(--dm-text-primary) !important;
        border-top-color: var(--dm-border-primary) !important;
    }

    .rv-auth-footer a {
        color: #d9cc94 !important;
    }

    .rv-auth-footer a:hover {
        color: #e8c547 !important;
    }

    /* ========================================== */
    /* 3. BEM-STYLE MODALS */
    /* ========================================== */

    /* Modal overlay backdrop */
    .modal__overlay {
        background-color: rgba(0, 0, 0, 0.6) !important;
    }

    /* Modal content container */
    .modal__content {
        background-color: var(--dm-bg-card) !important;
        color: var(--dm-text-primary) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    }

    .modal__content--large {
        background-color: var(--dm-bg-card) !important;
    }

    /* Modal header */
    .modal__header {
        background: linear-gradient(135deg, #5f7030 0%, #396449 100%) !important;
        color: #ffffff !important;
        border-bottom-color: var(--dm-border-primary) !important;
    }

    .modal__header h2,
    .modal__header h3,
    .modal__title {
        color: #ffffff !important;
    }

    /* Modal close button */
    .modal__close {
        color: var(--dm-text-primary) !important;
        background: none !important;
        border: none !important;
    }

    .modal__close:hover {
        color: #ffffff !important;
    }

    /* Modal body */
    .modal__body {
        background-color: var(--dm-bg-card) !important;
        color: var(--dm-text-primary) !important;
    }

    .modal__body p,
    .modal__body span,
    .modal__body label {
        color: var(--dm-text-primary) !important;
    }

    .modal__body h3,
    .modal__body h4 {
        color: #ffffff !important;
    }

    /* Modal footer */
    .modal__footer {
        background-color: var(--dm-bg-card) !important;
        border-top-color: var(--dm-border-primary) !important;
    }

    /* Practitioner details in modals */
    .practitioner-details {
        color: var(--dm-text-primary) !important;
    }

    .modal-section {
        border-color: var(--dm-border-primary) !important;
    }

    .modal-section__title {
        color: #ffffff !important;
    }

    /* CRITICAL FIX: Override checkbox background-attachment globally in dark mode */
    input[type="checkbox"]:checked {
        background-attachment: scroll !important;
    }

    /* Travel type checkboxes - dark mode background */
    [data-travel-checkbox="true"] {
        background: var(--dm-bg-card) !important;
    }

    /* Terms checkboxes - dark mode background */
    [data-terms-checkbox="true"] {
        background: var(--dm-bg-card) !important;
    }

    /* Terms modal content - dark mode */
    .terms-section {
        background: rgba(119, 136, 62, 0.1) !important;
    }

    .terms-section h3,
    .terms-content h4,
    .terms-content h5 {
        color: #ffffff !important;
    }

    .terms-scroll {
        background: var(--dm-bg-card) !important;
        border-color: var(--dm-border-primary) !important;
        color: var(--dm-text-primary) !important;
    }

    .terms-content p,
    .terms-content ul {
        color: #d4cfc3 !important;
    }

    .terms-content a {
        color: #d9cc94 !important;
    }

    .terms-content a:hover {
        color: #e8c547 !important;
    }

    .terms-checkboxes {
        margin-top: 1.5rem;
    }

    .terms-checkbox span {
        color: var(--dm-text-primary) !important;
    }

    /* ========================================== */
    /* 4. FORM INPUTS & CONTROLS */
    /* ========================================== */

    /* Modal form inputs */
    .modal__body input[type="text"],
    .modal__body input[type="email"],
    .modal__body input[type="number"],
    .modal__body select,
    .modal__body textarea {
        background-color: var(--dm-bg-card-secondary) !important;
        color: #ffffff !important;
        border-color: var(--dm-border-primary) !important;
    }

    .modal__body input::placeholder,
    .modal__body textarea::placeholder {
        color: #8f8b87 !important;
    }

    .modal__body input:focus,
    .modal__body select:focus,
    .modal__body textarea:focus {
        background-color: var(--dm-bg-card-secondary) !important;
        border-color: #77883e !important;
        box-shadow: 0 0 0 3px rgba(119, 136, 62, 0.2) !important;
    }

    /* Generic form controls */
    .form-control,
    .form-input,
    input.form-control,
    select.form-control,
    textarea.form-control {
        background: var(--dm-bg-card-secondary) !important;
        color: var(--dm-text-primary) !important;
        border-color: var(--dm-border-primary) !important;
    }

    .form-control:focus,
    .form-input:focus,
    input.form-control:focus,
    select.form-control:focus,
    textarea.form-control:focus {
        border-color: var(--dm-color-primary) !important;
        box-shadow: var(--dm-focus-ring) !important;
        background: var(--dm-bg-card-secondary) !important;
    }

    .form-control::placeholder {
        color: var(--dm-form-placeholder) !important;
    }

    /* LOGOUT MODAL - DARK MODE */
    .logout-modal-content {
        background: var(--dm-bg-card) !important;
        color: #ffffff !important;
    }

    .logout-modal-title {
        color: #ffffff !important;
    }

    .logout-modal-message {
        color: #d0d0d0 !important;
    }

    .logout-modal-button {
        background: #778840 !important;
        color: #ffffff !important;
    }

    .logout-modal-button:hover {
        background: #8a9a4f !important;
    }

    .logout-modal-button:active {
        background: #6b7936 !important;
    }

    /* SIGNUP FORM - DARK MODE */
    /* Signup page hero section */
    .signup-hero h1 {
        color: #d9cc94 !important;
    }

    .signup-hero p {
        color: #d4cfc3 !important;
    }

    /* Main signup form container */
    .signup-form {
        background: var(--dm-bg-card) !important;
        border-color: var(--dm-border-primary) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
    }

    /* Form labels */
    .signup-form label {
        color: #ffffff !important;
    }

    /* All form inputs - TEXT, EMAIL, PASSWORD, TEL, DATE */
    .signup-form input[type="text"],
    .signup-form input[type="email"],
    .signup-form input[type="password"],
    .signup-form input[type="tel"],
    .signup-form input[type="date"],
    .signup-form select,
    .signup-form textarea {
        background-color: var(--dm-bg-card-secondary) !important;
        color: #ffffff !important;
        border-color: var(--dm-border-primary) !important;
    }

    /* Input placeholder text - CRITICAL FOR VISIBILITY */
    .signup-form input[type="text"]::placeholder,
    .signup-form input[type="email"]::placeholder,
    .signup-form input[type="password"]::placeholder,
    .signup-form input[type="tel"]::placeholder,
    .signup-form input[type="date"]::placeholder,
    .signup-form select::placeholder,
    .signup-form textarea::placeholder {
        color: #8f8b87 !important;
        opacity: 1 !important;
    }

    /* Input focus states */
    .signup-form input:focus,
    .signup-form select:focus,
    .signup-form textarea:focus {
        outline: none !important;
        background-color: var(--dm-bg-card-secondary) !important;
        border-color: #77883e !important;
        box-shadow: 0 0 0 3px rgba(119, 136, 62, 0.2) !important;
    }

    /* Browser autofill override for dark mode */
    .signup-form input[type="text"]:-webkit-autofill,
    .signup-form input[type="email"]:-webkit-autofill,
    .signup-form input[type="password"]:-webkit-autofill,
    .signup-form input[type="tel"]:-webkit-autofill,
    .signup-form input[type="date"]:-webkit-autofill,
    .signup-form input:-webkit-autofill {
        -webkit-box-shadow: 0 0 0 1000px var(--dm-bg-card-secondary) inset !important;
        -webkit-text-fill-color: #ffffff !important;
        color: #ffffff !important;
    }

    /* Form helper text */
    .signup-form .form-helper {
        color: #b0aca4 !important;
    }

    /* Password strength indicator */
    .password-strength-indicator {
        background: var(--dm-bg-card-secondary) !important;
        border-color: var(--dm-border-primary) !important;
    }

    .strength-fill {
        background: #77883e !important;
    }

    .requirement {
        color: #d4cfc3 !important;
    }

    .requirement-icon {
        color: #d32f2f !important;
    }

    .requirement.met {
        color: #4caf50 !important;
    }

    .requirement.met .requirement-icon {
        color: #4caf50 !important;
    }

    /* Form grid */
    .form-grid {
        background: transparent !important;
    }

    .form-grid > div {
        background: transparent !important;
    }

    /* Submit button */
    .signup-submit {
        background: #77883e !important;
        color: #ffffff !important;
        border: none !important;
    }

    .signup-submit:hover {
        background: #5f7030 !important;
    }

    .signup-submit:active {
        background: #4a5a25 !important;
    }

    .signup-submit:disabled {
        background: var(--dm-bg-card-secondary) !important;
        color: #8a8580 !important;
        opacity: 0.6 !important;
    }

    /* Consent section */
    .signup-consent {
        background: transparent !important;
        border-top-color: var(--dm-border-primary) !important;
    }

    .signup-consent label {
        color: #d4cfc3 !important;
    }

    .signup-consent a {
        color: #d9cc94 !important;
    }

    .signup-consent a:hover {
        color: #e8c547 !important;
    }

    /* Checkbox styling in signup form */
    .signup-form input[type="checkbox"] {
        background-color: var(--dm-bg-card-secondary) !important;
        border-color: var(--dm-border-primary) !important;
        accent-color: #77883e !important;
    }

    .signup-form input[type="checkbox"]:checked {
        background-color: #77883e !important;
        border-color: #77883e !important;
    }

    .signup-form input[type="checkbox"]:focus {
        outline: none !important;
        border-color: #77883e !important;
        box-shadow: 0 0 0 2px rgba(119, 136, 62, 0.3) !important;
    }
}
