/* ---------------- Animations ---------------- */
.fade-in {
    animation: fadeIn ease 5s;
    -webkit-animation: fadeIn ease 5s;
    -moz-animation: fadeIn ease 5s;
    -o-animation: fadeIn ease 5s;
    -ms-animation: fadeIn ease 5s;
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@-moz-keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@-webkit-keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@-o-keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@-ms-keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

/* ---------------- Base ---------------- */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--app-bg);
    color: var(--app-text);
    line-height: 1.6;
}

.app-main {
    background: radial-gradient(1200px 600px at 12% -10%, rgba(125,211,252,.28), transparent 60%), radial-gradient(1000px 520px at 88% -6%, rgba(167,139,250,.22), transparent 62%), radial-gradient(900px 520px at 50% 100%, rgba(253,186,116,.18), transparent 60%), radial-gradient(820px 420px at 18% 110%, rgba(152,216,170,.16), transparent 58%), linear-gradient(180deg, #ffffff, #fbfbff 35%, #f8fbff 70%, #ffffff);
}

header {
    color: var(--app-text);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* ---------------- Nav ---------------- */
nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.5rem;
}

nav a {
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background-color 0.3s ease, color .2s ease;
    color: var(--app-text);
}

    nav a:hover {
        background-color: var(--app-surface-2);
        color: var(--app-text);
    }

/* Fixed top navbar */
.navbar {
    background: var(--app-surface-1) !important;
    height: 56px;
    width: 100%;
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    box-shadow: 0 3px 6px rgba(0,0,0,0.2);
    z-index: 1000;
    justify-content: center;
    align-content: center;
}

/* AdminLTE sidebar wrapper  theme-aware */
.sidebar-wrapper {
    background: var(--app-surface-2);
    color: var(--app-text);
}

/* Sidebar links (keep it simple & readable) */
.nav-link {
    color: var(--app-text-muted) !important;
    padding: 5px !important;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--app-text) !important;
    background-color: var(--app-surface-2) !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}


/* Sometimes list items get hover bg from AdminLTE */
.navbar-nav li:hover {
    background-color: var(--app-surface-2) !important;
}

/* Links that previously forced black */
.text-decoration-none {
    color: var(--app-text);
}

/* ---------------- Sections / Cards ---------------- */
.section {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

select, input {
    border: 1px solid lightgrey;
}

/* Narrow tile: fixed 380px */
.section-item-narrow {
    background: var(--app-surface-1);
    border: 3px solid var(--app-border);
    border-radius: 16px;
    padding: 16px 40px;
    position: relative;
    transition: transform .2s, box-shadow .2s;
    width: 380px; /* explicit width */
    flex: 0 0 380px; /* don't grow/shrink; basis 380 */
    height: 378px;
}

/* Wide tile: prefers 775px but can grow */
.section-item-wide {
    background: var(--app-surface-1);
    border: 3px solid var(--app-border);
    border-radius: 16px;
    padding: 16px 40px;
    position: relative;
    transition: transform .2s, box-shadow .2s;
    width: 775px; /* preferred width */
    flex: 1 1 775px; /* can grow/shrink around 775 */
    min-width: 600px; /* dont squish too small on wide rows */
    height: 378px;
}

/* Relax min-width on medium screens */
@media (max-width: 1200px) {
    .section-item-wide {
        min-width: 0;
    }
}

/* Stack on small screens */
@media (max-width: 992px) {
    .section-item-narrow,
    .section-item-wide {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        height: auto;
    }
}


.section-item-narrow {
    width: 380px;
}

.section-item-wide {
    width: 775px;
}

.section-item-narrow:hover,
.section-item-wide:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Drag handle + dots */
/*.drag-handle {
    position: absolute;
    left: 8px;
    top: 24px;
    transform: translateY(-50%);
    width: 33px;
    height: 33px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    padding: 4px;
}

    .drag-handle:active {
        cursor: grabbing;
    }

.dot {
    display: block;
    width: 4px;
    height: 4px;
    background: lightgrey;*/
/*    background: var(--app-text-muted);*/
    /*border-radius: 50%;
    margin: 2px 0;
}*/

.drag-handle {
    position: absolute;
    left: 8px;
    top: 24px;
    transform: translateY(-50%);
    width: 33px;
    height: 33px;
    display: flex;
    flex-direction: column !important; /* vertical */
    justify-content: center;
    align-items: center;
    gap: 4px; /* even spacing between dots */
    cursor: grab;
    padding: 4px;
    z-index: 1;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Scope .dot to the handle so nothing else is affected */
.drag-handle .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--bs-border-color, lightgrey) !important; /* match border */
    display: block;
}

.section-item.sortable-ghost {
    opacity: 0.5;
    background: var(--app-surface-2);
}

.section-item.sortable-chosen {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: scale(1.02);
}

.card {
    border: 3px solid var(--light-border);
}

