/* =============================================
   Sneat-style Theme — Bootstrap 5 lokal
   ============================================= */

/* === TOKENS === */
:root {
    --sneat-primary:       #696cff;
    --sneat-primary-dark:  #5f61e6;
    --sneat-primary-light: #e7e7ff;
    --sneat-success:       #71dd37;
    --sneat-warning:       #ffab00;
    --sneat-danger:        #ff3e1d;
    --sneat-info:          #03c3ec;
    --sneat-body-bg:       #f5f5f9;
    --sneat-card-bg:       #fff;
    --sneat-dark:          #233446;
    --sneat-text:          #566a7f;
    --sneat-muted:         #a1acb8;
    --sneat-border:        #d9dee3;
    --sneat-sidebar-w:     260px;
    --sneat-topbar-h:      64px;
    --sneat-radius:        0.5rem;
    --sneat-radius-lg:     0.75rem;
    --sneat-shadow:        0 2px 6px rgba(67,89,113,.12);
    --sneat-shadow-lg:     0 4px 18px rgba(67,89,113,.18);
    --sneat-font:          'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; }
body {
    font-family: var(--sneat-font);
    background: var(--sneat-body-bg);
    color: var(--sneat-text);
    line-height: 1.53;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; }

/* =============================================
   AUTH PAGE
   ============================================= */
.auth-page {
    min-height: 100vh;
    background: var(--sneat-body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.auth-card {
    background: #fff;
    border-radius: var(--sneat-radius-lg);
    box-shadow: var(--sneat-shadow-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    margin-bottom: 1.75rem;
}
.auth-logo-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--sneat-primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.auth-logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sneat-dark);
}
.auth-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--sneat-dark);
    margin-bottom: .25rem;
}
.auth-sub {
    font-size: .875rem;
    color: var(--sneat-muted);
    margin-bottom: 1.5rem;
}

/* =============================================
   LAYOUT SHELL
   ============================================= */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* --- SIDEBAR --- */
.layout-menu {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sneat-sidebar-w);
    background: #fff;
    box-shadow: 0 0 0 1px rgba(67,89,113,.08), var(--sneat-shadow);
    display: flex;
    flex-direction: column;
    z-index: 1030;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform .25s ease;
}

/* mobile: sembunyikan sidebar */
@media (max-width: 991.98px) {
    .layout-menu {
        transform: translateX(-100%);
    }
    .layout-menu.open {
        transform: translateX(0);
        box-shadow: var(--sneat-shadow-lg);
    }
}

/* desktop: sidebar selalu tampil */
@media (min-width: 992px) {
    .layout-menu {
        transform: translateX(0) !important;
    }
}

.app-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.25rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--sneat-dark);
    border-bottom: 1px solid rgba(67,89,113,.06);
    flex-shrink: 0;
}
.app-brand-icon {
    width: 34px; height: 34px;
    border-radius: 8px;
    background: var(--sneat-primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.menu-inner {
    padding: .5rem 0;
    flex: 1;
}
.menu-header {
    padding: .75rem 1.5rem .25rem;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--sneat-muted);
}
.menu-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .7rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--sneat-text);
    transition: background .15s, color .15s;
    position: relative;
    white-space: nowrap;
}
.menu-link:hover,
.menu-link:focus {
    color: var(--sneat-primary);
    background: var(--sneat-primary-light);
    text-decoration: none;
}
.menu-link.active {
    color: var(--sneat-primary);
    background: var(--sneat-primary-light);
    font-weight: 600;
}
.menu-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--sneat-primary);
    border-radius: 0 2px 2px 0;
}
.menu-link i {
    font-size: 1.1rem;
    opacity: .75;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}
.menu-link.active i,
.menu-link:hover i { opacity: 1; }

/* sidebar footer */
.sidebar-footer {
    border-top: 1px solid rgba(67,89,113,.08);
    padding: 1rem 1.25rem;
    flex-shrink: 0;
}

/* --- MAIN AREA --- */
.layout-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    min-width: 0;
}

/* desktop: geser kanan sesuai lebar sidebar */
@media (min-width: 992px) {
    .layout-container {
        margin-left: var(--sneat-sidebar-w);
    }
}

/* mobile: tambah padding bawah untuk bottom nav */
@media (max-width: 991.98px) {
    .layout-container {
        padding-bottom: 60px;
    }
}

