/* ============================================================
   HRMS — Django admin skin
   Brings /admin/* in line with the main app design system:
   Inter font, soft slate background, rounded-2xl cards,
   indigo pill buttons, ringed status pills. Force light mode
   so the dark-mode media query doesn't kick in unexpectedly.
   ============================================================ */

/* ----------- Force light mode (override Django 5 dark CSS vars) ----------- */
:root {
    color-scheme: light !important;
    /* Brand palette */
    --primary: #4f46e5 !important;
    --secondary: #4338ca !important;
    --accent: #ec4899 !important;
    --link-fg: #4f46e5 !important;
    --link-hover-color: #4338ca !important;
    --link-selected-fg: #4338ca !important;
    /* Surfaces */
    --body-bg: #f8fafc !important;
    --body-fg: #1e293b !important;
    --body-quiet-color: #64748b !important;
    --body-loud-color: #0f172a !important;
    /* Header */
    --header-bg: #ffffff !important;
    --header-color: #0f172a !important;
    --header-branding-color: #0f172a !important;
    --header-link-color: #4f46e5 !important;
    /* Breadcrumbs */
    --breadcrumbs-bg: transparent !important;
    --breadcrumbs-fg: #64748b !important;
    --breadcrumbs-link-fg: #4f46e5 !important;
    /* Buttons */
    --button-bg: #4f46e5 !important;
    --button-fg: #ffffff !important;
    --button-hover-bg: #4338ca !important;
    --default-button-bg: #4f46e5 !important;
    --default-button-hover-bg: #4338ca !important;
    --close-button-bg: #f1f5f9 !important;
    --close-button-hover-bg: #e2e8f0 !important;
    --delete-button-bg: #e11d48 !important;
    --delete-button-hover-bg: #be123c !important;
    /* Tables */
    --darkened-bg: #f8fafc !important;
    --selected-bg: #eef2ff !important;
    --selected-row: #eef2ff !important;
    --border-color: #e2e8f0 !important;
    --hairline-color: #f1f5f9 !important;
    /* Messages */
    --message-success-bg: #f0fdf4 !important;
    --message-warning-bg: #fefce8 !important;
    --message-error-bg: #fef2f2 !important;
    /* Object tools (top-right + Add buttons) */
    --object-tools-bg: #4f46e5 !important;
    --object-tools-fg: #ffffff !important;
    --object-tools-hover-bg: #4338ca !important;
}

/* Re-apply the same values when the OS is in dark mode (defeat Django's dark CSS) */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #4f46e5 !important;
        --secondary: #4338ca !important;
        --link-fg: #4f46e5 !important;
        --link-hover-color: #4338ca !important;
        --body-bg: #f8fafc !important;
        --body-fg: #1e293b !important;
        --body-quiet-color: #64748b !important;
        --body-loud-color: #0f172a !important;
        --header-bg: #ffffff !important;
        --header-color: #0f172a !important;
        --breadcrumbs-bg: transparent !important;
        --breadcrumbs-fg: #64748b !important;
        --breadcrumbs-link-fg: #4f46e5 !important;
        --button-bg: #4f46e5 !important;
        --button-fg: #ffffff !important;
        --button-hover-bg: #4338ca !important;
        --default-button-bg: #4f46e5 !important;
        --default-button-hover-bg: #4338ca !important;
        --close-button-bg: #f1f5f9 !important;
        --close-button-hover-bg: #e2e8f0 !important;
        --delete-button-bg: #e11d48 !important;
        --delete-button-hover-bg: #be123c !important;
        --darkened-bg: #f8fafc !important;
        --selected-bg: #eef2ff !important;
        --border-color: #e2e8f0 !important;
        --hairline-color: #f1f5f9 !important;
        --object-tools-bg: #4f46e5 !important;
        --object-tools-fg: #ffffff !important;
        --object-tools-hover-bg: #4338ca !important;
    }
}

/* ----------- Typography ----------- */
html { font-family: 'Inter', system-ui, -apple-system, sans-serif !important; }
body {
    background: #f8fafc !important;
    color: #1e293b !important;
    font-feature-settings: 'cv02','cv03','cv04','cv11';
    margin: 0 !important;
}
h1, h2, h3, h4 { letter-spacing: -0.015em !important; }

