/* Dark Mode Input Field Styles - Comprehensive Coverage */

/* Base input, textarea, select styles */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select,
body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
    border: 1px solid var(--border-color, #404040) !important;
}

/* Focus states */
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus,
body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
    background-color: var(--bg-tertiary, #3a3a3a) !important;
    border-color: var(--input-focus-border, #5a9fd4) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(90, 159, 212, 0.1) !important;
}

/* Disabled inputs */
[data-theme="dark"] input:disabled,
[data-theme="dark"] textarea:disabled,
[data-theme="dark"] select:disabled,
body.dark-mode input:disabled,
body.dark-mode textarea:disabled,
body.dark-mode select:disabled {
    background-color: var(--bg-primary, #1a1a1a) !important;
    color: var(--text-muted, #808080) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Placeholder text */
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder,
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
    color: var(--text-muted, #808080) !important;
    opacity: 0.7;
}

/* Checkboxes and Radio buttons */
[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"],
body.dark-mode input[type="checkbox"],
body.dark-mode input[type="radio"] {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    border-color: var(--border-color, #404040) !important;
}

[data-theme="dark"] input[type="checkbox"]:checked,
[data-theme="dark"] input[type="radio"]:checked,
body.dark-mode input[type="checkbox"]:checked,
body.dark-mode input[type="radio"]:checked {
    background-color: var(--link-color, #5a9fd4) !important;
    border-color: var(--link-color, #5a9fd4) !important;
}

/* File inputs */
[data-theme="dark"] input[type="file"],
body.dark-mode input[type="file"] {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
}

[data-theme="dark"] input[type="file"]::file-selector-button,
body.dark-mode input[type="file"]::file-selector-button {
    background-color: var(--bg-tertiary, #3a3a3a) !important;
    color: var(--text-primary, #e4e4e4) !important;
    border: 1px solid var(--border-color, #404040) !important;
}

/* Range inputs */
[data-theme="dark"] input[type="range"],
body.dark-mode input[type="range"] {
    background-color: var(--bg-tertiary, #3a3a3a) !important;
}

[data-theme="dark"] input[type="range"]::-webkit-slider-thumb,
body.dark-mode input[type="range"]::-webkit-slider-thumb {
    background-color: var(--link-color, #5a9fd4) !important;
}

/* Number inputs */
[data-theme="dark"] input[type="number"],
body.dark-mode input[type="number"] {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
}

/* Search inputs */
[data-theme="dark"] input[type="search"],
body.dark-mode input[type="search"] {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
}

/* Date/Time inputs */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] input[type="datetime-local"],
body.dark-mode input[type="date"],
body.dark-mode input[type="time"],
body.dark-mode input[type="datetime-local"] {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
    color-scheme: dark;
}

/* Form labels */
[data-theme="dark"] label,
body.dark-mode label {
    color: var(--text-primary, #e4e4e4) !important;
}

/* Form groups */
[data-theme="dark"] .form-group,
body.dark-mode .form-group {
    color: var(--text-primary, #e4e4e4) !important;
}

/* Fieldsets and legends */
[data-theme="dark"] fieldset,
body.dark-mode fieldset {
    border-color: var(--border-color, #404040) !important;
}

[data-theme="dark"] legend,
body.dark-mode legend {
    color: var(--text-primary, #e4e4e4) !important;
}

/* Select dropdown arrow - Fixed */
[data-theme="dark"] select,
body.dark-mode select {
    /* Remove default arrow first */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Add custom arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e4e4e4' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat !important;
    background-position: right 0.5rem center !important;
    background-size: 16px 12px !important;
    padding-right: 2rem !important;
}

/* Validation states */
[data-theme="dark"] input.is-invalid,
[data-theme="dark"] textarea.is-invalid,
[data-theme="dark"] select.is-invalid,
body.dark-mode input.is-invalid,
body.dark-mode textarea.is-invalid,
body.dark-mode select.is-invalid {
    border-color: #dc2626 !important;
    background-color: rgba(220, 38, 38, 0.1) !important;
}

[data-theme="dark"] input.is-valid,
[data-theme="dark"] textarea.is-valid,
[data-theme="dark"] select.is-valid,
body.dark-mode input.is-valid,
body.dark-mode textarea.is-valid,
body.dark-mode select.is-valid {
    border-color: #10b981 !important;
    background-color: rgba(16, 185, 129, 0.1) !important;
}

/* Help text */
[data-theme="dark"] .form-text,
[data-theme="dark"] .help-text,
[data-theme="dark"] small,
body.dark-mode .form-text,
body.dark-mode .help-text,
body.dark-mode small {
    color: var(--text-muted, #808080) !important;
}

/* Settings page specific inputs */
[data-theme="dark"] #profile-form input,
[data-theme="dark"] #profile-form select,
body.dark-mode #profile-form input,
body.dark-mode #profile-form select {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
    border-color: var(--border-color, #404040) !important;
}

/* Preference inputs */
[data-theme="dark"] [id^="pref-"],
body.dark-mode [id^="pref-"] {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
    border-color: var(--border-color, #404040) !important;
}

/* GLCV modal inputs */
[data-theme="dark"] #set-modal input,
[data-theme="dark"] #set-modal select,
[data-theme="dark"] #add-term-modal input,
[data-theme="dark"] #add-term-modal select,
[data-theme="dark"] #bulk-upload-modal textarea,
body.dark-mode #set-modal input,
body.dark-mode #set-modal select,
body.dark-mode #add-term-modal input,
body.dark-mode #add-term-modal select,
body.dark-mode #bulk-upload-modal textarea {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
    border-color: var(--border-color, #404040) !important;
}

/* Translation text areas */
[data-theme="dark"] #source-text,
[data-theme="dark"] #translation-result,
body.dark-mode #source-text,
body.dark-mode #translation-result {
    background-color: var(--bg-secondary, #2d2d2d) !important;
    color: var(--text-primary, #e4e4e4) !important;
    border-color: var(--border-color, #404040) !important;
}

/* Override any inline styles */
[data-theme="dark"] input[style*="background"],
[data-theme="dark"] textarea[style*="background"],
[data-theme="dark"] select[style*="background"],
body.dark-mode input[style*="background"],
body.dark-mode textarea[style*="background"],
body.dark-mode select[style*="background"] {
    background-color: var(--bg-secondary, #2d2d2d) !important;
}

/* Input groups */
[data-theme="dark"] .input-group,
body.dark-mode .input-group {
    background-color: var(--bg-secondary, #2d2d2d) !important;
}

[data-theme="dark"] .input-group-text,
body.dark-mode .input-group-text {
    background-color: var(--bg-tertiary, #3a3a3a) !important;
    color: var(--text-primary, #e4e4e4) !important;
    border-color: var(--border-color, #404040) !important;
}