/* ---------------- Auth boxes ---------------- */
.login,
.register {
    max-width: 360px;
    width: 100%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-content: center;
    justify-content: center;
    background: var(--app-surface-1);
    border: 3px solid var(--app-border);
    border-radius: 20px;
    margin: 120px auto;
    text-align: center;
}

.login {
    height: 360px;
}

.register {
    height: 420px;
}

.main-heading {
    text-align: center;
}

.container {
    padding: 90px 0 70px 0;
    max-width: 1600px;
}

/* ---------------- Buttons ---------------- */
/*.btn {
    display: inline-block;
    padding: 10px 20px;
    color: var(--app-on-primary, #fff);
    text-decoration: none;
    border-radius: 5px;
    background-color: var(--app-primary);
}*/

.btn-round {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background-color: var(--app-accent, #28a745); /* fallback if not defined */
    font-size: 14px;
    color: #fff;
    text-decoration: none;
    padding: 5px;
    margin: 0 auto;
}

    .btn-round:hover {
        /* a neutral hover that works in all themes */
        filter: brightness(0.95);
    }

/* Submit button style */
.btn-submit {
    align-items: center;
    appearance: none;
    background-color: var(--app-surface-1);
    border-radius: 4px;
    border: 0;
    box-shadow: rgba(45,35,66,0.4) 0 2px 4px, rgba(45,35,66,0.3) 0 7px 13px -3px, var(--app-border) 0 -3px 0 inset;
    box-sizing: border-box;
    color: var(--app-text);
    cursor: pointer;
    display: inline-flex;
    height: 48px;
    justify-content: center;
    line-height: 1;
    overflow: hidden;
    padding: 0 16px;
    position: relative;
    text-align: left;
    text-decoration: none;
    transition: box-shadow .15s, transform .15s;
    user-select: none;
    white-space: nowrap;
    font-size: 18px;
}

    .btn-submit:focus {
        box-shadow: var(--app-border) 0 0 0 1.5px inset, rgba(45,35,66,0.4) 0 2px 4px, rgba(45,35,66,0.3) 0 7px 13px -3px, var(--app-border) 0 -3px 0 inset;
    }

    .btn-submit:hover {
        box-shadow: rgba(45,35,66,0.4) 0 4px 8px, rgba(45,35,66,0.3) 0 7px 13px -3px, var(--app-border) 0 -3px 0 inset;
        transform: translateY(-2px);
    }

/* === THEME + LAYOUT HOTFIX (append at end) =============================== */
:root,
[data-theme="light"] {
    --app-bg: #f5f7fa;
    --app-text: #111111;
    --app-surface-1: #ffffff;
    --app-surface-2: #f8f9fa;
}

[data-theme="dark"] {
    --app-bg: #0f1115;
    --app-text: #e9edf1;
    --app-surface-1: #131722;
    --app-surface-2: #0d1018;
}

[data-theme="calm"] {
    --app-bg: #0e1116;
    --app-text: #e7edf6;
    --app-surface-1: #131a22;
    --app-surface-2: #0f141b;
}

/* Base */
body {
    background: var(--app-bg);
    color: var(--app-text);
}

/* Header / Navbar */
.app-header.navbar,
.navbar {
    background: var(--app-surface-1) !important;
    color: var(--app-text) !important;
}

    .navbar .nav-link,
    .navbar .nav-link i {
        color: var(--app-text) !important;
    }

/* Sidebar */
.app-sidebar,
.sidebar-wrapper {
    background: var(--app-surface-2) !important;
    color: var(--app-text) !important;
}

    .app-sidebar .nav-link {
        color: var(--app-text) !important;
    }

        .app-sidebar .nav-link:hover {
            background: color-mix(in srgb, var(--app-text) 12%, transparent);
            color: #fff !important;
        }

/* ---------------- Footer ---------------- */
.app-footer {
    z-index: 10000;
    background: var(--app-surface-1) !important;
    color: var(--app-text) !important;
    border-top: 1px solid color-mix(in srgb, var(--app-text) 15%, transparent);
    height: 60px;
    margin: 0;
    padding: 0;
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100% !important;
    text-align: center !important;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
}

/* Dashboard layout */
.section {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-start;
}

.section-item-narrow,
.section-item-wide {
    flex: 0 0 auto;
}

/* === PATCH 01: nav hover (light), primary buttons, input borders ========== */

/* Tokens we need */
:root,
[data-theme="light"] {
    --app-primary: #0d6efd;
    --app-primary-hover: #0b5ed7;
    --app-border: #dee2e6;
    --app-input-bg: #ffffff;
    --app-input-text: #212529;
    --app-hover-light: rgba(0,0,0,.06);
}

[data-theme="dark"] {
    --app-primary: #4ca3ff;
    --app-primary-hover: #3b8eea;
    --app-border: #2b2f3a;
    --app-input-bg: #0f1115;
    --app-input-text: #e9edf1;
    --app-hover-dark: rgba(255,255,255,.08);
}

[data-theme="calm"] {
    --app-primary: #7bb3ff;
    --app-primary-hover: #6aa6ff;
    --app-border: #2b3340;
    --app-input-bg: #0f141b;
    --app-input-text: #e7edf6;
    --app-hover-dark: rgba(255,255,255,.08);
}

/* 1) Sidebar hover  LIGHT should not flicker or vanish */
[data-theme="light"] .app-sidebar .nav-link:hover,
[data-theme="light"] .app-sidebar .nav-link:focus {
    background-color: var(--app-hover-light) !important;
    color: #111 !important;
}

/* Sidebar hover  DARK & CALM */
[data-theme="dark"] .app-sidebar .nav-link:hover,
[data-theme="dark"] .app-sidebar .nav-link:focus,
[data-theme="calm"] .app-sidebar .nav-link:hover,
[data-theme="calm"] .app-sidebar .nav-link:focus {
    background-color: var(--app-hover-dark) !important;
    color: #fff !important;
}

/* Active item (all themes) */
.app-sidebar .nav-link.active {
    background-color: var(--app-primary) !important;
    color: #fff !important;
}

    .app-sidebar .nav-link.active i {
        color: #fff !important;
    }

/* 2) Buttons  force .btn-primary to be a filled button, not outline */
.btn-primary {
    background-color: var(--app-primary) !important;
    border-color: var(--app-primary) !important;
    color: #fff !important;
}

    .btn-primary:hover,
    .btn-primary:focus,
    .btn-primary:active {
        background-color: var(--app-primary-hover) !important;
        border-color: var(--app-primary-hover) !important;
        color: #fff !important;
    }

/* Base button focus ring + border */
.btn {
    border-color: var(--app-border) !important;
}

    .btn:focus {
        box-shadow: 0 0 0 .25rem rgba(13,110,253,.25);
    }

[data-theme="dark"] .btn:focus,
[data-theme="calm"] .btn:focus {
    box-shadow: 0 0 0 .25rem rgba(76,163,255,.22);
}

/* 3) Inputs  show borders in light mode, solid focus ring */
.form-control,
.form-select,
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    background-color: var(--app-input-bg) !important;
    color: var(--app-input-text) !important;
    border: 1px solid var(--app-border) !important;
}

    .form-control::placeholder {
        color: color-mix(in srgb, var(--app-text) 45%, transparent);
    }

    .form-control:focus,
    .form-select:focus,
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    textarea:focus {
        border-color: var(--app-primary) !important;
        outline: 0 !important;
        box-shadow: 0 0 0 .25rem rgba(13,110,253,.25) !important;
    }

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus,
[data-theme="calm"] .form-control:focus,
[data-theme="calm"] .form-select:focus {
    box-shadow: 0 0 0 .25rem rgba(76,163,255,.22) !important;
}