a:link, a:visited { color: #4f46e5 !important; text-decoration: none !important; }
a:hover, a:active { color: #4338ca !important; text-decoration: none !important; }

/* ----------- Top brand bar ----------- */
#header {
    background: #ffffff !important;
    color: #0f172a !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 14px 28px !important;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
}
#branding { padding: 0 !important; }
#branding h1, #branding h1 a {
    margin: 0 !important;
    padding: 0 !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    font-size: 16px !important;
    letter-spacing: -0.025em !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
}
/* Gradient "H" brand mark */
#branding h1::before {
    content: 'H';
    width: 32px; height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    color: white;
    font-weight: 800;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.35);
}

#user-tools {
    color: #475569 !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    padding: 0 !important;
}
#user-tools a {
    color: #475569 !important;
    border: none !important;
    padding: 6px 12px !important;
    border-radius: 8px !important;
    transition: background 0.15s ease !important;
    margin-left: 4px !important;
}
#user-tools a:hover { background: #f1f5f9 !important; color: #0f172a !important; }

/* ----------- Breadcrumbs ----------- */
.breadcrumbs {
    background: transparent !important;
    border-bottom: none !important;
    padding: 16px 28px 4px !important;
    color: #64748b !important;
    font-size: 12px !important;
}
.breadcrumbs a { color: #4f46e5 !important; }

/* ----------- Main content area ----------- */
#main { padding: 0 !important; }
#content {
    padding: 20px 28px 40px !important;
    max-width: 1400px !important;
    margin: 0 auto !important;
}
#content-main { padding: 0 !important; }

/* ----------- Cards / modules ----------- */
.module, fieldset.module, .inline-group {
    background: #ffffff !important;
    border-radius: 16px !important;
    border: none !important;
    box-shadow: 0 0 0 1px rgba(226, 232, 240, 0.7), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    margin-bottom: 20px !important;
    overflow: hidden !important;
}

.module h2, .module caption, .inline-group h2,
fieldset.module h2 {
    background: #ffffff !important;
    color: #0f172a !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    padding: 16px 20px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    text-transform: none !important;
    letter-spacing: -0.01em !important;
}

/* Add nested-form items (StackedInline / TabularInline) ----------- */
.inline-related {
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
}
.inline-related h3 {
    background: #f8fafc !important;
    color: #475569 !important;
    font-size: 12px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    letter-spacing: 0.05em !important;
    padding: 10px 20px !important;
    border-bottom: 1px solid #f1f5f9 !important;
}

/* ----------- Forms ----------- */
.form-row {
    border-bottom: 1px solid #f1f5f9 !important;
    padding: 14px 20px !important;
    background: transparent !important;
}
.form-row:last-of-type { border-bottom: none !important; }

label, .form-row label {
    font-weight: 500 !important;
    color: #475569 !important;
    font-size: 13px !important;
}
.required label::after { content: ' *'; color: #e11d48; }

/* Form inputs */
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="url"], input[type="search"],
input[type="tel"], input[type="date"], input[type="time"],
input[type="datetime-local"], textarea, select {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    font-family: 'Inter', sans-serif !important;
    color: #0f172a !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease !important;
    line-height: 1.4 !important;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="password"]:focus,
input[type="number"]:focus, input[type="url"]:focus, input[type="search"]:focus,
input[type="tel"]:focus, input[type="date"]:focus, input[type="time"]:focus,
input[type="datetime-local"]:focus, textarea:focus, select:focus {
    outline: none !important;
    border-color: #a5b4fc !important;
    box-shadow: 0 0 0 3px rgba(199, 210, 254, 0.5) !important;
}

textarea {
    min-height: 80px !important;
}

/* Vertical-form helper text */
.help, p.help, .form-row .help, .help-tooltip {
    color: #64748b !important;
    font-size: 12px !important;
    margin-top: 4px !important;
}

