/* Yaad Apps Custom Admin Theme - Green, Gold, Black */

/* Main header and navigation */
#header {
    background: linear-gradient(135deg, #1a5f1a 0%, #018144 100%) !important;
    color: #ffffff !important;
    border-bottom: 3px solid #F9D01F !important;
}

#branding h1, #branding h1 a:link, #branding h1 a:visited {
    color: #F9D01F !important;
    font-weight: bold !important;
}

#user-tools a:link, #user-tools a:visited {
    color: #ffffff !important;
}

#user-tools a:hover {
    color: #F9D01F !important;
}

/* Navigation tabs */
.module h2, .module caption, .inline-group h2 {
    background: linear-gradient(135deg, #018144 0%, #1a5f1a 100%) !important;
    color: #ffffff !important;
    border-bottom: 2px solid #F9D01F !important;
}

/* Breadcrumbs */
div.breadcrumbs {
    background: #121212 !important;
    border-bottom: 1px solid #ddd !important;
}

div.breadcrumbs a {
    color: #018144 !important;
}

div.breadcrumbs a:hover {
    color: #1a5f1a !important;
}

/* Buttons */
.default, input[type=submit].default, .submit-row input.default {
    background: linear-gradient(135deg, #018144 0%, #1a5f1a 100%) !important;
    border: 1px solid #1a5f1a !important;
    color: #ffffff !important;
}

.default:hover, input[type=submit].default:hover, .submit-row input.default:hover {
    background: linear-gradient(135deg, #1a5f1a 0%, #0f3f0f 100%) !important;
    border: 1px solid #F9D01F !important;
}

/* Secondary buttons */
.button, input[type=submit], input[type=button], .submit-row input, a.button {
    background: linear-gradient(135deg, #F9D01F 0%, #ffed4e 100%) !important;
    border: 1px solid #e6c200 !important;
    color: #1a5f1a !important;
    font-weight: bold !important;
}

.button:hover, input[type=submit]:hover, input[type=button]:hover, .submit-row input:hover, a.button:hover {
    background: linear-gradient(135deg, #ffed4e 0%, #F9D01F 100%) !important;
    border: 1px solid #1a5f1a !important;
}

/* Links - Context-aware colors */
/* Header links (dark background) */
#header a:link, #header a:visited,
#user-tools a:link, #user-tools a:visited,
.module h2 a:link, .module h2 a:visited,
.module caption a:link, .module caption a:visited,
.inline-group h2 a:link, .inline-group h2 a:visited {
    color: #ffffff !important;
}

#header a:hover, #user-tools a:hover,
.module h2 a:hover, .module caption a:hover,
.inline-group h2 a:hover {
    color: #F9D01F !important;
}

/* Content area links (light background) */
.main a:link, .main a:visited,
.content a:link, .content a:visited,
.results a:link, .results a:visited,
.form-row a:link, .form-row a:visited,
.field-box a:link, .field-box a:visited,
.dashboard .module table td a:link,
.dashboard .module table td a:visited {
    color: #018144 !important;
}

.main a:hover, .content a:hover,
.results a:hover, .form-row a:hover,
.field-box a:hover,
.dashboard .module table td a:hover {
    color: #1a5f1a !important;
}

/* Sidebar links */
#changelist-sidebar a:link, #changelist-sidebar a:visited {
    color: #1a5f1a !important;
}

#changelist-sidebar a:hover {
    color: #018144 !important;
}

/* Pagination links */
.paginator a:link, .paginator a:visited {
    background: #018144 !important;
    color: #ffffff !important;
    border: 1px solid #1a5f1a !important;
}

.paginator a:hover {
    background: #1a5f1a !important;
    border: 1px solid #F9D01F !important;
    color: #ffffff !important;
}

/* Default fallback for other links */
a:link, a:visited {
    color: #018144 !important;
}

a:hover {
    color: #1a5f1a !important;
}

/* Table headers */
th {
    background: #121212 !important;
    border-bottom: 2px solid #018144 !important;
    color: #1a5f1a !important;
    font-weight: bold !important;
}

/* Selected rows */
.selected {
    background-color: #e8f5e8 !important;
}

/* Form field focus */
input:focus, textarea:focus, select:focus {
    border-color: #018144 !important;
    box-shadow: 0 0 5px rgba(45, 143, 45, 0.3) !important;
}

/* Success messages */
.success {
    background: #e8f5e8 !important;
    border: 1px solid #018144 !important;
    color: #1a5f1a !important;
}

/* Error messages */
.error, .errornote {
    background: #ffe6e6 !important;
    border: 1px solid #cc0000 !important;
    color: #cc0000 !important;
}

/* Warning messages */
.warning {
    background: #fff8e1 !important;
    border: 1px solid #F9D01F !important;
    color: #b8860b !important;
}

/* Sidebar */
#changelist-sidebar {
    background: #f8f8f8 !important;
    border-left: 3px solid #018144 !important;
}

#changelist-sidebar h2 {
    background: #018144 !important;
    color: #ffffff !important;
}

#changelist-sidebar h3 {
    color: #1a5f1a !important;
}

/* Pagination current page */

.paginator .this-page {
    background: #F9D01F !important;
    color: #1a5f1a !important;
    border: 1px solid #e6c200 !important;
}

/* Dashboard modules */
.dashboard .module table th {
    background: #121212 !important;
    color: #ffffff !important;
}

