/* Kokpit Admin Custom Styles - Enhanced UX */

/* ==========================================================================
   FORM LAYOUT SYSTEM - RESPONSIVE GRID SYSTEM
   ========================================================================== */

/* Base Grid Classes - Responsive by default */
.unfold-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1rem;
}

.unfold-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1rem;
}

.unfold-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    align-items: start;
    margin-bottom: 1rem;
}

/* Enhanced Card Styling */
.unfold-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(229, 231, 235, 0.8);
    transition: all 0.3s ease;
    position: relative;
}

.unfold-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    border-color: rgba(59, 130, 246, 0.3);
}

/* Full Width Form Fields */
.unfold-full-width {
    grid-column: 1 / -1;
}

/* Form Field Groups */
.unfold-field-group {
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}

/* Dark Mode Support */
[data-theme="dark"] .unfold-card,
.dark .unfold-card {
    background: rgb(31, 41, 55);
    border-color: rgb(55, 65, 81);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Dark mode for grid containers */
[data-theme="dark"] .unfold-grid-2,
[data-theme="dark"] .unfold-grid-3,
.dark .unfold-grid-2,
.dark .unfold-grid-3 {
    background: transparent;
}

/* Form field backgrounds in dark mode */
[data-theme="dark"] .unfold-card input,
[data-theme="dark"] .unfold-card textarea,
[data-theme="dark"] .unfold-card select,
.dark .unfold-card input,
.dark .unfold-card textarea,
.dark .unfold-card select {
    background: rgb(17, 24, 39);
    border-color: rgb(55, 65, 81);
    color: rgb(229, 231, 235);
}

/* Form labels in dark mode */
[data-theme="dark"] .unfold-card label,
.dark .unfold-card label {
    color: rgb(209, 213, 219);
}

/* Fieldset headers in dark mode */
[data-theme="dark"] .unfold-card .fieldset h2,
[data-theme="dark"] .unfold-card fieldset h2,
.dark .unfold-card .fieldset h2,
.dark .unfold-card fieldset h2 {
    color: rgb(243, 244, 246);
    border-bottom-color: rgb(55, 65, 81);
}

/* Turkish Language Support */
.field-oem_codes textarea {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.4;
}

/* Badge Styles */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-inactive {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ==========================================================================
   FORM INPUT STYLING - CONSISTENT SIZING & APPEARANCE
   ========================================================================== */

/* Base Form Input Styling */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="search"],
textarea,
select {
    width: 100% !important;
    min-height: 40px;
    padding: 0.75rem 1rem !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    transition: all 0.2s ease !important;
    background: white !important;
    box-sizing: border-box !important;
}

/* Focus States */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="tel"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1) !important;
}

/* Textarea Specific Styling */
textarea {
    min-height: 80px !important;
    resize: vertical !important;
}

/* Large Textarea */
textarea.large {
    min-height: 120px !important;
}

/* Specific styling for dimension_info field */
textarea[name="dimension_info"] {
    min-height: 140px !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    background: #fafbfc !important;
    border: 2px solid #e2e8f0 !important;
}

/* Specific styling for description field */
textarea[name="description"] {
    min-height: 150px !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    background: #fafbfc !important;
    border: 2px solid #e2e8f0 !important;
    padding: 1rem !important;
}

/* OEM codes field styling */
textarea[name="oem_codes"] {
    min-height: 100px !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-size: 13px !important;
    line-height: 1.4 !important;
    background: #f8fafc !important;
    border: 2px solid #e2e8f0 !important;
}

/* Select Dropdown Styling */
select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E") !important;
    background-position: right 0.75rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.25rem !important;
    padding-right: 2.5rem !important;
}

/* Form Row Layout */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
    align-items: start;
}

.form-row.triple {
    grid-template-columns: 1fr 1fr 1fr;
}

.form-row.quad {
    grid-template-columns: repeat(4, 1fr);
}

.form-row .field-box {
    display: flex;
    flex-direction: column;
}

/* Form Labels */
label {
    display: block !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    color: #374151 !important;
    margin-bottom: 0.5rem !important;
    line-height: 1.4 !important;
}

/* Required Field Indicators */
.required label::after {
    content: "*";
    color: #ef4444;
    margin-left: 0.25rem;
}

/* Help Text */
.help {
    font-size: 12px !important;
    color: #6b7280 !important;
    margin-top: 0.25rem !important;
    line-height: 1.4 !important;
}

/* Error Styling */
.errors {
    margin-top: 0.5rem;
}