/* ----------- Buttons ----------- */
.button, input[type="submit"], input[type="button"],
a.button, button:not(.related-widget-wrapper-link) {
    background: #4f46e5 !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 999px !important;
    padding: 8px 18px !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    font-family: 'Inter', sans-serif !important;
    cursor: pointer !important;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2) !important;
    transition: background 0.15s ease, transform 0.05s ease !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    line-height: 1.4 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
}
.button:hover, input[type="submit"]:hover, input[type="button"]:hover,
a.button:hover, button:not(.related-widget-wrapper-link):hover {
    background: #4338ca !important;
}
.button:active, input[type="submit"]:active { transform: translateY(1px) !important; }

.button.default, input[type="submit"].default {
    background: #4f46e5 !important;
    font-weight: 600 !important;
}
.button.default:hover, input[type="submit"].default:hover { background: #4338ca !important; }

/* Delete buttons */
.deletelink, .button.deletelink, a.deletelink, .submit-row .deletelink {
    background: #e11d48 !important;
    color: #ffffff !important;
}
.deletelink:hover, a.deletelink:hover { background: #be123c !important; }

/* Cancel / secondary buttons */
.cancel-link, a.cancel-link {
    background: #f1f5f9 !important;
    color: #334155 !important;
    box-shadow: none !important;
}
.cancel-link:hover { background: #e2e8f0 !important; color: #0f172a !important; }

/* Help button next to fields */
.related-widget-wrapper-link {
    color: #4f46e5 !important;
    background: transparent !important;
    border: none !important;
    padding: 4px !important;
    margin-left: 4px !important;
}

/* ----------- Object tools (Add buttons top-right of changelist) ----------- */
.object-tools { margin: 12px 0 !important; padding: 0 !important; }
.object-tools li { display: inline-block !important; margin-left: 8px !important; }
.object-tools li a, .object-tools a.addlink {
    background: #4f46e5 !important;
    color: #ffffff !important;
    padding: 8px 16px !important;
    border-radius: 999px !important;
    font-weight: 500 !important;
    font-size: 13px !important;
    text-transform: none !important;
    letter-spacing: 0 !important;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2) !important;
    background-image: none !important;
    transition: background 0.15s ease !important;
}
.object-tools li a:hover, .object-tools a.addlink:hover { background: #4338ca !important; }

/* ----------- Tables (changelist results) ----------- */
#result_list, .results table, table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: transparent !important;
    width: 100% !important;
}

#result_list thead th, .results thead th, table thead th {
    background: #f8fafc !important;
    color: #94a3b8 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 12px 16px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}
#result_list thead th a, .results thead th a { color: #475569 !important; }
#result_list thead th a:hover { color: #0f172a !important; }
#result_list thead th.sorted { background: #eef2ff !important; }
#result_list thead th.sorted a { color: #4338ca !important; }

#result_list tbody td, .results tbody td, table tbody td {
    padding: 12px 16px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
    background: #ffffff !important;
    font-size: 13px !important;
    color: #334155 !important;
    vertical-align: middle !important;
}

#result_list tbody tr:hover td,
.results tbody tr:hover td {
    background: #f8fafc !important;
}
#result_list tbody tr:last-child td { border-bottom: none !important; }

/* Kill Django's alternating row colors */
.row1 td, .row2 td { background: #ffffff !important; }
#result_list tbody tr:hover.row1 td,
#result_list tbody tr:hover.row2 td { background: #f8fafc !important; }

/* Selected row */
.selected td { background: #eef2ff !important; }

/* Action checkbox + checkbox cells */
input[type="checkbox"] {
    accent-color: #4f46e5 !important;
    width: 15px !important;
    height: 15px !important;
}

/* ----------- Changelist wrapper ----------- */
#changelist {
    background: transparent !important;
    margin: 0 !important;
}
#changelist .results {
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 0 0 1px rgba(226, 232, 240, 0.7), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    overflow: hidden !important;
    padding: 0 !important;
    border: none !important;
}
#changelist-form {
    background: transparent !important;
}