.dashboard .module table td a {
    color: #018144 !important;
}

/* Calendar widget */
.calendar th {
    background: #018144 !important;
    color: #ffffff !important;
}

.calendar td.selected a {
    background: #F9D01F !important;
    color: #1a5f1a !important;
}

/* Inline forms */
.inline-group .tabular tr.has_original td {
    background: #121212 !important;
}

.inline-group .tabular tr.add-row td {
    background: #121212 !important;
}

/* Text visibility fixes */
/* Ensure text is visible in all contexts */
.field-box label, .form-row label {
    color: #1a5f1a !important;
    font-weight: 600 !important;
}

.help, .help-text {
    color: #6b7280 !important;
}

/* Table text */
.results tbody td {
    color: #018144 !important;
}

.results tbody td a {
    color: #018144 !important;
}

/* Form field text */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], textarea, select {
    color: #1f2937 !important;
    background: #ffffff !important;
}

/* Error text visibility */
.errorlist li {
    color: #dc2626 !important;
    background: #fef2f2 !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
}

/* Custom branding */
#branding h1:before {
    content: "🌟 ";
    color: #F9D01F !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #header {
        padding: 10px !important;
    }
    
    #branding h1 {
        font-size: 18px !important;
    }
}

/* Enhanced Dark Mode Support for Better Contrast */
@media (prefers-color-scheme: dark) {
    body {
        background: #1a1a1a !important;
        color: #ffffff !important;
    }

    /* Main content area contrast fix */
    #content, .colMS, .colM, .colSM {
        background: #2a2a2a !important;
        color: #ffffff !important;
    }

    /* Module backgrounds */
    .module {
        background: #2a2a2a !important;
        border: 1px solid #018144 !important;
    }

    /* Form elements */
    input, textarea, select {
        background: #2a2a2a !important;
        color: #ffffff !important;
        border: 1px solid #018144 !important;
    }

    /* Table styling for better contrast */
    table, thead th, tbody td {
        background: #2a2a2a !important;
        color: #ffffff !important;
        border-color: #3a3a3a !important;
    }

    /* Table hover effects - replace white with appropriate dark colors */
    tbody tr:hover {
        background: #3a3a3a !important;
        color: #ffffff !important;
    }

    /* Filter section styling */
    #changelist-filter {
        background: #2a2a2a !important;
        border-left: 1px solid #3a3a3a !important;
    }

    #changelist-filter h2 {
        background: #018144 !important;
        color: #ffffff !important;
    }

    #changelist-filter h3 {
        color: #ffffff !important;
    }

    #changelist-filter li {
        background: #2a2a2a !important;
        border-bottom: 1px solid #3a3a3a !important;
    }

    #changelist-filter a {
        color: #F9D01F !important;
    }

    #changelist-filter a:hover {
        background: #3a3a3a !important;
        color: #ffffff !important;
    }

    /* Consistent white background dropdowns to match text inputs */
    select {
        background: #ffffff !important;
        color: #333333 !important;
        border: 1px solid #cccccc !important;
        border-radius: 4px !important;
        /* Ensure selected text is visible */
        -webkit-appearance: none !important;
        -moz-appearance: none !important;
        appearance: none !important;
        font-size: 14px !important;
        padding: 6px 8px !important;
    }

    select option {
        background: #ffffff !important;
        color: #333333 !important;
        padding: 8px !important;
    }

    select option:checked,
    select option:hover {
        background: #018144 !important;
        color: #ffffff !important;
    }

    /* Ensure dropdown consistency in all contexts */
    .form-row select,
    .form-group select,
    .field-tier select,
    .field-parent select,
    .field-site_layout_template select {
        background: #ffffff !important;
        color: #333333 !important;
        border: 1px solid #cccccc !important;
        border-radius: 4px !important;
        font-size: 14px !important;
        padding: 6px 8px !important;
    }

    /* Fix for specific dropdown fields */
    select[name="tier"],
    select[name="parent"],
    select[name="site_layout_template"],
    select[id*="tier"],
    select[id*="parent"] {
        background: #ffffff !important;
        color: #333333 !important;
        border: 1px solid #cccccc !important;
        border-radius: 4px !important;
        font-weight: normal !important;
    }

    /* Focus state for consistency */
    select:focus {
        background: #ffffff !important;
        color: #333333 !important;
        border: 2px solid #018144 !important;
        outline: none !important;
        box-shadow: 0 0 0 2px rgba(1, 129, 68, 0.2) !important;
    }

    /* Breadcrumbs */
    .breadcrumbs {
        background: #3a3a3a !important;
        color: #ffffff !important;
    }

    .breadcrumbs a {
        color: #F9D01F !important;
    }

    /* Form field labels */
    label, .form-row label {
        color: #ffffff !important;
    }

    /* Help text */
    .help, .helptext {
        color: #cccccc !important;
    }

    /* Error messages */
    .errorlist {
        background: #5a1a1a !important;
        color: #ffcccc !important;
        border: 1px solid #cc0000 !important;
    }

    /* Success messages */
    .messagelist .success {
        background: #1a5a1a !important;
        color: #ccffcc !important;
        border: 1px solid #018144 !important;
    }

    /* Warning messages */
    .messagelist .warning {
        background: #5a4a1a !important;
        color: #ffffcc !important;
        border: 1px solid #F9D01F !important;
    }
}