/* --- TOPBAR --- */
.layout-navbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid rgba(67,89,113,.08);
    height: var(--sneat-topbar-h);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    gap: .75rem;
}
.navbar-brand-text {
    font-size: .95rem;
    font-weight: 600;
    color: var(--sneat-dark);
    flex: 1;
}
.navbar-nav-right {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-left: auto;
}
.navbar-user {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: .82rem;
    color: var(--sneat-text);
}

/* hamburger button */
#menu-toggle {
    background: transparent;
    border: none;
    color: var(--sneat-text);
    padding: .35rem .5rem;
    cursor: pointer;
    flex-shrink: 0;
    display: none;
}
@media (max-width: 991.98px) {
    #menu-toggle { display: flex; align-items: center; }
}

/* --- CONTENT AREA --- */
.content-wrapper {
    flex: 1;
    padding: 1.25rem;
}
@media (min-width: 768px) {
    .content-wrapper { padding: 1.75rem; }
}
@media (min-width: 1200px) {
    .content-wrapper { padding: 2rem 2.25rem; }
}

.content-header { margin-bottom: 1.25rem; }
.content-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--sneat-dark);
    margin-bottom: .15rem;
}
.content-sub {
    font-size: .82rem;
    color: var(--sneat-muted);
    margin-bottom: 0;
}

/* --- BOTTOM NAV (mobile only) --- */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid rgba(67,89,113,.1);
    display: flex;
    z-index: 1030;
}
.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .1rem;
    font-size: .6rem;
    font-weight: 500;
    color: var(--sneat-muted);
    text-decoration: none;
    transition: color .15s;
    padding: .4rem .25rem;
}
.bottom-nav a i { font-size: 1.15rem; }
.bottom-nav a.active { color: var(--sneat-primary); }

@media (min-width: 992px) {
    .bottom-nav { display: none; }
}

/* =============================================
   COMPONENTS
   ============================================= */

/* --- CARDS --- */
.card {
    background: #fff;
    border-radius: var(--sneat-radius-lg);
    box-shadow: var(--sneat-shadow);
    border: none;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(67,89,113,.08);
    padding: 1rem 1.25rem .75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .5rem;
}
.card-title {
    font-size: .9rem;
    font-weight: 700;
    color: var(--sneat-dark);
    margin: 0;
}
.card-body { padding: 1.25rem; }