/* ----------- Toolbar / search ----------- */
#toolbar {
    background: transparent !important;
    padding: 8px 0 12px !important;
    border: none !important;
}
#toolbar form#changelist-search { display: flex !important; gap: 8px !important; align-items: center !important; }
#searchbar {
    border-radius: 12px !important;
    padding: 8px 14px !important;
    border: 1px solid #e2e8f0 !important;
    min-width: 320px !important;
    background: #ffffff !important;
    font-size: 13px !important;
}
#searchbar:focus {
    border-color: #a5b4fc !important;
    box-shadow: 0 0 0 3px rgba(199, 210, 254, 0.5) !important;
}

/* ----------- Bulk actions bar ----------- */
.actions {
    background: #ffffff !important;
    border-radius: 12px !important;
    padding: 10px 16px !important;
    box-shadow: 0 0 0 1px rgba(226, 232, 240, 0.7) !important;
    margin: 0 0 12px !important;
    font-size: 13px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}
.actions .question { color: #475569 !important; }

/* ----------- Pagination ----------- */
.paginator {
    padding: 14px 20px !important;
    background: #ffffff !important;
    color: #64748b !important;
    font-size: 13px !important;
    border-top: 1px solid #f1f5f9 !important;
    border-radius: 0 0 16px 16px !important;
    margin: 0 !important;
}
.paginator a, .paginator .this-page {
    padding: 6px 10px !important;
    border-radius: 8px !important;
    margin: 0 2px !important;
    background: transparent !important;
    border: none !important;
    color: #475569 !important;
    font-weight: 500 !important;
}
.paginator .this-page {
    background: #eef2ff !important;
    color: #4338ca !important;
    font-weight: 600 !important;
}
.paginator a:hover { background: #f1f5f9 !important; }

/* ----------- Filter sidebar ----------- */
#changelist-filter {
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 0 0 1px rgba(226, 232, 240, 0.7), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    border: none !important;
    margin-left: 20px !important;
    padding: 0 !important;
    width: 220px !important;
}
#changelist-filter h2 {
    padding: 14px 18px !important;
    background: #ffffff !important;
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    text-transform: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    letter-spacing: -0.01em !important;
}
#changelist-filter h3 {
    padding: 10px 18px 4px !important;
    color: #94a3b8 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    margin: 0 !important;
    background: transparent !important;
}
#changelist-filter ul {
    padding: 0 10px 10px !important;
    margin: 0 !important;
    list-style: none !important;
    border: none !important;
}
#changelist-filter li {
    padding: 0 !important;
    border: none !important;
    list-style: none !important;
}
#changelist-filter li a {
    display: block !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
    color: #475569 !important;
    text-decoration: none !important;
}
#changelist-filter li a:hover { background: #f1f5f9 !important; color: #0f172a !important; }
#changelist-filter li.selected a {
    background: #eef2ff !important;
    color: #4338ca !important;
    font-weight: 600 !important;
}

/* ----------- Submit row (bottom of change-form) ----------- */
.submit-row {
    background: #ffffff !important;
    border-radius: 16px !important;
    box-shadow: 0 0 0 1px rgba(226, 232, 240, 0.7), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    border: none !important;
    padding: 16px 20px !important;
    margin: 20px 0 0 !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    overflow: visible !important;
}
.submit-row p { margin: 0 !important; padding: 0 !important; }
.submit-row .deletelink-box { margin-right: auto !important; order: -1 !important; }

/* ----------- Messages / alerts ----------- */
.messagelist { padding: 0 !important; margin: 0 0 20px !important; }
.messagelist li {
    border-radius: 12px !important;
    padding: 12px 16px !important;
    font-size: 13px !important;
    box-shadow: none !important;
    margin: 0 0 8px !important;
    border: 1px solid !important;
    background-image: none !important;
}
.messagelist li.success {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border-color: #bbf7d0 !important;
}
.messagelist li.warning {
    background: #fefce8 !important;
    color: #854d0e !important;
    border-color: #fef08a !important;
}
.messagelist li.error {
    background: #fef2f2 !important;
    color: #9f1239 !important;
    border-color: #fca5a5 !important;
}

