@import url('../vendor/inter/inter.css');
@import url('../vendor/playfair-display/playfair-display.css');

:root {
    --bs-body-font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --bs-body-bg: #f4f6fb;

    --bs-primary: #4f46e5;
    --bs-primary-rgb: 79, 70, 229;
    --bs-primary-bg-subtle: #eef2ff;
    --bs-primary-border-subtle: #c7d2fe;
    --bs-primary-text-emphasis: #3730a3;
    --bs-link-color: #4f46e5;
    --bs-link-color-rgb: 79, 70, 229;
    --bs-link-hover-color: #4338ca;
    --bs-link-hover-color-rgb: 67, 56, 202;

    --bs-border-radius: .65rem;
    --bs-border-radius-sm: .5rem;
    --bs-border-radius-lg: .85rem;
    --bs-border-radius-xl: 1.1rem;

    --psalms-sidebar-bg: #0f172a;
    --psalms-sidebar-bg-alt: #1e293b;
    --psalms-sidebar-text: #cbd5e1;
    --psalms-sidebar-text-muted: #64748b;
    --psalms-sidebar-active: #4f46e5;
}

body {
    background: var(--bs-body-bg);
}

.btn-primary {
    --bs-btn-bg: #4f46e5;
    --bs-btn-border-color: #4f46e5;
    --bs-btn-hover-bg: #4338ca;
    --bs-btn-hover-border-color: #4338ca;
    --bs-btn-active-bg: #4338ca;
    --bs-btn-active-border-color: #4338ca;
}

.card {
    border: none;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .05);
}

/* Soft-tinted pill badges: pale background + saturated text, replacing Bootstrap's
   solid bg-*/white-text badges (used throughout attendance status pills already). */
.badge-soft {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-weight: 700;
    font-size: .75rem;
    padding: .35em .75em;
}
.badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-danger { background: #fee2e2; color: #b91c1c; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-info { background: #dbeafe; color: #1d4ed8; }
.badge-soft-secondary { background: #f1f5f9; color: #475569; }
.badge-soft-primary { background: #eef2ff; color: #3730a3; }

/* ---------- App shell / sidebar navigation ---------- */

.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.app-sidebar {
    --bs-offcanvas-width: 260px;
    color: var(--psalms-sidebar-text);
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        flex: 0 0 260px;
        z-index: 1030;
    }
}

/* Background lives on the inner wrapper, not .app-sidebar itself, because
   Bootstrap's responsive .offcanvas-lg rule forces the offcanvas element's
   own background to transparent (!important) at the lg+ breakpoint. */
.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(180deg, rgba(15, 23, 42, .94), rgba(30, 41, 59, .94));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 1rem .85rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .25rem .25rem 1rem;
    color: #fff;
}
.sidebar-brand-card {
    flex: 1 1 auto;
    min-width: 0;
    background: rgba(255, 255, 255, .95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: var(--bs-border-radius-lg);
    padding: .5rem .75rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .6);
}
.sidebar-brand-card img {
    display: block;
    width: 100%;
    height: auto;
}

.sidebar-profile {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .65rem .75rem;
    margin-bottom: 1rem;
    background: var(--psalms-sidebar-bg-alt);
    border-radius: var(--bs-border-radius);
}
.sidebar-profile .avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--psalms-sidebar-active);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: .8rem;
    flex-shrink: 0;
}
.sidebar-profile .profile-name {
    font-weight: 700;
    color: #fff;
    font-size: .87rem;
    line-height: 1.25;
}
.sidebar-profile .profile-role {
    font-size: .7rem;
    color: var(--psalms-sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.sidebar-nav {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: .15rem;
}

.sidebar-group-label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--psalms-sidebar-text-muted);
    font-weight: 700;
    margin: 1rem .6rem .35rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border-radius: var(--bs-border-radius);
    color: var(--psalms-sidebar-text);
    text-decoration: none;
    font-size: .87rem;
    font-weight: 600;
    transition: background .12s ease, color .12s ease;
}
.sidebar-link i {
    width: 18px;
    text-align: center;
    font-size: .82rem;
}
.sidebar-link:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}
.sidebar-link.active {
    background: var(--psalms-sidebar-active);
    color: #fff;
    box-shadow: 0 4px 10px rgba(79, 70, 229, .35);
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, .08);
    padding-top: .75rem;
    margin-top: .75rem;
}
.sidebar-link.sidebar-logout {
    color: #fca5a5;
}
.sidebar-link.sidebar-logout:hover {
    background: rgba(220, 38, 38, .16);
    color: #fecaca;
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-main {
    padding: 1.5rem 0;
}

/* ---------- Dashboard ---------- */

.card-hero-dark {
    background: linear-gradient(135deg, rgba(15, 23, 42, .88), rgba(30, 41, 59, .88));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    border-radius: var(--bs-border-radius-lg);
}

.sections-today-panel {
    background: #fff;
    border-radius: var(--bs-border-radius-lg);
    padding: 14px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
@media (min-width: 992px) {
    .sections-today-panel {
        position: sticky;
        top: 1rem;
    }
}
.sections-today-title {
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    margin-bottom: .75rem;
}
.sections-today-title i {
    color: var(--bs-primary);
}

.section-status-card {
    background: #f8fafc;
    border-radius: var(--bs-border-radius);
    padding: 10px 12px;
    margin-bottom: 8px;
}
.section-status-card:last-child {
    margin-bottom: 0;
}
.section-status-card .section-name {
    font-weight: 700;
    color: #1e293b;
    font-size: .82rem;
    margin-bottom: .4rem;
}
.section-status-card .badge-soft {
    font-size: .68rem;
}
.section-status-card .btn {
    padding: .2rem .5rem;
    font-size: .75rem;
}

.quick-link-tile {
    display: block;
    height: 100%;
    transition: transform .15s ease, box-shadow .15s ease;
}
.quick-link-tile:hover {
    transform: translateY(-2px);
}
.quick-link-tile:hover .card {
    box-shadow: 0 10px 24px rgba(15, 23, 42, .1);
}

.quick-link-card {
    display: flex;
    align-items: center;
    gap: .85rem;
}
.quick-link-card .quick-link-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--bs-border-radius);
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

/* ---------- Login ---------- */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: url('../img/login_bg.png') no-repeat center center;
    background-size: cover;
}

