/* ═══════════════════════════════════════════════════════════════
   style.css — Global base styles shared across all pages
   (index, dashboard, admin). Page-specific rules live in their
   own files: index.css, dashboard.css, admin.css
   ═══════════════════════════════════════════════════════════════ */

/* ── Custom font ── */
@font-face {
    font-family: 'Resagokr';
    src: url('../fonts/ResagokrBold.otf') format('opentype');
}

/* ── Design tokens ─────────────────────────────────────────────
   All colors, radii and shadows live here. Edit this block to
   retheme the entire application in one place.
   ────────────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --brand: #f97316;
    /* primary orange */
    --brand-dark: #c2410c;
    /* darker orange for hover states */

    /* Backgrounds */
    --dark-bg: #0f172a;
    /* page background */
    --card-bg: #1e293b;
    /* card / panel background */

    /* Borders & text */
    --border: #334155;
    --muted: #94a3b8;
    /* secondary / placeholder text */
    --text: #e2e8f0;
    /* primary body text */
    --text-bright: #f1f5f9;
    /* headings and high-emphasis text */

    /* Accent palette */
    --purple: #a78bfa;
    --purple-dark: #8b5cf6;
    --blue: #60a5fa;
    --green: #34d399;
    --green-dark: #22c55e;
    --amber: #fcd34d;
    --red: #f87171;
    --fire: #ff5a3d;

    /* Shared radii */
    --radius-sm: .4rem;
    --radius-md: .5rem;
    --radius-lg: 1rem;
    --radius-pill: 2rem;

    /* Shadows */
    --shadow-card: 0 8px 32px rgba(0, 0, 0, .3);
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ── Base body ─────────────────────────────────────────────────
   Applies to dashboard and admin. index.css overrides display/
   align to center the login card vertically.
   ────────────────────────────────────────────────────────────── */
body {
    margin: 0;
    min-height: 100vh;
    background: var(--dark-bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Ambient gradient mesh background — consistent across all pages */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    /* Each page file can override these gradient stops if needed */
    background:
        radial-gradient(ellipse 55% 35% at 10% 90%, rgba(249, 115, 22, .12) 0%, transparent 60%),
        radial-gradient(ellipse 40% 30% at 90% 10%, rgba(249, 115, 22, .08) 0%, transparent 55%);
}

/* ── Sticky navbar ─────────────────────────────────────────────
   Shared by dashboard and admin. Not used on index (login page).
   ────────────────────────────────────────────────────────────── */
.app-navbar {
    background: rgba(15, 23, 42, .95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: .75rem 0;
}

.app-navbar .brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-bright);
    text-decoration: none;
}

.brand-dot {
    width: 32px;
    height: 32px;
}

/* Pill badges used in navbar */
.user-badge {
    background: rgba(249, 115, 22, .15);
    border: 1px solid rgba(249, 115, 22, .3);
    color: var(--brand);
    border-radius: var(--radius-pill);
    padding: .25rem .75rem;
    font-size: .8rem;
    font-weight: 600;
}

.admin-link,
.shifts-btn {
    color: var(--purple);
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    border: 1px solid rgba(167, 139, 250, .3);
    border-radius: var(--radius-pill);
    padding: .25rem .75rem;
    background: rgba(167, 139, 250, .1);
    transition: background .15s;
}

.admin-link:hover,
.shifts-btn:hover {
    background: rgba(167, 139, 250, .2);
    color: #c4b5fd;
}

/* Active-users counter chip */
.active-users-counter {
    background: rgba(16, 185, 129, .15);
    border: 1px solid rgba(16, 185, 129, .3);
    border-radius: var(--radius-pill);
    padding: .25rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-size: .8rem;
    font-weight: 600;
    color: var(--green);
}

/* Pulsing green online indicator — used in counter and tables */
.active-dot {
    width: 8px;
    height: 8px;
    background-color: var(--green);
    border-radius: 50%;
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 5px rgba(52, 211, 153, .6);
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

/* Active-users hover tooltip */
.active-users-wrapper {
    position: relative;
}

.active-users-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: .6rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
    z-index: 200;
    padding: .4rem 0;
}

.active-users-wrapper:hover .active-users-tooltip {
    display: block;
}

/* Tooltip arrow */
.active-users-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 14px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid var(--border);
}

.active-tooltip-header {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b;
    padding: .3rem .85rem .2rem;
}

.active-tooltip-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .3rem .85rem;
    font-size: .82rem;
    color: var(--text);
}

/* Static dot inside tooltip (no pulse needed at this size) */
.active-tooltip-item .active-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    box-shadow: 0 0 5px #22c55e;
    flex-shrink: 0;
    animation: none;
}

.active-tooltip-empty {
    padding: .4rem .85rem;
    font-size: .8rem;
    color: #64748b;
    font-style: italic;
}

#activeTooltipList {
    display: flex;
    flex-direction: column;
    flex-wrap: wrap;
    max-height: 500px;
}

/* ── Page layout wrapper ── */
.main-wrap {
    max-width: 960px;
    /* narrowed to 820px in admin.css */
    margin: 0 auto;
    padding: 2rem 1rem 0;
    position: relative;
    z-index: 1;
}

/* ── Section cards ── */
.section-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.75rem;
    box-shadow: var(--shadow-card);
}

.card-header-custom {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .6rem;
}

