/* ============================================================
   Time Log Monitoring — Authentication UI
   Refined Bootstrap 5 theme with Light (default) & Dark modes
   ============================================================ */

:root {
    /* Brand palette (shared) */
    --hp-primary: #2563eb;
    --hp-primary-dark: #1d4ed8;
    --hp-accent: #22d3ee;
    --hp-radius: 16px;

    /* ---- LIGHT THEME (default) ---- */
    --hp-page-bg: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    --hp-page-solid: #eef2f7;
    --hp-card-bg: #ffffff;
    --hp-text: #0f172a;
    --hp-muted: #64748b;
    --hp-border: #e2e8f0;
    --hp-input-bg: #f8fafc;
    --hp-addon-bg: #f1f5f9;
    --hp-focus-ring: rgba(37, 99, 235, 0.12);
    --hp-card-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
    --hp-stat-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --hp-topbar-bg: rgba(255, 255, 255, 0.85);
    --hp-toggle-bg: #ffffff;
    --hp-toggle-border: #e2e8f0;

    /* ---- Aside / accent gradients (light theme) ---- */
    --hp-aside-bg: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 100%);
    --hp-aside-text: #0f172a;
    --hp-aside-sub: #475569;
    --hp-aside-footer: #64748b;
    --hp-aside-feature: #334155;
    --hp-aside-badge-bg: rgba(15, 23, 42, 0.10);
    --hp-aside-badge-color: #2563eb;
    --hp-mark-bg: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    --hp-mark-text: #0f172a;
    --hp-accent-btn-bg: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    --hp-accent-btn-text: #0f172a;
    --hp-accent-btn-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] {
    /* ---- DARK THEME ---- */
    --hp-page-bg: linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
    --hp-page-solid: #0b1220;
    --hp-card-bg: #0f1a2f;
    --hp-text: #e2e8f0;
    --hp-muted: #94a3b8;
    --hp-border: #24344d;
    --hp-input-bg: #16213a;
    --hp-addon-bg: #16213a;
    --hp-focus-ring: rgba(37, 99, 235, 0.25);
    --hp-card-shadow: 0 24px 60px rgba(2, 6, 23, 0.55);
    --hp-stat-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
    --hp-topbar-bg: rgba(15, 23, 42, 0.72);
    --hp-toggle-bg: #16213a;
    --hp-toggle-border: #24344d;

    /* ---- Aside / accent gradients (dark theme) ---- */
    --hp-aside-bg: linear-gradient(135deg, #0b1220 0%, #111c33 60%, #0a1a3c 100%);
    --hp-aside-text: #fff;
    --hp-aside-sub: #c7d2e4;
    --hp-aside-footer: #94a3b8;
    --hp-aside-feature: #e2e8f0;
    --hp-aside-badge-bg: rgba(37, 99, 235, 0.25);
    --hp-aside-badge-color: #22d3ee;
    --hp-mark-bg: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    --hp-mark-text: #fff;
    --hp-accent-btn-bg: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
    --hp-accent-btn-text: #fff;
    --hp-accent-btn-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}

* { -webkit-font-smoothing: antialiased; }

body.auth-body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--hp-page-bg);
    color: var(--hp-text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ---------- Layout ---------- */
.auth-wrapper {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
}
.auth-body--plain { background: var(--hp-page-solid); }

/* ---------- Floating theme toggle ---------- */
.theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 1050;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid var(--hp-toggle-border);
    background: var(--hp-toggle-bg);
    color: var(--hp-text);
    font-size: 1.15rem;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    transition: transform 0.15s ease, background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.theme-toggle:hover { transform: translateY(-2px); }
.theme-toggle:active { transform: translateY(0); }
/* Show the icon for the theme you'd switch TO */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: inline-block; }

/* ---------- Branded aside panel (blue gradient, both themes) ---------- */
.auth-aside {
    position: relative;
    overflow: hidden;
    padding: 4rem;
    color: var(--hp-aside-text);
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--hp-aside-bg);
}
.auth-aside__overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at 30% 20%, black, transparent 75%);
    pointer-events: none;
}
.auth-aside__content { position: relative; z-index: 1; max-width: 30rem; }
.auth-aside__headline {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.15;
    margin: 2.2rem 0 1rem;
    letter-spacing: -0.5px;
}
.auth-aside__sub {
    color: var(--hp-aside-sub);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 2.2rem;
}
.auth-aside__footer {
    position: absolute;
    left: 4rem;
    bottom: 2rem;
    color: var(--hp-aside-footer);
    font-size: 0.85rem;
    z-index: 1;
}

