/*
 * Django Admin Light Theme Override
 *
 * Purpose: Force light theme in Django 3.2+ admin regardless of system preferences.
 * This prevents dark mode from being applied even when user's OS is in dark mode.
 *
 * How it works:
 * 1. Forces color-scheme to light only
 * 2. Re-declares all CSS variables with light theme values
 * 3. These declarations have higher specificity and load after Django's CSS
 *
 * Compatibility: Django 3.2, 4.x, 5.x
 * Maintenance: If Django changes variable names, update this file accordingly.
 *              Check Django release notes for admin CSS changes.
 *
 * Last updated: December 2025
 */

/* Force light color scheme - prevents browser from applying dark mode */
:root {
    color-scheme: light only;
}

/* Re-declare all light theme variables to override any dark mode detection */
:root {
    /* Primary colors - Django's classic blue theme */
    --primary: #79aec8;
    --secondary: #417690;
    --accent: #f5dd5d;
    --primary-fg: #fff;

    /* Body colors - white background, dark text */
    --body-fg: #333;
    --body-bg: #fff;
    --body-quiet-color: #666;
    --body-loud-color: #000;

    /* Header - teal/blue header with light text */
    --header-color: #ffc;
    --header-branding-color: var(--accent);
    --header-bg: var(--secondary);
    --header-link-color: var(--primary-fg);

    /* Breadcrumbs */
    --breadcrumbs-fg: #c4dce8;
    --breadcrumbs-link-fg: var(--body-bg);
    --breadcrumbs-bg: var(--primary);

    /* Links - classic Django blue */
    --link-fg: #447e9b;
    --link-hover-color: #036;
    --link-selected-fg: #5b80b2;

    /* Borders and hairlines */
    --hairline-color: #e8e8e8;
    --border-color: #ccc;

    /* Error states */
    --error-fg: #ba2121;

    /* Messages */
    --message-success-bg: #dfd;
    --message-warning-bg: #ffc;
    --message-error-bg: #ffefef;

    /* Background variations */
    --darkened-bg: #f8f8f8;
    --selected-bg: #e4e4e4;
    --selected-row: #ffc;

    /* Buttons */
    --button-fg: #fff;
    --button-bg: var(--primary);
    --button-hover-bg: #609ab6;
    --default-button-bg: var(--secondary);
    --default-button-hover-bg: #205067;
    --close-button-bg: #888;
    --close-button-hover-bg: #747474;
    --delete-button-bg: #ba2121;
    --delete-button-hover-bg: #a41515;

    /* Object tools */
    --object-tools-fg: var(--button-fg);
    --object-tools-bg: var(--close-button-bg);
    --object-tools-hover-bg: var(--close-button-hover-bg);
}

/* Additional overrides to ensure light theme in all contexts */
@media (prefers-color-scheme: dark) {
    :root {
        /* Force light theme colors even when system is in dark mode */
        --primary: #79aec8;
        --secondary: #417690;
        --accent: #f5dd5d;
        --primary-fg: #fff;

        --body-fg: #333;
        --body-bg: #fff;
        --body-quiet-color: #666;
        --body-loud-color: #000;

        --header-color: #ffc;
        --header-branding-color: var(--accent);
        --header-bg: var(--secondary);
        --header-link-color: var(--primary-fg);

        --breadcrumbs-fg: #c4dce8;
        --breadcrumbs-link-fg: var(--body-bg);
        --breadcrumbs-bg: var(--primary);

        --link-fg: #447e9b;
        --link-hover-color: #036;
        --link-selected-fg: #5b80b2;

        --hairline-color: #e8e8e8;
        --border-color: #ccc;

        --error-fg: #ba2121;

        --message-success-bg: #dfd;
        --message-warning-bg: #ffc;
        --message-error-bg: #ffefef;

        --darkened-bg: #f8f8f8;
        --selected-bg: #e4e4e4;
        --selected-row: #ffc;

        --button-fg: #fff;
        --button-bg: var(--primary);
        --button-hover-bg: #609ab6;
        --default-button-bg: var(--secondary);
        --default-button-hover-bg: #205067;
        --close-button-bg: #888;
        --close-button-hover-bg: #747474;
        --delete-button-bg: #ba2121;
        --delete-button-hover-bg: #a41515;

        --object-tools-fg: var(--button-fg);
        --object-tools-bg: var(--close-button-bg);
        --object-tools-hover-bg: var(--close-button-hover-bg);
    }
}

/* Ensure body has correct background (fallback for older browsers) */
body {
    background: #fff !important;
    color: #333 !important;
}

/* Header styling to match production */
#header {
    background: #417690 !important;
    color: #ffc !important;
}

#branding h1, #branding h1 a:link, #branding h1 a:visited {
    color: #f5dd5d !important;
}

/* ============================================================
 * Django 3.2+ Nav Sidebar - DISABLED
 *
 * Django 3.2 introduced a collapsible nav sidebar which conflicts
 * with our custom admin templates (chain search, gallery mode, etc.)
 * We disable it completely to maintain Django 2.2 layout.
 * ============================================================ */

/* Hide the nav sidebar completely */
#nav-sidebar {
    display: none !important;
}

/* Hide the sidebar toggle button */
#toggle-nav-sidebar {
    display: none !important;
}

/* Remove nav-sidebar width reservation from Django 3.2+ layout */
.main > #nav-sidebar + .content,
.main.shifted > #nav-sidebar + .content {
    max-width: 100% !important;
    width: 100% !important;
}

/* Ensure main content uses full width (no sidebar offset) */
.main {
    margin-left: 0 !important;
    max-width: none !important;
}

#container {
    max-width: none !important;
    padding-left: 0 !important;
}

/* Reset body class that indicates sidebar is open */
body.shift-nav-sidebar {
    padding-left: 0 !important;
}

/* Ensure changelist takes full width */
#changelist {
    width: 100% !important;
    max-width: none !important;
}

/* Fix content-main width */
#content-main {
    max-width: none !important;
}

/* Ensure the module (changelist container) spans full width */
.module {
    max-width: none !important;
}