.errorlist {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.errorlist li {
    background: #fef2f2 !important;
    border: 1px solid #fecaca !important;
    color: #dc2626 !important;
    padding: 0.5rem !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    margin-bottom: 0.25rem !important;
}

/* ==========================================================================
   BUTTON STYLING - CONSISTENT INTERACTIVE ELEMENTS
   ========================================================================== */

/* Primary Buttons */
.button,
input[type="submit"],
button[type="submit"],
.submit-row input {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    color: white !important;
    border: none !important;
    padding: 0.75rem 1.5rem !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    min-height: 40px !important;
}

.button:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
}

/* Secondary Buttons */
.button.secondary,
.cancel-link {
    background: white !important;
    color: #6b7280 !important;
    border: 2px solid #e5e7eb !important;
}

.button.secondary:hover,
.cancel-link:hover {
    background: #f9fafb !important;
    border-color: #d1d5db !important;
    color: #374151 !important;
}

/* Danger Buttons */
.button.danger,
.deletelink {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    color: white !important;
}

.button.danger:hover,
.deletelink:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
}

/* ==========================================================================
   RESPONSIVE DESIGN - MOBILE FIRST APPROACH
   ========================================================================== */

/* Tablet Styles */
@media (max-width: 1024px) {
    .unfold-grid-3,
    .unfold-grid-4 {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-row.triple,
    .form-row.quad {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    .unfold-grid-2,
    .unfold-grid-3,
    .unfold-grid-4 {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .form-row,
    .form-row.triple,
    .form-row.quad {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
    
    .unfold-card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }
    
    /* Larger touch targets on mobile */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="url"],
    input[type="tel"],
    input[type="search"],
    textarea,
    select {
        min-height: 44px !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* Extra Small Mobile */
@media (max-width: 480px) {
    .unfold-card {
        border-radius: 8px !important;
        padding: 0.75rem !important;
    }
    
    .button,
    input[type="submit"],
    button[type="submit"] {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* Custom Search Styling */
.searchbar {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.5rem 1rem;
}

/* Filter Sidebar */
.filter-sidebar {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 1rem;
}

/* Dashboard Cards */
.dashboard-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.dashboard-card h3 {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.dashboard-card p {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* Dark mode dashboard cards */
[data-theme="dark"] .dashboard-card,
.dark .dashboard-card {
    background: linear-gradient(135deg, #4c1d95 0%, #581c87 100%);
    border: 1px solid rgb(55, 65, 81);
}

/* Table Improvements */
.admin-table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.3s ease;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: #475569;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark mode tables */
[data-theme="dark"] .admin-table,
.dark .admin-table {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .admin-table th,
.dark .admin-table th {
    background: rgb(31, 41, 55);
    color: rgb(209, 213, 219);
}

[data-theme="dark"] .admin-table td,
.dark .admin-table td {
    background: rgb(17, 24, 39);
    color: rgb(229, 231, 235);
    border-color: rgb(55, 65, 81);
}

/* Action Buttons */
.action-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.action-button-primary {
    background: #3b82f6;
    color: white;
}

.action-button-primary:hover {
    background: #2563eb;
}

.action-button-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.action-button-secondary:hover {
    background: #e2e8f0;
}

/* Form Field Groups */
.field-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.field-group-title {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Dark mode for field groups */
[data-theme="dark"] .field-group,
.dark .field-group {
    background: rgb(31, 41, 55);
    border-color: rgb(55, 65, 81);
}

[data-theme="dark"] .field-group-title,
.dark .field-group-title {
    color: rgb(209, 213, 219);
}

/* ==========================================================================
   DARK MODE - COMPREHENSIVE FORM STYLING
   ========================================================================== */

/* Dark mode form inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] textarea,
[data-theme="dark"] select,
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="number"],
.dark input[type="url"],
.dark input[type="tel"],
.dark input[type="search"],
.dark textarea,
.dark select {
    background: rgb(17, 24, 39) !important;
    border-color: rgb(55, 65, 81) !important;
    color: rgb(229, 231, 235) !important;
}

/* Dark mode focus states */
[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] input[type="password"]:focus,
[data-theme="dark"] input[type="number"]:focus,
[data-theme="dark"] input[type="url"]:focus,
[data-theme="dark"] input[type="tel"]:focus,
[data-theme="dark"] input[type="search"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus,
.dark input[type="text"]:focus,
.dark input[type="email"]:focus,
.dark input[type="password"]:focus,
.dark input[type="number"]:focus,
.dark input[type="url"]:focus,
.dark input[type="tel"]:focus,
.dark input[type="search"]:focus,
.dark textarea:focus,
.dark select:focus {
    border-color: rgb(59, 130, 246) !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* Dark mode labels and help text */
[data-theme="dark"] label,
.dark label {
    color: rgb(209, 213, 219) !important;
}

[data-theme="dark"] .help,
.dark .help {
    color: rgb(156, 163, 175) !important;
}

/* Dark mode error styling */
[data-theme="dark"] .errorlist li,
.dark .errorlist li {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    color: rgb(248, 113, 113) !important;
}

/* Dark mode field groups */
[data-theme="dark"] .unfold-field-group,
.dark .unfold-field-group {
    background: rgb(31, 41, 55) !important;
    border-color: rgb(55, 65, 81) !important;
}

/* Dark mode select dropdown arrow */
[data-theme="dark"] select,
.dark select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%23d1d5db' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E") !important;
}

/* Dark mode for special textarea fields */
[data-theme="dark"] textarea[name="dimension_info"],
.dark textarea[name="dimension_info"] {
    background: rgb(17, 24, 39) !important;
    border-color: rgb(55, 65, 81) !important;
    color: rgb(229, 231, 235) !important;
}

[data-theme="dark"] textarea[name="description"],
.dark textarea[name="description"] {
    background: rgb(17, 24, 39) !important;
    border-color: rgb(55, 65, 81) !important;
    color: rgb(229, 231, 235) !important;
}

[data-theme="dark"] textarea[name="oem_codes"],
.dark textarea[name="oem_codes"] {
    background: rgb(17, 24, 39) !important;
    border-color: rgb(55, 65, 81) !important;
    color: rgb(229, 231, 235) !important;
}

/* Stock Level Indicators */
.stock-high { color: #059669; }
.stock-medium { color: #d97706; }
.stock-low { color: #dc2626; }
.stock-empty { color: #6b7280; }

/* Success/Error Messages */
.messages {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.message.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.message.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Additional Dark Mode Support */
[data-theme="dark"] .module,
[data-theme="dark"] .form-row,
[data-theme="dark"] fieldset,
.dark .module,
.dark .form-row,
.dark .fieldset {
    background: rgb(31, 41, 55);
    border-color: rgb(55, 65, 81);
}

[data-theme="dark"] .module h2,
[data-theme="dark"] fieldset h2,
[data-theme="dark"] .form-row h2,
.dark .module h2,
.dark fieldset h2,
.dark .form-row h2 {
    background: rgb(17, 24, 39);
    color: rgb(243, 244, 246);
    border-bottom-color: rgb(55, 65, 81);
}

/* Grid layouts specifically for Django admin fieldsets */
[data-theme="dark"] .fieldset.unfold-grid-2,
[data-theme="dark"] .fieldset.unfold-grid-3,
.dark .fieldset.unfold-grid-2,
.dark .fieldset.unfold-grid-3 {
    background: rgb(31, 41, 55);
    border: 1px solid rgb(55, 65, 81);
}

/* Form inputs in dark mode */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea,
[data-theme="dark"] select,
.dark input[type="text"],
.dark input[type="email"],
.dark input[type="password"],
.dark input[type="number"],
.dark textarea,
.dark select {
    background: rgb(17, 24, 39) !important;
    border-color: rgb(55, 65, 81) !important;
    color: rgb(229, 231, 235) !important;
}

/* ==========================================================================
   FORM FIELD SPACING AND LAYOUT IMPROVEMENTS
   ========================================================================== */

/* ==========================================================================
   FIELDSET LAYOUT IMPROVEMENTS - DESCRIPTIONS UNDER TITLES
   ========================================================================== */

/* Better spacing for Django admin fieldsets */
.fieldset {
    margin-bottom: 1.5rem !important;
    position: relative;
}

.fieldset h2 {
    margin-bottom: 0.5rem !important;
    padding: 0.75rem 1rem !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    border-bottom: none !important;
}

/* Hide all fieldset descriptions completely - targeting all possible selectors */
.fieldset .fieldset-description,
.fieldset-description,
.fieldset .help,
.fieldset .description,
.fieldset-desc,
.unfold-fieldset-description,
.fieldset .help-text,
.help-text,
fieldset .description,
fieldset > .help,
fieldset > .description,
.module h2 + .description,
.module h2 + .help,
.form-row .description,
.form-row .help,
fieldset legend + .description,
fieldset legend + .help,
.field-line .description,
.field-line .help,
div[class*="description"],
span[class*="description"],
p[class*="description"] {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* Improved form row spacing */
.form-row {
    margin-bottom: 1rem !important;
    padding: 0.75rem !important;
}

/* Better checkbox and radio button styling */
input[type="checkbox"],
input[type="radio"] {
    width: auto !important;
    min-height: auto !important;
    margin-right: 0.5rem !important;
}

/* Improved multiple select styling */
select[multiple] {
    min-height: 120px !important;
    padding: 0.5rem !important;
}

/* File input styling */
input[type="file"] {
    padding: 0.5rem !important;
    border: 2px dashed #e2e8f0 !important;
    background: #f8fafc !important;
}

input[type="file"]:hover {
    border-color: #cbd5e1 !important;
    background: #f1f5f9 !important;
}

/* Django's filter_horizontal widget styling */
.selector {
    width: 100% !important;
}

.selector select {
    width: 100% !important;
    min-height: 150px !important;
}

.selector .selector-available,
.selector .selector-chosen {
    width: 45% !important;
}

/* ==========================================================================
   AUTOCOMPLETE AND DROPDOWN WIDGET IMPROVEMENTS
   ========================================================================== */

/* Base autocomplete widget styling */
.select2-container {
    width: 100% !important;
    min-width: 200px !important;
}

.select2-container .select2-selection--single {
    height: 40px !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    min-width: 200px !important;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    padding-left: 1rem !important;
    padding-top: 0.5rem !important;
    line-height: 1.4 !important;
}

.select2-container .select2-selection--single .select2-selection__arrow {
    height: 38px !important;
    right: 1rem !important;
}

/* Fix for narrow dropdown issue in Vehicle Assignment */
.field-brand .select2-container,
.field-model .select2-container,
.field-year .select2-container,
.field-engine .select2-container {
    min-width: 250px !important;
    width: 100% !important;
}

/* Improve dropdown results */
.select2-dropdown {
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.select2-results__option {
    padding: 0.75rem 1rem !important;
    font-size: 14px !important;
}

.select2-results__option--highlighted {
    background-color: #3b82f6 !important;
    color: white !important;
}

/* Dark mode for select2 */
[data-theme="dark"] .select2-container .select2-selection--single,
.dark .select2-container .select2-selection--single {
    background: rgb(17, 24, 39) !important;
    border-color: rgb(55, 65, 81) !important;
    color: rgb(229, 231, 235) !important;
}

[data-theme="dark"] .select2-dropdown,
.dark .select2-dropdown {
    background: rgb(17, 24, 39) !important;
    border-color: rgb(55, 65, 81) !important;
}

[data-theme="dark"] .select2-results__option,
.dark .select2-results__option {
    color: rgb(229, 231, 235) !important;
}

[data-theme="dark"] .select2-results__option--highlighted,
.dark .select2-results__option--highlighted {
    background-color: rgb(59, 130, 246) !important;
}

/* ==========================================================================
   UNIVERSAL DROPDOWN WIDTH FIXES
   ========================================================================== */

/* Fix all autocomplete fields to have proper minimum width */
.field-created_by .select2-container,
.field-updated_by .select2-container,
.field-parent_category .select2-container,
.field-alias_name .select2-container,
.field-categories .select2-container,
.field-directions .select2-container,
.field-vehicles .select2-container,
.field-products .select2-container,
.field-parents .select2-container {
    min-width: 250px !important;
    width: 100% !important;
}

/* Django's built-in select widgets */
select.admin-autocomplete {
    min-width: 250px !important;
    width: 100% !important;
}

/* Fix for very narrow select2 containers */
.select2-container {
    max-width: none !important;
}

/* Ensure proper width on form fields in grid layouts */
.unfold-grid-2 .field-box,
.unfold-grid-3 .field-box,
.unfold-grid-4 .field-box {
    min-width: 0 !important; /* Allow flex shrinking */
    flex: 1 !important;
}

.unfold-grid-2 .field-box .select2-container,
.unfold-grid-3 .field-box .select2-container,
.unfold-grid-4 .field-box .select2-container {
    width: 100% !important;
    min-width: 200px !important;
}

/* Fix for narrow filter_horizontal fields - target specific select elements */
#id_vehicles_from,
#id_vehicles_to,
#id_categories_from,
#id_categories_to,
#id_directions_from,
#id_directions_to,
#id_products_from,
#id_products_to,
#id_parents_from,
#id_parents_to {
    min-width: 300px !important;
    width: 100% !important;
}

/* Fix parent containers */
.field-vehicles .selector,
.field-categories .selector,
.field-directions .selector,
.field-products .selector,
.field-parents .selector {
    min-width: 650px !important;
    width: 100% !important;
}

/* Ensure selector boxes have proper width */
.field-vehicles .selector-available,
.field-vehicles .selector-chosen,
.field-categories .selector-available,
.field-categories .selector-chosen,
.field-directions .selector-available,
.field-directions .selector-chosen,
.field-products .selector-available,
.field-products .selector-chosen,
.field-parents .selector-available,
.field-parents .selector-chosen {
    min-width: 300px !important;
    width: 48% !important;
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .unfold-card {
        padding: 0.75rem !important;
        margin: 0.5rem 0 !important;
    }
    
    .dashboard-card {
        padding: 1rem !important;
    }
    
    .dashboard-card h3 {
        font-size: 1.5rem !important;
    }
    
    .fieldset h2 {
        font-size: 14px !important;
        padding: 0.5rem !important;
    }
    
    .form-row {
        padding: 0.5rem !important;
    }
    
    /* Mobile filter_horizontal improvements */
    .field-vehicles .selector,
    .field-categories .selector,
    .field-directions .selector,
    .field-products .selector,
    .field-parents .selector {
        min-width: 100% !important;
    }
    
    #id_vehicles_from,
    #id_vehicles_to,
    #id_categories_from,
    #id_categories_to,
    #id_directions_from,
    #id_directions_to,
    #id_products_from,
    #id_products_to,
    #id_parents_from,
    #id_parents_to {
        min-width: 100% !important;
    }
    
    .selector .selector-available,
    .selector .selector-chosen {
        width: 100% !important;
        margin-bottom: 1rem;
        min-width: 100% !important;
    }
    
    /* Mobile dropdown improvements */
    .field-brand .select2-container,
    .field-model .select2-container,
    .field-year .select2-container,
    .field-engine .select2-container {
        min-width: 100% !important;
    }
    
    .select2-container .select2-selection--single {
        min-height: 44px !important;
        height: 44px !important;
    }
    
    .select2-container .select2-selection--single .select2-selection__rendered {
        padding-top: 0.75rem !important;
        font-size: 16px !important; /* Prevent iOS zoom */
    }
    
    /* Ensure descriptions stay hidden on mobile */
    .fieldset .fieldset-description,
    .fieldset-description {
        display: none !important;
    }
}

/* ==========================================================================
   EKLER (ADDITIONAL FIELDS) SECTION STYLING
   ========================================================================== */

/* Specific styling for product features and additional fields */
input[name="ozellik1"],
input[name="ozellik2"],
input[name="ozellik3"],
input[name="ozellik4"],
input[name="ozellik5"],
input[name="on_ek"],
input[name="son_ek"] {
    min-height: 44px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    background: #fafbfc !important;
    border: 2px solid #e2e8f0 !important;
    padding: 0.75rem 1rem !important;
    border-radius: 8px !important;
    width: 100% !important;
}

/* Special styling for Ön Ek and Son Ek fields */
.field-on_ek,
.field-son_ek {
    position: relative;
}

.field-on_ek input,
.field-son_ek input {
    background: linear-gradient(135deg, #f0fdf4, #ecfccb) !important;
    border: 2px solid #22c55e !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

.field-on_ek input:focus,
.field-son_ek input:focus {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1) !important;
    background: #f0fdf4 !important;
}

/* Labels for Ön Ek and Son Ek */
.field-on_ek label,
.field-son_ek label {
    color: #15803d !important;
    font-weight: 600 !important;
    font-size: 14px !important;
}

/* Dark mode for Ekler section */
[data-theme="dark"] input[name="on_ek"],
[data-theme="dark"] input[name="son_ek"],
.dark input[name="on_ek"],
.dark input[name="son_ek"] {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.1)) !important;
    border-color: rgb(34, 197, 94) !important;
    color: rgb(229, 231, 235) !important;
}

[data-theme="dark"] .field-on_ek label,
[data-theme="dark"] .field-son_ek label,
.dark .field-on_ek label,
.dark .field-son_ek label {
    color: rgb(34, 197, 94) !important;
}

/* Dark mode for other product feature fields */
[data-theme="dark"] input[name="ozellik1"],
[data-theme="dark"] input[name="ozellik2"],
[data-theme="dark"] input[name="ozellik3"],
[data-theme="dark"] input[name="ozellik4"],
[data-theme="dark"] input[name="ozellik5"],
.dark input[name="ozellik1"],
.dark input[name="ozellik2"],
.dark input[name="ozellik3"],
.dark input[name="ozellik4"],
.dark input[name="ozellik5"] {
    background: rgb(17, 24, 39) !important;
    border-color: rgb(55, 65, 81) !important;
    color: rgb(229, 231, 235) !important;
}