/* ================================
   Design System - Absensi Ekstrakurikuler
   Terinspirasi tema teal/card modern
   ================================ */

:root {
    --primary: #0f4c3a;
    --primary-light: #1a6b52;
    --primary-soft: #e8f3ef;
    --bg-page: #f5f6f8;
    --card-radius: 16px;
    --shadow-soft: 0 2px 12px rgba(0, 0, 0, 0.06);
    --text-muted: #8a94a6;
}

body {
    background-color: var(--bg-page);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: #1c2733;
}

/* ===== Top Navbar ===== */
.topnav {
    background: #fff;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
}

.topnav .brand {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.topnav .user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-chip .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* ===== Greeting Header ===== */
.greeting-header {
    background: var(--primary);
    color: #fff;
    border-radius: var(--card-radius);
    padding: 28px 32px;
    margin-bottom: 24px;
}

.greeting-header .greeting-sub {
    opacity: 0.75;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.greeting-header h3 {
    font-weight: 700;
    margin: 0;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 20px;
    box-shadow: var(--shadow-soft);
    height: 100%;
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    font-size: 1.1rem;
}

.stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===== Content Card (tabel, form, dsb) ===== */
.content-card {
    background: #fff;
    border-radius: var(--card-radius);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    margin-bottom: 24px;
}

.content-card .card-title {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 18px;
}

/* ===== Tabel ===== */
.table-clean {
    border-collapse: separate;
    border-spacing: 0;
}

.table-clean thead th {
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    border-bottom: 1px solid #eef0f3;
    padding: 10px 12px;
}

.table-clean tbody td {
    padding: 14px 12px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.table-clean tbody tr:last-child td {
    border-bottom: none;
}

/* ===== Badge Pill ===== */
.badge-pill {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--primary-soft);
    color: var(--primary);
}

/* ===== Tab Jenjang (MTs/MA) ===== */
.jenjang-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.jenjang-tabs a {
    flex: 1;
    text-align: center;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    background: #fff;
    color: var(--primary);
    border: 1px solid #e2e5ea;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.jenjang-tabs a:hover {
    background: var(--primary-soft);
    border-color: var(--primary-soft);
}

.jenjang-tabs a.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== Buttons ===== */
.btn-primary-theme {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
}

.btn-primary-theme:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: #fff;
}

.btn-outline-theme {
    border: 1px solid #e2e5ea;
    color: #4a5568;
    border-radius: 10px;
    background: #fff;
}

.btn-outline-theme:hover {
    background: #f7f8fa;
}

/* ===== Form Control ===== */
.form-control, .form-select {
    border-radius: 10px;
    border: 1px solid #e2e5ea;
    padding: 10px 14px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(15, 76, 58, 0.1);
}

/* ===== Logo Aplikasi ===== */
.brand-logo {
    height: 32px;
    width: 32px;
    border-radius: 8px;
    object-fit: cover;
    vertical-align: middle;
}

.login-brand .brand-logo {
    height: 48px;
    width: 48px;
    border-radius: 12px;
}

.sidebar-brand .brand-logo {
    height: 30px;
    width: 30px;
    border-radius: 8px;
}

/* ===== Photo Gallery - Item Wrapper & Download Button ===== */
.photo-item {
    position: relative;
    display: inline-block;
}

.photo-item img {
    display: block;
    cursor: pointer;
    transition: transform 0.15s;
}

.photo-item img:hover {
    transform: scale(1.03);
}

.photo-download-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(15, 76, 58, 0.85);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.photo-download-btn:hover {
    background: var(--primary);
    color: #fff;
}

/* ===== Lightbox ===== */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

.lightbox-overlay.show {
    display: flex;
}

.lightbox-overlay img {
    max-width: 100%;
    max-height: 85vh;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.3rem;
    cursor: pointer;
}

.lightbox-download {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== Ikon (Bootstrap Icons) ===== */
.stat-icon i,
.brand i {
    font-size: 1.1rem;
    line-height: 1;
}

.btn-primary-theme i,
.btn-outline-theme i {
    font-size: 0.9rem;
    margin-right: 4px;
}

/* ================================
   RESPONSIVE - MOBILE (max-width 768px)
   ================================ */
@media (max-width: 768px) {

    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Top navbar lebih ringkas */
    .topnav {
        padding: 12px 16px;
        margin-bottom: 16px;
    }

    .topnav .brand span.brand-text {
        display: none; /* sembunyikan teks brand, sisakan ikon saja */
    }

    .user-chip > div:not(.avatar) {
        display: none; /* sembunyikan nama & role, sisakan avatar + logout */
    }

    .user-chip .avatar {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    /* Greeting header lebih ringkas */
    .greeting-header {
        padding: 20px;
        border-radius: 12px;
        margin-bottom: 16px;
    }

    .greeting-header h3 {
        font-size: 1.2rem;
    }

    /* Stat card lebih rapat */
    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-icon {
        width: 34px;
        height: 34px;
        margin-bottom: 10px;
    }

    .stat-card .stat-value {
        font-size: 1.25rem;
    }

    .stat-card .stat-label {
        font-size: 0.75rem;
    }

    .content-card {
        padding: 16px;
        border-radius: 12px;
    }

    /* Filter form full-width & stack vertikal */
    .content-card form.row > div {
        margin-bottom: 6px;
    }

    /* ===== Tabel jadi Card di Mobile ===== */
    .table-clean thead {
        display: none;
    }

    .table-clean, .table-clean tbody, .table-clean tr, .table-clean td {
        display: block;
        width: 100%;
    }

    .table-clean tbody tr {
        border: 1px solid #eef0f3;
        border-radius: 12px;
        margin-bottom: 12px;
        padding: 12px;
    }

    .table-clean tbody td {
        border-bottom: none;
        padding: 6px 0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
    }

    .table-clean tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: var(--text-muted);
        text-transform: uppercase;
        flex-shrink: 0;
    }

    .table-clean tbody td:last-child {
        justify-content: flex-end;
        padding-top: 10px;
    }

    .table-clean tbody td:last-child::before {
        content: '';
    }

    .login-card {
        margin: 16px;
        padding: 28px 20px !important;
    }
}

/* ===== Login Page ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-page);
}

.login-card {
    background: #fff;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-soft);
    padding: 36px;
    width: 100%;
    max-width: 380px;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
}

.login-brand i {
    font-size: 1.6rem;
    color: var(--primary);
}

.login-brand span {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

/* ===== Photo Gallery (Detail) ===== */
.photo-gallery img {
    width: 130px;
    height: 130px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid #eef0f3;
    cursor: pointer;
    transition: transform 0.15s;
}

.photo-gallery img:hover {
    transform: scale(1.03);
}

.info-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}

.info-row:last-child {
    border-bottom: none;
}

.info-row .info-label {
    width: 150px;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.info-row .info-value {
    font-weight: 500;
}

@media (max-width: 768px) {
    .info-row {
        flex-direction: column;
        gap: 2px;
    }
    .info-row .info-label {
        width: auto;
    }
    .photo-gallery img {
        width: 100px;
        height: 100px;
    }
}

/* ================================
   SIDEBAR LAYOUT
   ================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: #fff;
    border-right: 1px solid #eef0f3;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--primary);
    padding: 8px 12px 20px 12px;
    font-size: 1rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-page);
    border-radius: 12px;
    margin-bottom: 16px;
}

.sidebar-user .name {
    font-weight: 600;
    font-size: 0.85rem;
}

.sidebar-user .role {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
}

.sidebar-link i {
    font-size: 1rem;
    width: 18px;
    text-align: center;
}

.sidebar-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.sidebar-link.active {
    background: var(--primary);
    color: #fff;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    color: #c0392b;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    border-top: 1px solid #eef0f3;
    margin-top: 12px;
    padding-top: 18px;
}

.app-main {
    flex: 1;
    margin-left: 240px;
    min-height: 100vh;
    padding: 28px;
}

.mobile-topbar {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.18);
    }

    .app-main {
        margin-left: 0;
        padding: 16px;
    }

    .mobile-topbar {
        display: flex;
        align-items: center;
        gap: 14px;
        background: #fff;
        padding: 14px 16px;
        box-shadow: var(--shadow-soft);
        border-radius: 12px;
        margin-bottom: 16px;
    }

    .mobile-topbar .btn-hamburger {
        background: none;
        border: none;
        font-size: 1.3rem;
        color: var(--primary);
        padding: 0;
        line-height: 1;
    }

    .mobile-topbar .mobile-brand {
        font-weight: 700;
        color: var(--primary);
        font-size: 0.95rem;
    }

    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 999;
    }
}

/* ================================
   MODE PEMBINA - teks & tombol diperbesar
   supaya lebih mudah dipakai pembina yang
   sudah tua / belum terbiasa pakai HP-web
   ================================ */
body.guru-view {
    font-size: 17px;
}

body.guru-view .topnav .brand {
    font-size: 1.25rem;
}

body.guru-view .greeting-header .greeting-sub {
    font-size: 1rem;
}

body.guru-view .greeting-header h3 {
    font-size: 1.6rem;
}

body.guru-view .content-card .card-title {
    font-size: 1.2rem;
}

body.guru-view .form-label {
    font-size: 1.05rem;
    font-weight: 600;
}

body.guru-view .form-control,
body.guru-view .form-select {
    font-size: 1.05rem;
    padding: 12px 14px;
    min-height: 48px;
}

body.guru-view .form-text {
    font-size: 0.92rem;
}

body.guru-view .btn {
    font-size: 1.02rem;
    min-height: 46px;
    padding-top: 10px;
    padding-bottom: 10px;
}

body.guru-view .btn-sm {
    font-size: 0.95rem;
    min-height: 42px;
    padding: 9px 14px;
}

body.guru-view .btn i {
    font-size: 1rem;
}

body.guru-view .table-clean tbody td {
    font-size: 0.98rem;
}

body.guru-view .table-clean tbody td::before {
    font-size: 0.8rem;
}

body.guru-view .alert {
    font-size: 1.02rem;
    padding: 14px 16px;
}

body.guru-view .topnav {
    flex-wrap: wrap;
    row-gap: 8px;
}

body.guru-view .user-chip {
    flex-wrap: wrap;
    row-gap: 6px;
}

body.guru-view .aksi-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

body.guru-view .aksi-cell form {
    display: contents;
}

@media (max-width: 768px) {
    body.guru-view .aksi-cell {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
    }

    body.guru-view .aksi-cell .btn {
        width: 100%;
    }
}

/* Tombol untuk lihat/sembunyikan isi password */
body.guru-view .password-wrapper {
    position: relative;
}

body.guru-view .password-wrapper input {
    padding-right: 46px;
}

body.guru-view .btn-toggle-password {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.15rem;
    padding: 8px 10px;
}