.card-header-custom h2 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-bright);
}

.card-header-custom .subtitle {
    font-size: .78rem;
    color: var(--muted);
    margin: 0;
}

.card-body-custom {
    padding: 1.5rem;
}

/* Coloured icon badge used in card headers */
.icon-badge {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.icon-badge.orange {
    background: rgba(249, 115, 22, .2);
    color: var(--brand);
}

.icon-badge.blue {
    background: rgba(59, 130, 246, .2);
    color: var(--blue);
}

.icon-badge.amber {
    background: rgba(245, 158, 11, .2);
    color: var(--amber);
}

.icon-badge.green {
    background: rgba(34, 197, 94, .2);
    color: var(--green-dark);
}

.icon-badge.purple {
    background: rgba(167, 139, 250, .2);
    color: var(--purple);
}

.icon-badge.white {
    background: rgba(186, 186, 186, .2);
    color: var(--muted);
}

/* ── Forms ─────────────────────────────────────────────────────
   Shared input, select and label styling.
   ────────────────────────────────────────────────────────────── */
.form-label {
    color: #cbd5e1;
    font-size: .82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: .35rem;
    display: block;
}

.form-label .req {
    color: var(--brand);
}

.form-control,
.form-select {
    background: var(--dark-bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius-md);
    padding: .6rem .9rem;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}

.form-control:focus,
.form-select:focus {
    background: var(--dark-bg);
    border-color: var(--brand);
    color: var(--text);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .18);
    outline: none;
}

.form-control::placeholder {
    color: #475569;
}

.form-control.is-invalid {
    border-color: var(--red);
    background-image: none;
}

/* Date/time picker icon tint to match dark theme */
.form-control[type="datetime-local"]::-webkit-calendar-picker-indicator,
.form-control[type="date"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(.6);
    cursor: pointer;
}

/* Checkbox */
.form-check {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
    padding-left: 0;
}

.form-check-input {
    width: 1.2rem;
    height: 1.2rem;
    margin-top: 0;
    cursor: pointer;
    background-color: var(--dark-bg);
    border: 2px solid var(--border);
    transition: all .2s ease;
    flex-shrink: 0;
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-check-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, .18);
}

.form-check-input:hover {
    border-color: var(--brand);
    transform: scale(1.05);
}

.form-check-input:active {
    transform: scale(.95);
}

.form-check-label {
    color: var(--text);
    font-size: .85rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.form-check-label i {
    font-size: 1rem;
    opacity: .7;
    transition: opacity .2s ease;
}

.form-check-input:checked+.form-check-label i {
    opacity: 1;
    color: var(--brand);
}

/* ── Buttons ── */

/* Primary brand button */
.btn-submit,
.btn-brand {
    background: var(--brand);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: .7rem 1.5rem;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    transition: background .15s, transform .1s;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.btn-submit:hover,
.btn-brand:hover {
    background: var(--brand-dark);
}

.btn-submit:active,
.btn-brand:active {
    transform: scale(.98);
}

/* Secondary blue edit button */
.btn-edit {
    background: rgba(59, 130, 246, .15);
    color: var(--blue);
    border: 1px solid rgba(59, 130, 246, .35);
    border-radius: var(--radius-md);
    padding: .7rem 1.5rem;
    font-weight: 700;
    font-size: .95rem;
    cursor: pointer;
    transition: background .15s, transform .1s;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.btn-edit:hover {
    background: rgba(59, 130, 246, .25);
}

.btn-edit:active {
    transform: scale(.98);
}

/* Danger / delete button */
.btn-delete {
    background: rgba(239, 68, 68, .1);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, .25);
    border-radius: var(--radius-sm);
    padding: .3rem .7rem;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    transition: background .15s;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, .2);
}

/* Bootstrap .btn override — prevents white-on-black hover flash */
.btn:hover {
    color: black !important;
    border-color: black !important;
}

/* ── Flash / alert banners ── */
.flash-success,
.flash-info,
.flash-danger,
.alert-danger {
    border-radius: var(--radius-md);
    padding: .75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: .9rem;
}

.flash-success {
    background: rgba(16, 185, 129, .15);
    border: 1px solid rgba(16, 185, 129, .35);
    color: #6ee7b7;
}

.flash-info {
    background: rgba(59, 130, 246, .15);
    border: 1px solid rgba(59, 130, 246, .35);
    color: var(--blue);
    transition: opacity .5s ease;
}

.flash-danger,
.alert-danger {
    background: rgba(239, 68, 68, .15);
    border: 1px solid rgba(239, 68, 68, .35);
    color: #fca5a5;
}

/* ── Divider ── */
.field-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

/* ── Loading overlay ─────────────────────────────────────────── */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(249, 115, 22, .3);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: .05em;
}

.loading-subtext {
    color: var(--muted);
    font-size: .85rem;
}

/* Disable inputs while loading */
form.loading input,
form.loading select,
form.loading textarea,
form.loading button {
    opacity: .6;
    pointer-events: none;
}

/* ── Footer logo ── */
.footer-logo img {
    height: 2rem;
    filter: brightness(0) invert(1);
}

/* ── Responsive base ── */
@media (max-width: 576px) {
    .card-body-custom {
        padding: 1rem;
    }

    .main-wrap {
        padding: 1rem .75rem 0;
    }
}