.auth-feature li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 1rem;
    color: var(--hp-aside-feature);
}
.auth-feature i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--hp-aside-badge-bg);
    color: var(--hp-aside-badge-color);
    font-size: 1.1rem;
}

/* ---------- Brand ---------- */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.3px;
}
.brand--center { justify-content: center; }
.brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--hp-mark-bg);
    color: var(--hp-mark-text);
    font-size: 1.3rem;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
    flex-shrink: 0;
}
.brand__name { color: var(--hp-mark-text); }
.brand--center .brand__name { color: var(--hp-text); }
.text-accent { color: var(--hp-accent) !important; }

/* Constrained logo mark (replaces the Bootstrap icon) */
.brand__logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

/* ---------- Form panel ---------- */
.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background: var(--hp-page-bg);
    transition: background 0.3s ease;
}
.auth-card {
    width: 100%;
    max-width: 27rem;
    background: var(--hp-card-bg);
    border: 1px solid var(--hp-border);
    color: var(--hp-text);
    border-radius: var(--hp-radius);
    padding: 2.5rem;
    box-shadow: var(--hp-card-shadow);
    animation: rise 0.5s ease both;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.auth-card__title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--hp-text);
    margin-bottom: 0.35rem;
}
.auth-card__subtitle { color: var(--hp-muted); margin-bottom: 1.75rem; }
.auth-card__footnote { font-size: 0.9rem; color: var(--hp-muted); }

/* ---------- Inputs ---------- */
.form-label { font-weight: 600; font-size: 0.9rem; color: var(--hp-text); }
.input-group-text {
    background: var(--hp-addon-bg);
    border: 1px solid var(--hp-border);
    border-right: none;
    color: var(--hp-muted);
    border-radius: 10px 0 0 10px;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.form-control {
    background: var(--hp-input-bg);
    color: var(--hp-text);
    border: 1px solid var(--hp-border);
    border-left: none;
    padding: 0.7rem 0.9rem;
    border-radius: 0 10px 10px 0;
    transition: box-shadow 0.2s, border-color 0.2s, background 0.3s ease, color 0.3s ease;
}
.form-control::placeholder { color: var(--hp-muted); opacity: 0.8; }
/* Read-only fields (e.g. auto-stamped attendance date/time) look inert. */
.form-control[readonly] {
    background: var(--hp-addon-bg);
    color: var(--hp-muted);
    cursor: not-allowed;
}
.form-control[readonly]:focus {
    border-color: var(--hp-border);
    box-shadow: none;
}
.form-control:focus {
    background: var(--hp-input-bg);
    color: var(--hp-text);
    border-color: var(--hp-primary);
    box-shadow: 0 0 0 4px var(--hp-focus-ring);
}
.input-group:focus-within .input-group-text { border-color: var(--hp-primary); }
.input-group .btn-outline-secondary {
    background: var(--hp-addon-bg);
    border: 1px solid var(--hp-border);
    border-left: none;
    border-radius: 0 10px 10px 0;
    color: var(--hp-muted);
}
.input-group .btn-outline-secondary:hover { background: var(--hp-addon-bg); color: var(--hp-text); }

/* ---------- Accent button ---------- */
.btn-accent {
    background: var(--hp-accent-btn-bg);
    color: var(--hp-accent-btn-text);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 0.7rem 1rem;
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
    box-shadow: var(--hp-accent-btn-shadow);
}
.btn-accent:hover { filter: brightness(1.05); transform: translateY(-1px); color: #fff; }
.btn-accent:active { transform: translateY(0); }
.btn-accent:disabled { opacity: 0.7; }

/* ---------- Links ---------- */
.link-small { font-size: 0.85rem; color: var(--hp-muted); text-decoration: none; }
.link-small:hover { color: var(--hp-primary); }
.link-accent { color: var(--hp-primary); font-weight: 600; text-decoration: none; }
.link-accent:hover { text-decoration: underline; }

/* ---------- Dashboard ---------- */
.topbar {
    background: var(--hp-topbar-bg);
    border-bottom: 1px solid var(--hp-border);
    backdrop-filter: blur(8px);
    transition: background 0.3s ease, border-color 0.3s ease;
}
.topbar .brand__name { color: var(--hp-text); }
.topbar .btn-outline-light {
    color: var(--hp-text);
    border-color: var(--hp-border);
}
.topbar .btn-outline-light:hover {
    background: var(--hp-primary);
    border-color: var(--hp-primary);
    color: #fff;
}
.text-muted-2 { color: var(--hp-muted); }
.dash-hero .dash-avatar {
    width: 84px; height: 84px; margin-inline: auto;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 2.4rem; color: #fff;
    background: linear-gradient(135deg, var(--hp-primary), var(--hp-accent));
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.4);
}
.dash-hero h2 { color: var(--hp-text); font-weight: 700; }

/* ---------- Record card (User Record page) ---------- */
.record-card {
    background: var(--hp-card-bg);
    border: 1px solid var(--hp-border);
    color: var(--hp-text);
    border-radius: var(--hp-radius);
    padding: 2.25rem;
    box-shadow: var(--hp-card-shadow);
    animation: rise 0.5s ease both;
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.record-card__header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.75rem;
}
.record-card__icon {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 1.6rem;
    color: #fff;
    background: linear-gradient(135deg, var(--hp-primary), var(--hp-accent));
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.35);
}
.record-card__title { font-size: 1.5rem; font-weight: 700; color: var(--hp-text); }
.record-card__subtitle { color: var(--hp-muted); font-size: 0.95rem; }
.record-section-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hp-muted);
    font-weight: 700;
    margin-bottom: 1rem;
}
.record-divider {
    border: none;
    border-top: 1px solid var(--hp-border);
    margin: 1.75rem 0;
}
/* Selects adopt the same input-group treatment as text inputs. */
.input-group .form-select {
    background: var(--hp-input-bg);
    color: var(--hp-text);
    border: 1px solid var(--hp-border);
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 0.7rem 0.9rem;
}
.input-group .form-select:focus {
    border-color: var(--hp-primary);
    box-shadow: 0 0 0 4px var(--hp-focus-ring);
}