/* Top nav hover (independent from sidebar rules) */
.app-header.navbar .nav-link:hover,
.app-header.navbar .nav-link:focus {
    background: var(--app-surface-2) !important;
    color: var(--app-text) !important;
}

/* === PATCH: Circular gauges (size + no black fill) ======================= */
.circular-gauge,
.circular-gauge-attendance {
    position: relative;
    width: 150px;
    height: 150px;
}

    .circular-gauge .gauge-svg,
    .circular-gauge-attendance .gauge-svg {
        width: 100%;
        height: 100%;
        display: block;
        transform: rotate(-90deg); /* 12 o'clock start */
    }

        /* Kill any global icon fills inside our gauges, and lock stroke width */
        .circular-gauge .gauge-svg *,
        .circular-gauge-attendance .gauge-svg * {
            fill: none !important;
            vector-effect: non-scaling-stroke;
        }

    /* Track + progress rings */
    .circular-gauge .gauge-track,
    .circular-gauge-attendance .gauge-track {
        stroke: var(--app-border) !important;
        stroke-width: 8;
        opacity: .6;
    }

    .circular-gauge .gauge-progress,
    .circular-gauge-attendance .gauge-progress {
        stroke: var(--app-primary) !important;
        stroke-width: 8;
        stroke-linecap: round;
        transition: stroke-dashoffset .4s ease;
    }

    /* Center value label */
    .circular-gauge .gauge-value,
    .circular-gauge-attendance .gauge-value {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 1.6rem;
        font-weight: 700;
        color: var(--app-text);
    }

.gauge-svg {
    width: 150px;
    height: 150px;
    transform: rotate(-90deg);
}

.gauge-track {
    fill: none;
    stroke-width: 8;
    stroke: color-mix(in srgb, var(--app-text) 15%, transparent);
}

.gauge-progress {
    fill: none;
    stroke-width: 8;
    stroke: var(--app-primary);
    stroke-linecap: butt; /* avoids tiny seam at 100% */
    transition: stroke-dashoffset .35s ease;
}

.gauge-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    color: var(--app-text);
}

.circular-gauge, .circular-gauge-attendance {
    position: relative;
    width: 150px;
    height: 150px;
}

.skip-link {
    background: none!important;
}

.lift {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}