/* ----------- Error notes ----------- */
.errornote, ul.errorlist {
    background: #fef2f2 !important;
    color: #9f1239 !important;
    border: 1px solid #fca5a5 !important;
    border-radius: 12px !important;
    padding: 10px 14px !important;
    font-size: 13px !important;
    margin: 0 0 10px !important;
    list-style: none !important;
}
ul.errorlist { padding: 8px 14px !important; }
ul.errorlist li { margin: 2px 0 !important; padding: 0 !important; }
.field-error { color: #9f1239 !important; }

/* ----------- Calendar / time picker widgets ----------- */
.calendar caption, .timelist th,
.module.calendar table caption {
    background: #ffffff !important;
    color: #0f172a !important;
    text-transform: none !important;
    font-weight: 600 !important;
}
.calendar td, .calendar th { background: #ffffff !important; color: #334155 !important; }
.calendar td a { color: #475569 !important; }
.calendar td a:hover { background: #eef2ff !important; color: #4f46e5 !important; }
.calendar td.selected a { background: #4f46e5 !important; color: #ffffff !important; }
.calendarnav { background: #f8fafc !important; }
.calendarnav a { color: #4f46e5 !important; }

/* Date/time shortcuts (Today / Now / etc.) */
.datetimeshortcuts a { color: #4f46e5 !important; font-size: 11px !important; }

/* ----------- Selector widget (M2M) ----------- */
.selector {
    border-radius: 12px !important;
    overflow: hidden !important;
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}
.selector h2 {
    background: #f8fafc !important;
    color: #475569 !important;
    font-size: 11px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
    letter-spacing: 0.05em !important;
    padding: 10px 14px !important;
    border-bottom: 1px solid #f1f5f9 !important;
}
.selector select, .selector-filter input {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
}
.selector-add, .selector-remove,
.selector-chooseall, .selector-clearall {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-radius: 8px !important;
    padding: 4px 8px !important;
}

/* ----------- Admin dashboard (the /admin/ index) ----------- */
.dashboard #content .module {
    margin-bottom: 16px !important;
}
.dashboard #content .module table {
    width: 100% !important;
    border: none !important;
}
.dashboard #content .module th, .dashboard #content .module td {
    padding: 12px 20px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    background: #ffffff !important;
}
.dashboard #content .module tr:last-child th,
.dashboard #content .module tr:last-child td {
    border-bottom: none !important;
}
.dashboard .addlink, .dashboard .changelink {
    color: #4f46e5 !important;
    font-weight: 500 !important;
    font-size: 12px !important;
}

/* The "Recent actions" sidebar on /admin/ */
#content-related {
    margin-top: 0 !important;
}
#content-related .module {
    width: auto !important;
}
#recent-actions-module h2 {
    text-transform: none !important;
}

/* ----------- Login page ----------- */
body.login {
    background: linear-gradient(135deg, #eef2ff, #faf5ff, #fdf2f8) !important;
    min-height: 100vh !important;
}
body.login #container {
    background: #ffffff !important;
    border-radius: 20px !important;
    box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08) !important;
    border: 1px solid #f1f5f9 !important;
    padding: 32px !important;
    max-width: 420px !important;
    margin: 80px auto !important;
}
body.login #header {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 0 20px !important;
    justify-content: center !important;
}
body.login #branding h1 { justify-content: center !important; font-size: 18px !important; }
body.login #content { padding: 0 !important; }
body.login .form-row { padding: 10px 0 !important; border: none !important; }
body.login .submit-row {
    background: transparent !important;
    box-shadow: none !important;
    padding: 12px 0 0 !important;
    margin-top: 8px !important;
}
body.login .submit-row input[type="submit"] {
    width: 100% !important;
    padding: 12px !important;
    font-size: 14px !important;
    justify-content: center !important;
}
body.login .password-reset-link { text-align: center !important; margin-top: 16px !important; }
body.login .password-reset-link a { font-size: 12px !important; color: #64748b !important; }

/* ----------- Misc tweaks ----------- */
hr { border-color: #f1f5f9 !important; }
.section { background: transparent !important; }

/* Footer */
#footer { background: transparent !important; padding: 16px 28px !important; color: #94a3b8 !important; font-size: 12px !important; }

/* Hide the default "Welcome,…" greeting separator if present */
#user-tools strong { font-weight: 500 !important; }

/* Read-only fields */
.readonly { color: #64748b !important; font-style: normal !important; }