/* --- STAT CARDS --- */
.stat-card {
    background: #fff;
    border-radius: var(--sneat-radius-lg);
    box-shadow: var(--sneat-shadow);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .9rem;
    height: 100%;
}
.stat-icon {
    width: 46px; height: 46px;
    border-radius: var(--sneat-radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.stat-icon.purple { background: var(--sneat-primary-light); color: var(--sneat-primary); }
.stat-icon.green  { background: #e8fbd4; color: #5aad2a; }
.stat-icon.amber  { background: #fff3d6; color: #d08b00; }
.stat-icon.red    { background: #ffe0db; color: #d93016; }
.stat-icon.cyan   { background: #d7f5fc; color: #029ab8; }
.stat-value {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--sneat-dark);
    line-height: 1;
}
.stat-label {
    font-size: .75rem;
    color: var(--sneat-muted);
    margin-top: .2rem;
}

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

/* --- FORMS --- */
.form-label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--sneat-dark);
    margin-bottom: .3rem;
    display: block;
}
.form-control,
.form-select {
    border: 1px solid var(--sneat-border);
    border-radius: var(--sneat-radius);
    padding: .5rem .875rem;
    font-size: .875rem;
    font-family: var(--sneat-font);
    color: var(--sneat-dark);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
    display: block;
    -webkit-appearance: none;
    appearance: none;
}
.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--sneat-primary);
    box-shadow: 0 0 0 3px rgba(105,108,255,.16);
}
.form-control::placeholder { color: var(--sneat-muted); }
textarea.form-control { min-height: 88px; resize: vertical; }
.form-range { width: 100%; }
.input-group { display: flex; }
.input-group .form-control {
    border-radius: var(--sneat-radius) 0 0 var(--sneat-radius);
    flex: 1;
}
.input-group-text {
    padding: .5rem .875rem;
    background: #f8f9fa;
    border: 1px solid var(--sneat-border);
    border-left: none;
    border-radius: 0 var(--sneat-radius) var(--sneat-radius) 0;
    color: var(--sneat-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: .5rem 1.1rem;
    font-size: .875rem;
    font-weight: 500;
    border-radius: var(--sneat-radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: var(--sneat-font);
    text-decoration: none;
}
.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(105,108,255,.2); }
.btn-sm  { padding: .3rem .75rem; font-size: .78rem; }
.btn-lg  { padding: .65rem 1.5rem; font-size: 1rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.w-100   { width: 100% !important; }

.btn-primary   { background: var(--sneat-primary);  border-color: var(--sneat-primary);  color: #fff; }
.btn-primary:hover { background: var(--sneat-primary-dark); border-color: var(--sneat-primary-dark); color: #fff; }
.btn-success   { background: #5aad2a; border-color: #5aad2a; color: #fff; }
.btn-success:hover { background: #4d9424; color: #fff; }
.btn-danger    { background: var(--sneat-danger);   border-color: var(--sneat-danger);   color: #fff; }
.btn-warning   { background: var(--sneat-warning);  border-color: var(--sneat-warning);  color: #fff; }
.btn-info      { background: var(--sneat-info);     border-color: var(--sneat-info);     color: #fff; }
.btn-secondary { background: #fff; border-color: var(--sneat-border); color: var(--sneat-text); }
.btn-secondary:hover { background: #f5f5f9; color: var(--sneat-dark); }
.btn-outline-primary { background: transparent; border-color: var(--sneat-primary); color: var(--sneat-primary); }
.btn-outline-primary:hover { background: var(--sneat-primary); color: #fff; }

/* --- BADGES --- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .28em .6em;
    font-size: .7rem;
    font-weight: 600;
    border-radius: .35rem;
    line-height: 1;
}
.bg-label-primary   { background: var(--sneat-primary-light) !important; color: var(--sneat-primary) !important; }
.bg-label-success   { background: #e8fbd4 !important; color: #3d7a1a !important; }
.bg-label-warning   { background: #fff3d6 !important; color: #8a6000 !important; }
.bg-label-danger    { background: #ffe0db !important; color: #b71c1c !important; }
.bg-label-info      { background: #d7f5fc !important; color: #0277a8 !important; }
.bg-label-secondary { background: #f0f1f2 !important; color: #6b7280 !important; }

/* status spesifik jurnal/absen */
.badge-hadir, .badge-disetujui { background: #e8fbd4; color: #3d7a1a; }
.badge-terlambat, .badge-submitted { background: #fff3d6; color: #8a6000; }
.badge-alpha, .badge-revisi { background: #ffe0db; color: #b71c1c; }
.badge-draft { background: #f0f1f2; color: #6b7280; }

/* --- ALERTS --- */
.alert {
    padding: .875rem 1.1rem;
    border-radius: var(--sneat-radius);
    font-size: .875rem;
    border: none;
    margin-bottom: 1rem;
}
.alert-success { background: #e8fbd4; color: #2d5a14; }
.alert-danger  { background: #ffe0db; color: #8b1a1a; }
.alert-warning { background: #fff3d6; color: #7c5000; }
.alert-info    { background: #e7e7ff; color: #3a3d99; }

/* --- TABLES --- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
    min-width: 480px;
}
.table thead th {
    background: #f8f9fa;
    padding: .7rem 1rem;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--sneat-muted);
    border-bottom: 1px solid rgba(67,89,113,.1);
    white-space: nowrap;
}
.table tbody td {
    padding: .8rem 1rem;
    border-bottom: 1px solid rgba(67,89,113,.06);
    vertical-align: middle;
    color: var(--sneat-text);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(105,108,255,.025); }

/* --- TODAY HERO (siswa dashboard) --- */
.today-hero {
    background: linear-gradient(135deg, var(--sneat-primary) 0%, #9155fd 100%);
    border-radius: var(--sneat-radius-lg);
    padding: 1.5rem;
    color: #fff;
    margin-bottom: 1.25rem;
}
.today-hero-label { font-size: .78rem; opacity: .8; margin-bottom: .15rem; }
.today-hero-val   { font-size: .95rem; font-weight: 700; }
.today-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
    margin-top: 1rem;
}
.today-grid-item {
    background: rgba(255,255,255,.15);
    border-radius: var(--sneat-radius);
    padding: .6rem;
    text-align: center;
}
.today-grid-val { font-size: 1.05rem; font-weight: 800; }
.today-grid-lbl { font-size: .62rem; opacity: .8; margin-top: .1rem; }

/* --- PROGRESS --- */
.progress {
    height: 8px;
    background: rgba(67,89,113,.1);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: var(--sneat-primary);
    border-radius: 999px;
    transition: width .4s ease;
}

/* --- ABSENSI STEPS --- */
.absen-step-wrap {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: #fff;
    border-radius: var(--sneat-radius-lg);
    box-shadow: var(--sneat-shadow);
    padding: 1.25rem 1rem;
    margin-bottom: 1rem;
}
.absen-step { text-align: center; flex: 1; }
.absen-step-circle {
    width: 46px; height: 46px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto .4rem;
    border: 2px solid var(--sneat-border);
    color: var(--sneat-muted);
    background: #f8f9fa;
    font-size: 1rem;
}
.absen-step-circle.active {
    border-color: var(--sneat-primary);
    background: var(--sneat-primary-light);
    color: var(--sneat-primary);
}
.absen-step-circle.done {
    border-color: #5aad2a;
    background: #e8fbd4;
    color: #5aad2a;
}
.absen-step-label { font-size: .75rem; font-weight: 600; color: var(--sneat-muted); }
.absen-step-time  { font-size: .85rem; font-weight: 700; color: var(--sneat-dark); }

/* GPS bar */
.gps-bar {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .6rem 1rem;
    border-radius: var(--sneat-radius);
    font-size: .82rem;
    font-weight: 500;
    margin-bottom: .75rem;
}
.gps-bar.loading { background: #e7e7ff; color: #3a3d99; }
.gps-bar.ok      { background: #e8fbd4; color: #2d5a14; }
.gps-bar.fail    { background: #ffe0db; color: #8b1a1a; }
.gps-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.gps-dot.pulse { animation: pulse 1.2s infinite; }
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.75); }
}

/* Camera */
.camera-wrap {
    position: relative;
    border-radius: var(--sneat-radius-lg);
    overflow: hidden;
    background: #000;
    aspect-ratio: 4 / 3;
    max-height: 280px;
}
.camera-wrap video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.camera-overlay {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    pointer-events: none;
}
.camera-guide {
    width: 148px; height: 148px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,.75);
}
.camera-hint {
    color: rgba(255,255,255,.8);
    font-size: .75rem;
    margin-top: .5rem;
}
.preview-img {
    width: 100%;
    border-radius: var(--sneat-radius-lg);
    display: block;
}

/* Spinner */
.spinner-border-sm {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- MODAL --- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(67,89,113,.5);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: #fff;
    border-radius: var(--sneat-radius-lg);
    box-shadow: var(--sneat-shadow-lg);
    padding: 1.75rem 1.5rem;
    width: 100%;
    max-width: 480px;
    animation: modalIn .2s ease;
}
@keyframes modalIn {
    from { transform: translateY(16px); opacity: 0; }
    to   { transform: none; opacity: 1; }
}
.modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sneat-dark);
    margin-bottom: .75rem;
}

/* --- JURNAL ITEMS --- */
.jurnal-item {
    display: flex;
    gap: .85rem;
    padding: .85rem 0;
    border-bottom: 1px solid rgba(67,89,113,.06);
}
.jurnal-date {
    min-width: 40px;
    text-align: center;
    background: var(--sneat-primary-light);
    border-radius: var(--sneat-radius);
    padding: .4rem .3rem;
    flex-shrink: 0;
}
.jurnal-date-day { font-size: 1.2rem; font-weight: 800; color: var(--sneat-primary); line-height: 1; }
.jurnal-date-mon { font-size: .6rem; text-transform: uppercase; color: var(--sneat-primary); font-weight: 600; }
.jurnal-kegiatan {
    font-size: .875rem;
    color: var(--sneat-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* =============================================
   UTILITIES
   ============================================= */
.text-muted    { color: var(--sneat-muted) !important; }
.text-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fw-bold       { font-weight: 700 !important; }
.fw-semibold   { font-weight: 600 !important; }
.border-bottom { border-bottom: 1px solid rgba(67,89,113,.08) !important; }
.border-top    { border-top: 1px solid rgba(67,89,113,.08) !important; }

/* === APP FOOTER === */
.app-footer {
    margin-top: 2rem;
    padding: 1rem 0 .5rem;
    border-top: 1px solid rgba(67,89,113,.08);
    text-align: center;
    font-size: .72rem;
    color: var(--sneat-muted);
}
.app-footer strong { color: var(--sneat-primary); }

/* Override browser auto-justify pada textarea dan input */
textarea,
textarea.form-control,
input.form-control,
.form-control {
    text-align: left !important;
    word-spacing: normal !important;
    letter-spacing: normal !important;
    -webkit-text-size-adjust: 100%;
}
