/* Smooth & modern visual refresh for index.php */
:root {
    --accent: #06b6d4;
    /* teal */
    --accent-2: #60a5fa;
    /* soft blue */
    --accent-3: #f59e0b;
    /* warm amber (dzuhur) */
    --muted: #64748b;
    /* muted text */
    --bg-1: #f8fafc;
    /* page background */
    --bg-2: #f1f5f9;
    /* subtle secondary */
    --card-shadow: 0 8px 30px rgba(2, 6, 23, 0.06);
    --glass: rgba(255, 255, 255, 0.6);
    --radius: 12px;
    --transition: 240ms cubic-bezier(.2, .9, .3, 1);
}

* {
    box-sizing: border-box
}

html,
body {
    height: 100%
}

body {
    margin: 0;
    font-family: Inter, 'Segoe UI', Roboto, system-ui, -apple-system, 'Helvetica Neue', Arial;
    color: #0f172a;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(180deg, var(--bg-1), var(--bg-2));
}

.container {
    max-width: 1200px;
    margin: 28px auto;
    padding: 20px
}

/* Header / Hero */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: calc(var(--radius) - 2px);
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.12), rgba(96, 165, 250, 0.08));
    backdrop-filter: blur(6px);
    color: #062c3a;
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition), transform var(--transition);
}

header:hover {
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.06);
    transform: translateY(-1px)
}

header h1 {
    margin: 0;
    font-size: 16px;
    letter-spacing: 0.2px
}

header .subtitle {
    font-size: 12px;
    color: var(--muted)
}

/* Mode indicator */
.mode-indicator {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.mode-indicator.regular {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.12), rgba(96, 165, 250, 0.05));
    color: #055160;
    border: 1px solid rgba(6, 182, 212, 0.18);
    box-shadow: 0 6px 22px rgba(6, 182, 212, 0.06)
}

.mode-indicator.dzuhur {
    background: linear-gradient(90deg, #fff7ed, #fef3c7);
    color: #92400e;
    border: 1px solid rgba(245, 158, 11, 0.14);
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.06);
    animation: ms-pulse 3s ease-in-out infinite
}

@keyframes ms-pulse {

    0%,
    100% {
        transform: scale(1)
    }

    50% {
        transform: scale(1.02);
        opacity: 0.95
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    padding: 8px 14px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition)
}

.btn:hover {
    transform: translateY(-2px)
}

.btn.primary {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 10px 30px rgba(6, 182, 212, 0.14)
}

.btn.ghost {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(6, 182, 212, 0.12)
}

.btn.secondary {
    background: #fff;
    color: #0f172a;
    box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06)
}

/* Top navigation small buttons */
.nav-btn {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 10px;
    color: var(--accent);
    background: transparent;
    border: 1px solid transparent;
    transition: all var(--transition);
    font-weight: 600;
    text-decoration: none
}

.nav-btn:hover {
    background: linear-gradient(90deg, rgba(6, 182, 212, 0.06), rgba(96, 165, 250, 0.04));
    border-color: rgba(6, 182, 212, 0.08)
}

/* Last 10 list styling */
#last10 {
    padding: 4px 6px 4px 6px;
    margin: 6px 0 0 0;
    list-style: none;
    max-height: 354px;
    /* 10 rows x 30px + 9 gaps x 6px = 354px */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

#last10 li {
    height: 30px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-radius: 6px;
    background: #ffffff;
    margin-bottom: 6px;
    border: 1px solid rgba(15, 85, 140, 0.08);
    font-size: 13px;
    line-height: 1;
    color: #05293d;
}

/* Alternating blue / white rows for better readability */
#last10 li:nth-child(odd) {
    background: linear-gradient(180deg, #e6f4ff, #ffffff);
}

#last10 li:nth-child(even) {
    background: #ffffff;
}

#last10 li small {
    color: var(--muted);
    font-size: 12px
}

/* Attendance modal table */
.attendance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.attendance-table thead th {
    background: #f1f7fb;
    padding: 8px;
    text-align: left;
    font-weight: 600;
    color: #053a5a;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.attendance-table tbody tr {
    border-bottom: 1px solid rgba(2, 6, 23, 0.04);
}