@media (min-width: 992px) {
    .login-page {
        justify-content: flex-end;
        padding-right: 8vw;
    }
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: var(--bs-border-radius-lg);
    padding: 2.25rem 2rem;
    box-shadow: 0 25px 50px rgba(15, 23, 42, .18);
}

.login-logo {
    display: block;
    width: 140px;
    height: auto;
    margin: 0 auto 1rem;
}

.login-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: 2.35rem;
    text-align: center;
    margin-bottom: .35rem;
    color: #0f172a;
}

.login-subtext {
    text-align: center;
    color: #64748b;
    font-size: .9rem;
    margin-bottom: 1.75rem;
}

.login-field-label {
    font-weight: 600;
    font-size: .85rem;
    color: #334155;
    margin-bottom: .35rem;
    display: block;
}

.login-input-wrap {
    position: relative;
}
.login-input-wrap .login-input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: .85rem;
    pointer-events: none;
}
.login-input-wrap .form-control {
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: .7rem 1rem .7rem 2.5rem;
    font-size: .92rem;
}
.login-input-wrap .form-control:focus {
    background: #fff;
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15);
}
.login-input-wrap .password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    background: none;
    border: none;
    font-size: .85rem;
    cursor: pointer;
    padding: .25rem;
}
.login-input-wrap .password-toggle:hover {
    color: #475569;
}

.login-submit-btn {
    border-radius: 999px;
    padding: .7rem 1rem;
    font-weight: 700;
}

.login-forgot-link {
    font-size: .85rem;
    color: #64748b;
    text-decoration: none;
}
.login-forgot-link:hover {
    color: var(--bs-primary);
    text-decoration: underline;
}

/* ---------- Monthly report / SF2 CTA ---------- */

.monthly-cta {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, rgba(79, 70, 229, .08), rgba(79, 70, 229, .03));
    border: 1px solid rgba(79, 70, 229, .18);
    border-radius: var(--bs-border-radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    text-decoration: none;
    transition: box-shadow .15s ease, transform .15s ease;
}
.monthly-cta:hover {
    box-shadow: 0 10px 24px rgba(79, 70, 229, .16);
    transform: translateY(-1px);
}
.monthly-cta-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--bs-border-radius);
    background: var(--bs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.monthly-cta-text {
    flex: 1 1 auto;
    min-width: 0;
}
.monthly-cta-title {
    font-weight: 800;
    color: #1e293b;
    font-size: 1rem;
}
.monthly-cta-subtitle {
    font-size: .82rem;
    color: #64748b;
    margin-top: .1rem;
}
.monthly-cta-status {
    font-size: .78rem;
    color: #64748b;
    margin-top: .35rem;
}
.monthly-cta-status i {
    margin-right: .2rem;
}
.monthly-cta-arrow {
    color: var(--bs-primary);
    font-size: .9rem;
    flex-shrink: 0;
}

/* ---------- Attendance monitoring (summary per class) ---------- */

.summary-stat {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.summary-stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--bs-border-radius);
    background: rgba(255, 255, 255, .12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}
.summary-stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.15;
}
.summary-stat-label {
    font-size: .78rem;
    opacity: .8;
}