.stat-card {
    background: var(--hp-card-bg);
    border: 1px solid var(--hp-border);
    color: var(--hp-text);
    border-radius: 14px; padding: 1.25rem;
    box-shadow: var(--hp-stat-shadow);
    transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.stat-card__icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; margin-bottom: 0.75rem; color: #fff;
}
.stat-card__icon--blue  { background: var(--hp-primary); }
.stat-card__icon--green { background: #16a34a; }
.stat-card__icon--amber { background: #d97706; }
.stat-card__value { font-size: 1.4rem; font-weight: 700; margin: 0; }

/* ---------- App shell (dashboard) ---------- */
.app-shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    align-items: stretch;
}

/* Sidebar */
.app-sidebar {
    width: 264px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--hp-card-bg);
    border-right: 1px solid var(--hp-border);
    transition: width 0.25s ease, transform 0.25s ease, background 0.3s ease, border-color 0.3s ease;
    z-index: 1045;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.25rem;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.3px;
    min-height: 72px;
    border-bottom: 1px solid var(--hp-border);
}
.sidebar-brand .brand__name { color: var(--hp-text); white-space: nowrap; }

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.85rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.sidebar-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--hp-muted);
    font-weight: 700;
    padding: 0 0.75rem;
    margin-bottom: 0.35rem;
}
.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    color: var(--hp-muted);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease;
}
.nav-link-custom i { font-size: 1.2rem; flex-shrink: 0; }
.nav-link-custom:hover {
    background: var(--hp-input-bg);
    color: var(--hp-text);
}
.nav-link-custom.active {
    background: linear-gradient(135deg, var(--hp-primary), var(--hp-primary-dark));
    color: #fff;
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.35);
}

.sidebar-foot {
    padding: 1rem 0.75rem;
    border-top: 1px solid var(--hp-border);
}
.btn-sidebar-logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--hp-border);
    background: transparent;
    color: var(--hp-muted);
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-sidebar-logout i { font-size: 1.2rem; flex-shrink: 0; }
.btn-sidebar-logout:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: rgba(220, 38, 38, 0.4);
    color: #dc2626;
}

/* Sidebar user (fullname shown above the sign-out button) */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--hp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border-bottom: 1px solid var(--hp-border);
}
.sidebar-user i {
    color: var(--hp-muted);
    font-size: 1.1rem;
    flex-shrink: 0;
}
.app-shell.is-collapsed .sidebar-user { display: none; }