.attendance-table tbody tr.status-hadir {
    background: linear-gradient(180deg, #ecfdf5, #ffffff);
}

/* green */
.attendance-table tbody tr.status-izin {
    background: linear-gradient(180deg, #fff7ed, #ffffff);
}

/* yellow */
.attendance-table tbody tr.status-alpha {
    background: linear-gradient(180deg, #fff1f2, #ffffff);
}

/* red */
.attendance-table tbody td {
    padding: 8px;
}


/* Layout */
.layout {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 20px;
    margin-top: 20px
}

.content,
.form-panel {
    background: linear-gradient(180deg, #ffffff, rgba(255, 255, 255, 0.98));
    padding: 20px;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition)
}

/* Summary title */
.content h2 {
    margin-top: 0;
    font-size: 18px;
    color: #05293d;
    transition: font-size var(--transition), color var(--transition);
}

/* When header has dzuhur mode, make the summary heading slightly smaller to fit the longer label */
header.dzuhur+.layout .content h2 {
    font-size: 15px;
    /* reduced size for sholat summary */
    color: var(--accent-3);
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* Form inputs */
label {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 13px
}

input[type=text],
textarea,
select {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e6eef9;
    background: #fbfdff;
    outline: none;
    font-size: 15px;
    transition: box-shadow .18s, border-color .18s
}

input[type=text]:focus,
textarea:focus,
select:focus {
    box-shadow: 0 12px 30px rgba(6, 182, 212, 0.08);
    border-color: var(--accent)
}

.form-panel .btn {
    width: 100%;
    padding: 12px;
    border-radius: 12px
}

/* Jenjang / Kelas cards */
.jenjang-row {
    margin-bottom: 6px
}

.jenjang-row h3 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #0f172a
}

.kelas-list {
    --gap: 12px;
    --cols: 6;
    display: grid;
    gap: var(--gap);
    align-items: start;
    /* force single logical row by creating columns sized to fit container / cols */
    grid-auto-flow: column;
    grid-auto-columns: minmax(80px, calc((100% - ((var(--cols) - 1) * var(--gap))) / var(--cols)));
    overflow-x: auto;
    /* allow horizontal scroll only if min width prevents fitting */
}

/* keep horizontal scroll on very small screens */
@media (max-width: 520px) {
    .kelas-list {
        grid-auto-flow: column;
        grid-auto-columns: 120px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

.kelas-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), var(--glass));
    border-radius: 12px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 8px 22px rgba(2, 6, 23, 0.06);
    border: 1px solid rgba(6, 182, 212, 0.06);
    width: 100%;
    min-width: 100px;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition)
}

.kelas-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 40px rgba(2, 6, 23, 0.08);
    border-color: rgba(6, 182, 212, 0.12)
}

.kelas-card canvas {
    width: 80%;
    max-width: 56px;
    min-width: 28px;
    aspect-ratio: 1 / 1;
    height: auto;
    display: block;
    margin: 0 auto 8px auto;
}

.kelas-card .chart-kelas {
    max-width: 56px;
}

.kelas-info {
    margin-top: 6px;
    text-align: center;
    font-size: 12px;
    line-height: 1.1;
    color: #0f172a
}

.kelas-info strong {
    display: block
}

.kelas-count {
    color: #475569;
    font-size: 13px;
    margin-top: 4px;
}

.kelas-percent {
    color: #6b7280;
    font-size: 12px;
    margin-top: 4px;
    font-style: italic;
}


/* Login modal */
.login-centered {
    display: flex;
    align-items: center;
    justify-content: center
}

.login-grid {
    display: flex;
    gap: 18px;
    align-items: flex-start
}

.role-card {
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    border-radius: 12px;
    padding: 14px;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    border: 1px solid #eef6ff;
    transition: transform var(--transition), box-shadow var(--transition)
}

.role-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.06)
}

.role-card.active {
    border-color: var(--accent);
    box-shadow: 0 18px 40px rgba(6, 182, 212, 0.08)
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, rgba(2, 6, 23, 0.5), rgba(2, 6, 23, 0.6));
    align-items: center;
    justify-content: center;
    padding: 20px
}

.modal[aria-hidden="false"] {
    display: flex
}

.modal-content {
    background: linear-gradient(180deg, #ffffff, #fcfdff);
    padding: 22px;
    border-radius: 16px;
    max-width: 760px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.14)
}

/* Tables */
.absensi-table,
table {
    width: 100%;
    border-collapse: collapse
}

.absensi-table thead th,
table thead th {
    background: #f8fbff;
    padding: 12px;
    text-align: left;
    font-weight: 700;
    color: #05293d
}

.absensi-table tbody td,
table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9
}

.table-row-even {
    background: transparent
}

/* Scrollbar small aesthetic */
.kelas-list::-webkit-scrollbar {
    height: 8px
}

.kelas-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(6, 182, 212, 0.12), rgba(96, 165, 250, 0.08));
    border-radius: 8px
}

/* Responsive */
@media(max-width:900px) {
    .layout {
        grid-template-columns: 1fr
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px
    }

    .kelas-list {
        grid-auto-columns: 160px
    }
}

/* small helpers */
.text-muted {
    color: var(--muted)
}

/* toolbar date (replaces Batch mode control) */
.toolbar-date {
    font-size: 14px;
    color: var(--muted);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.toolbar-date-icon svg {
    width: 14px;
    height: 14px;
    color: var(--accent);
    opacity: 0.95;
}

.toolbar-date-text {
    font-size: 14px;
    line-height: 1;
}

/* global button spacing */
.btn {
    margin: 6px 8px 6px 0;
}

/* small buttons variant */
.btn.btn-sm,
.btn.small {
    padding: 6px 10px;
    font-size: 13px;
    border-radius: 10px;
}

`