/* =====================================================================
   YCAMS - Application styles (Bootstrap 5.3 augmentation)
   Light/Dark aware via [data-bs-theme]
   ===================================================================== */

:root {
    --ycams-sidebar-width: 250px;
    --ycams-primary: #1d5b9b;
    --ycams-primary-dark: #14446f;
    --ycams-sidebar-bg: #14446f;
    --ycams-sidebar-active: rgba(255, 255, 255, .14);
}

body {
    background-color: var(--bs-body-bg);
    min-height: 100vh;
}

/* ---------------------------------------------------------------------
   Layout: sidebar + main column
--------------------------------------------------------------------- */
.app-wrapper { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--ycams-sidebar-width);
    background: linear-gradient(180deg, var(--ycams-primary) 0%, var(--ycams-sidebar-bg) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

/* Bootstrap offcanvas keeps its own background on mobile */
.app-sidebar.offcanvas-lg {
    --bs-offcanvas-width: var(--ycams-sidebar-width);
    --bs-offcanvas-bg: var(--ycams-sidebar-bg);
    --bs-offcanvas-color: #fff;
}

.sidebar-brand {
    min-height: 64px;
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .16);
    color: #fff;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.brand-mark-lg {
    width: 64px;
    height: 64px;
    font-size: 2rem;
    background: var(--ycams-primary);
    border-radius: 16px;
}

.sidebar-nav { display: flex; flex-direction: column; padding: .5rem .75rem; gap: 2px; }

.nav-item-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
    padding: .55rem .75rem;
    border-radius: .5rem;
    font-size: .925rem;
    transition: background .15s, color .15s;
}

.nav-item-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; }
.nav-item-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item-link.active { background: var(--ycams-sidebar-active); color: #fff; font-weight: 600; }

.sidebar-footer { border-top: 1px solid rgba(255, 255, 255, .12); }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
    min-height: 64px;
    background: var(--bs-body-bg);
    border-bottom: 1px solid var(--bs-border-color);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-content { flex: 1; }

.btn-icon {
    border: 0;
    background: transparent;
    color: var(--bs-body-color);
    padding: .35rem .55rem;
    border-radius: .5rem;
}
.btn-icon:hover { background: var(--bs-tertiary-bg); }

.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: .6rem;
}

/* ---------------------------------------------------------------------
   Cards & stats
--------------------------------------------------------------------- */
.stat-card { transition: transform .12s ease; }
.stat-card:hover { transform: translateY(-2px); }

.stat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: var(--bs-tertiary-bg);
    color: var(--ycams-primary);
}

/* ---------------------------------------------------------------------
   Guest (login) pages
--------------------------------------------------------------------- */
.guest-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eaf2fa 0%, #d6e6f5 100%);
    padding: 1.5rem;
}

[data-bs-theme="dark"] .guest-body {
    background: linear-gradient(135deg, #10141a 0%, #16202c 100%);
}

.guest-container { width: 100%; max-width: 420px; }
.guest-card { border: 0; border-radius: 1rem; }

/* ---------------------------------------------------------------------
   Attendance taking (mobile-first)
--------------------------------------------------------------------- */
.attendance-list .btn-group .btn { padding: .35rem .5rem; }

.attendance-actions {
    position: sticky;
    bottom: 0;
    background: var(--bs-body-bg);
    padding: .75rem 0;
    border-top: 1px solid var(--bs-border-color);
    z-index: 5;
}

@media (max-width: 575.98px) {
    .att-group { width: 100%; }
    .att-group .btn { flex: 1; }
}

/* ---------------------------------------------------------------------
   Live monitor
--------------------------------------------------------------------- */
.live-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #dc3545;
    animation: livePulse 1.6s infinite;
}

@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(220, 53, 69, .5); }
    70%  { box-shadow: 0 0 0 7px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}

/* ---------------------------------------------------------------------
   Tables & DataTables tweaks
--------------------------------------------------------------------- */
.table > :not(caption) > * > * { padding-top: .65rem; padding-bottom: .65rem; }

div.dataTables_wrapper div.dataTables_filter input { margin-left: .4rem; }
div.dataTables_wrapper .row:first-child { margin-bottom: .5rem; }

/* ---------------------------------------------------------------------
   Super admin center browser chips
--------------------------------------------------------------------- */
.center-browser {
    background:
        radial-gradient(1200px 220px at -10% -60%, rgba(29, 91, 155, .18), transparent 60%),
        linear-gradient(180deg, rgba(255, 255, 255, .95) 0%, rgba(245, 248, 252, .95) 100%);
}

[data-bs-theme="dark"] .center-browser {
    background:
        radial-gradient(1200px 220px at -10% -60%, rgba(138, 188, 239, .14), transparent 60%),
        linear-gradient(180deg, rgba(29, 37, 49, .95) 0%, rgba(22, 28, 38, .95) 100%);
}

.center-chip-grid {
    display: grid;
    gap: .65rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.center-chip {
    --chip-bg: #44556a;
    --chip-bg-strong: #364657;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border: 0;
    border-radius: 999px;
    padding: .72rem 1rem;
    color: #fff;
    font-weight: 700;
    line-height: 1.2;
    background: linear-gradient(135deg, var(--chip-bg) 0%, var(--chip-bg-strong) 100%);
    box-shadow: 0 8px 16px rgba(0, 0, 0, .14);
    transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
    text-align: start;
}

.center-chip:hover {
    transform: translateY(-1px);
    filter: saturate(1.05);
    box-shadow: 0 10px 18px rgba(0, 0, 0, .18);
}

.center-chip:focus-visible {
    outline: 3px solid rgba(255, 255, 255, .65);
    outline-offset: 1px;
}

.center-chip i {
    font-size: 1.1rem;
    opacity: .95;
}

.center-chip-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-inline-end: .75rem;
}

.center-chip.is-active {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .72), 0 12px 22px rgba(0, 0, 0, .2);
}

.center-chip-leadership { --chip-bg: #e85a00; --chip-bg-strong: #cf4e00; }
.center-chip-sports     { --chip-bg: #48aac2; --chip-bg-strong: #3299b2; }
.center-chip-media      { --chip-bg: #caa100; --chip-bg-strong: #b48e00; }
.center-chip-science    { --chip-bg: #119447; --chip-bg-strong: #0b813b; }
.center-chip-arts       { --chip-bg: #b30874; --chip-bg-strong: #980262; }

@media (max-width: 575.98px) {
    .center-chip-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------
   Misc
--------------------------------------------------------------------- */
.app-footer { border-top: 1px solid var(--bs-border-color); }

@media print {
    .app-sidebar, .app-topbar, .app-footer, .attendance-actions, .btn { display: none !important; }
    .app-content { padding: 0 !important; }
}