.grade-group, .form-section {
    margin-bottom: 1.25rem;
}
.grade-group-header, .form-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
    border-left: 4px solid var(--bs-primary);
    border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0;
    padding: .65rem 1rem;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
}
.grade-group-title, .form-section-title {
    font-weight: 800;
    color: #1e293b;
    font-size: .95rem;
}
.form-section-title i {
    color: var(--bs-primary);
    margin-right: .5rem;
}
.grade-group-count {
    font-size: .78rem;
    color: #64748b;
    font-weight: 600;
}
.grade-group-body, .form-section-body {
    background: #fff;
    border-radius: 0 0 var(--bs-border-radius) var(--bs-border-radius);
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06);
    overflow: hidden;
}
.form-section-body {
    padding: 1.25rem;
}

.form-section-toggle {
    display: flex;
    align-items: center;
    gap: .6rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--bs-border-radius);
    padding: .65rem .85rem;
    height: 100%;
    transition: border-color .12s ease, background .12s ease;
}
.form-section-toggle:has(input:checked) {
    border-color: var(--bs-primary);
    background: var(--bs-primary-bg-subtle);
}
.form-section-toggle i {
    color: var(--bs-primary);
}

.summary-table {
    font-size: .85rem;
    margin-bottom: 0;
}
.summary-table th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    font-weight: 700;
    border-bottom-width: 1px;
}
.summary-table td {
    vertical-align: middle;
}
.summary-section-name {
    font-weight: 700;
    color: #1e293b;
}
.summary-adviser-name {
    font-size: .76rem;
    color: #94a3b8;
}
.summary-enrolled-total {
    font-weight: 700;
    color: #1e293b;
}
.summary-enrolled-sub {
    font-size: .72rem;
    color: #94a3b8;
}
.summary-stat-total {
    font-weight: 800;
    font-size: .95rem;
}
.summary-stat-total.text-success {
    color: #16a34a !important;
}
.summary-stat-total.text-danger {
    color: #dc2626 !important;
}
.summary-stat-sub {
    font-size: .72rem;
    color: #94a3b8;
}

.attendance-bar {
    width: 100%;
    max-width: 130px;
    height: 7px;
    border-radius: 999px;
    background: #fee2e2;
    overflow: hidden;
    margin-bottom: .25rem;
}
.attendance-bar-fill {
    height: 100%;
    background: #16a34a;
}
.attendance-rate-pct {
    font-size: .78rem;
    font-weight: 700;
    color: #1e293b;
}

/* ---------- Section picker (empty-state grid) ---------- */

.section-picker-stats {
    background: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    border-radius: var(--bs-border-radius);
    padding: .65rem 1rem;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.section-picker-stats i {
    margin-right: .4rem;
}

/* ---------- Month badge / switcher ---------- */

.month-badge {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    background: #0f172a;
    color: #fff;
    border-radius: 14px;
    padding: 10px 28px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, .25);
}
.month-badge .month-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    color: #94a3b8;
    text-transform: uppercase;
}
.month-badge .month-value {
    font-size: 28px;
    font-weight: 900;
    line-height: 1.15;
    white-space: nowrap;
}

.month-switcher {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
}
.month-switcher-arrow {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #0f172a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    text-decoration: none;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .25);
    transition: transform .12s ease, background .12s ease;
}
.month-switcher-arrow:hover {
    background: var(--psalms-sidebar-active);
    color: #fff;
    transform: scale(1.07);
}

/* ---------- User avatar (manage_users.php) ---------- */

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .72rem;
    flex-shrink: 0;
}

/* ---------- Footer ---------- */

.app-footer {
    text-align: center;
    color: #94a3b8;
    font-size: .78rem;
    padding: 1.5rem 1rem 1rem;
}

.app-footer-standalone {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    padding: .75rem 1rem;
    background: rgba(255, 255, 255, .7);
    backdrop-filter: blur(4px);
}