/* Main column */
.app-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
}
.app-topbar {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-height: 72px;
    padding: 0 1.5rem;
    background: var(--hp-topbar-bg);
    border-bottom: 1px solid var(--hp-border);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 1030;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.app-topbar__title { font-weight: 700; font-size: 1.1rem; color: var(--hp-text); }
.app-topbar__user { color: var(--hp-muted); font-weight: 600; font-size: 0.95rem; }
.sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid var(--hp-border);
    background: var(--hp-toggle-bg);
    color: var(--hp-text);
    font-size: 1.35rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.sidebar-toggle:hover { background: var(--hp-primary); border-color: var(--hp-primary); color: #fff; }
.app-content { flex: 1 1 auto; padding: 2.5rem 1.5rem; }

/* Backdrop (mobile) */
.app-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 1040;
}
.app-shell.is-open .app-backdrop { opacity: 1; visibility: visible; }

/* Collapsed (desktop rail) */
.app-shell.is-collapsed .app-sidebar { width: 78px; }
.app-shell.is-collapsed .sidebar-label,
.app-shell.is-collapsed .sidebar-heading { display: none; }
.app-shell.is-collapsed .sidebar-brand { justify-content: center; }
.app-shell.is-collapsed .nav-link-custom,
.app-shell.is-collapsed .btn-sidebar-logout { justify-content: center; }

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .auth-wrapper { grid-template-columns: 1fr; }
    .auth-main { min-height: 100vh; }
    .auth-card { padding: 2rem 1.5rem; box-shadow: none; }
    .theme-toggle { top: 0.9rem; right: 0.9rem; width: 42px; height: 42px; }

    /* App shell: off-canvas sidebar */
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
        box-shadow: var(--hp-card-shadow);
    }
    .app-shell.is-open .app-sidebar { transform: translateX(0); }
    .app-shell.is-collapsed .app-sidebar { width: 264px; }
    .app-shell.is-collapsed .sidebar-label,
    .app-shell.is-collapsed .sidebar-heading { display: block; }
    .app-shell.is-collapsed .sidebar-brand { justify-content: flex-start; }
    .app-shell.is-collapsed .nav-link-custom,
    .app-shell.is-collapsed .btn-sidebar-logout { justify-content: flex-start; }
    .app-content { padding: 1.75rem 1rem; }
}


/* ============================================================
   Floating toast notifications (top-right)
   Rendered from Django messages in base.html so every page
   shows success / error / info feedback without inline alerts.
   ============================================================ */
.hp-toast-container {
    z-index: 1080;
    width: auto;
    max-width: min(92vw, 380px);
}
.hp-toast {
    border: 1px solid var(--hp-border);
    border-radius: 12px;
    box-shadow: var(--hp-card-shadow);
    background: var(--hp-card-bg);
    color: var(--hp-text);
    margin-bottom: 0.65rem;
    overflow: hidden;
    /* Left accent bar tinted by message type. */
    border-left-width: 4px;
}
.hp-toast .toast-body {
    padding: 0.75rem 0.85rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.35;
}
.hp-toast__icon { font-size: 1.05rem; line-height: 1.2; margin-top: 0.05rem; }
.hp-toast__close {
    margin-top: 0.1rem;
    filter: none;
}
[data-theme="light"] .hp-toast__close { filter: invert(0.55) grayscale(100%); }
[data-theme="dark"]  .hp-toast__close { filter: invert(0.9) grayscale(100%); }

/* Message-type accents */
.hp-toast--success { border-left-color: #16a34a; }
.hp-toast--success .hp-toast__icon { color: #16a34a; }
.hp-toast--error   { border-left-color: #dc2626; }
.hp-toast--error   .hp-toast__icon { color: #dc2626; }
.hp-toast--warning { border-left-color: #d97706; }
.hp-toast--warning .hp-toast__icon { color: #d97706; }
.hp-toast--info    { border-left-color: var(--hp-primary); }
.hp-toast--info    .hp-toast__icon { color: var(--hp-primary); }

[data-theme="dark"] .hp-toast--success .hp-toast__icon { color: #4ade80; }
[data-theme="dark"] .hp-toast--error   .hp-toast__icon { color: #f87171; }
[data-theme="dark"] .hp-toast--warning .hp-toast__icon { color: #fbbf24; }
