/* ============================================================
   style.css - Aplikasi Absensi SMP Negeri 3 Sragen
   Pembuat: Eko Darisdi
   ============================================================ */

/* --- Fonts & Variables --- */
:root {
    --primary: #4361ee;
    --primary-dark: #3047d6;
    --primary-light: #eef0fd;
    --secondary: #7209b7;
    --accent: #f72585;
    --success: #06d6a0;
    --warning: #ffd166;
    --danger: #ef233c;
    --info: #4cc9f0;
    --sidebar-w: 260px;
    --navbar-h: 62px;
    --dark-bg: #0f172a;
    --dark-card: #1e293b;
    --dark-border: #334155;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --text-light: #f8fafc;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.18);
    --radius: 14px;
    --radius-sm: 8px;
    --transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', sans-serif;
    background: #f0f4ff;
    color: var(--text-dark);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.app-navbar {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    height: var(--navbar-h);
    box-shadow: 0 2px 20px rgba(67,97,238,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    z-index: 1050;
}

.brand-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: white;
    box-shadow: 0 4px 12px rgba(247,37,133,0.4);
    flex-shrink: 0;
}

.nav-alert-btn {
    position: relative;
    width: 38px; height: 38px;
    background: rgba(255,193,7,0.15);
    border: 1px solid rgba(255,193,7,0.3);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: #ffd166; font-size: 1rem;
    text-decoration: none;
    transition: var(--transition);
}
.nav-alert-btn:hover { background: rgba(255,193,7,0.25); color: #ffd166; }
.nav-alert-btn .badge-count {
    position: absolute; top: -6px; right: -6px;
    background: var(--accent);
    color: white; font-size: 0.6rem; font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    border: 2px solid #312e81;
}

.user-btn {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    color: white;
    padding: 6px 12px;
    display: flex; align-items: center; gap: 10px;
    transition: var(--transition);
}
.user-btn:hover, .user-btn:focus { background: rgba(255,255,255,0.15); color: white; border-color: rgba(255,255,255,0.3); }
.user-btn::after { display: none; }
.user-btn .bi-chevron-down { font-size: 0.7rem; }
.user-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: white;
}

.user-dropdown {
    border: 0;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 200px;
}
.user-dropdown .dropdown-item {
    padding: 8px 16px;
    font-size: 0.85rem;
    transition: var(--transition);
}
.user-dropdown .dropdown-item:hover { background: var(--primary-light); color: var(--primary); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.app-wrapper {
    display: flex;
    padding-top: var(--navbar-h);
    min-height: 100vh;
}

.app-sidebar {
    width: var(--sidebar-w);
    min-height: calc(100vh - var(--navbar-h));
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    position: fixed;
    left: 0;
    top: var(--navbar-h);
    bottom: 0;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

.sidebar-scroll {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 20px;
}
.sidebar-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-scroll::-webkit-scrollbar-track { background: transparent; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-school-info {
    padding: 20px 16px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    margin-bottom: 8px;
}
.school-logo-wrap {
    width: 54px; height: 54px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; color: white;
    margin: 0 auto 10px;
    box-shadow: 0 6px 20px rgba(67,97,238,0.4);
}
.school-name {
    color: white; font-weight: 600; font-size: 0.82rem; line-height: 1.3;
}
.school-year {
    color: rgba(255,255,255,0.45); font-size: 0.68rem; margin-top: 3px;
}

.sidebar-nav { padding: 8px 12px; flex: 1; }

.nav-section-label {
    color: rgba(255,255,255,0.3);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 12px 8px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}
.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: white;
    transform: translateX(3px);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(67,97,238,0.3), rgba(114,9,183,0.2));
    color: white;
    border: 1px solid rgba(67,97,238,0.3);
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 60%;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}
.nav-item i { font-size: 1rem; width: 20px; flex-shrink: 0; }
.sidebar-badge {
    margin-left: auto;
    background: var(--accent);
    color: white; font-size: 0.62rem; font-weight: 700;
    padding: 2px 7px; border-radius: 20px;
}

.sidebar-footer {
    padding: 12px 12px 0;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin-top: 8px;
}
.logout-btn {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 10px;
    color: #f87171; text-decoration: none;
    font-size: 0.84rem; font-weight: 500;
    transition: var(--transition);
}
.logout-btn:hover { background: rgba(248,113,113,0.1); color: #f87171; }
.sidebar-credit {
    text-align: center; color: rgba(255,255,255,0.2);
    font-size: 0.65rem; padding: 10px 0 0;
}

.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
    backdrop-filter: blur(2px);
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: calc(100vh - var(--navbar-h));
    transition: margin-left 0.3s cubic-bezier(0.4,0,0.2,1);
}

/* ============================================================
   CARDS & STAT CARDS
   ============================================================ */
.card {
    border: 0;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    background: white;
    transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.stat-card {
    border-radius: var(--radius);
    padding: 22px 24px;
    display: flex; align-items: center; gap: 16px;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    color: white;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat-card-hadir  { background: linear-gradient(135deg, #06d6a0, #02b589); }
.stat-card-ijin   { background: linear-gradient(135deg, #4cc9f0, #2ba8d1); }
.stat-card-sakit  { background: linear-gradient(135deg, #ffd166, #f0a500); }
.stat-card-alpha  { background: linear-gradient(135deg, #ef233c, #c81226); }
.stat-card-total  { background: linear-gradient(135deg, #4361ee, #3047d6); }

.stat-card-icon {
    width: 58px; height: 58px;
    background: rgba(255,255,255,0.2);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.7rem;
    flex-shrink: 0;
}
.stat-card-body { flex: 1; }
.stat-card-body .label { font-size: 0.78rem; font-weight: 500; opacity: 0.85; letter-spacing: 0.05em; text-transform: uppercase; }
.stat-card-body .value { font-size: 2.2rem; font-weight: 800; line-height: 1.1; }
.stat-card-body .sublabel { font-size: 0.72rem; opacity: 0.7; margin-top: 2px; }
.stat-card::after {
    content: '';
    position: absolute; right: -20px; bottom: -20px;
    width: 100px; height: 100px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    border-radius: var(--radius);
    padding: 22px 28px;
    color: white;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}
.page-header::before {
    content: '';
    position: absolute; right: -30px; top: -30px;
    width: 150px; height: 150px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}
.page-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-header .breadcrumb { margin: 4px 0 0; font-size: 0.78rem; opacity: 0.7; }
.page-header .breadcrumb-item+.breadcrumb-item::before { color: rgba(255,255,255,0.4); }
.page-header .breadcrumb-item.active { color: rgba(255,255,255,0.7); }
.page-header .breadcrumb a { color: rgba(255,255,255,0.8); text-decoration: none; }

/* ============================================================
   TABLES
   ============================================================ */
.table-card { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-card .card-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white; padding: 16px 20px;
    font-weight: 600; font-size: 0.9rem;
    border-radius: 0; border: 0;
    display: flex; align-items: center; gap: 8px;
}
.table > thead > tr > th {
    background: #f8fafc;
    color: var(--text-muted);
    font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em;
    border-bottom: 2px solid #e2e8f0;
    padding: 12px 16px;
}
.table > tbody > tr > td { padding: 11px 16px; vertical-align: middle; border-color: #f1f5f9; }
.table-hover tbody tr:hover { background: #f8faff; }

/* Status badges */
.badge-hadir  { background: #d1fae5; color: #065f46; }
.badge-ijin   { background: #dbeafe; color: #1e3a5f; }
.badge-sakit  { background: #fef3c7; color: #78350f; }
.badge-alpha  { background: #fee2e2; color: #7f1d1d; }

.status-badge {
    padding: 4px 12px; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-control, .form-select {
    border: 1.5px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 0.87rem;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
}
.form-label { font-weight: 600; font-size: 0.82rem; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.input-group-text { border: 1.5px solid #e2e8f0; background: #f8fafc; color: var(--text-muted); }

/* Buttons */
.btn { border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; padding: 8px 18px; transition: var(--transition); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border: 0; box-shadow: 0 4px 12px rgba(67,97,238,0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(67,97,238,0.4); background: linear-gradient(135deg, var(--primary-dark), #2234b0); }
.btn-success { background: linear-gradient(135deg, #06d6a0, #02b589); border: 0; box-shadow: 0 4px 12px rgba(6,214,160,0.3); }
.btn-success:hover { transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg, #ef233c, #c81226); border: 0; }
.btn-warning { background: linear-gradient(135deg, #ffd166, #f0a500); border: 0; color: #333; }
.btn-info { background: linear-gradient(135deg, #4cc9f0, #2ba8d1); border: 0; color: white; }
.btn-outline-primary { border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: white; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-card { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); background: white; }
.chart-card .chart-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 600; font-size: 0.9rem;
    display: flex; align-items: center; justify-content: space-between;
}
.chart-body { padding: 20px; position: relative; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 100%);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(67,97,238,0.15) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(114,9,183,0.15) 0%, transparent 50%);
    animation: loginBg 8s ease-in-out infinite alternate;
}
@keyframes loginBg {
    0% { transform: scale(1) rotate(0deg); }
    100% { transform: scale(1.1) rotate(5deg); }
}
.login-card {
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 48px 40px;
    width: 100%; max-width: 440px;
    position: relative; z-index: 1;
    box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}
.login-logo {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--accent), var(--primary));
    border-radius: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.2rem; color: white;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(247,37,133,0.4);
    animation: logoFloat 3s ease-in-out infinite;
}
@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.login-title { color: white; font-size: 1.5rem; font-weight: 800; text-align: center; }
.login-sub { color: rgba(255,255,255,0.5); font-size: 0.82rem; text-align: center; margin-bottom: 28px; }
.login-card .form-control {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.1);
    color: white;
}
.login-card .form-control::placeholder { color: rgba(255,255,255,0.3); }
.login-card .form-control:focus { background: rgba(255,255,255,0.1); border-color: var(--primary); color: white; }
.login-card .input-group-text { background: rgba(255,255,255,0.07); border-color: rgba(255,255,255,0.1); color: rgba(255,255,255,0.4); }
.login-card .form-label { color: rgba(255,255,255,0.7); }
.btn-login {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: white; border: 0;
    width: 100%; padding: 13px;
    font-size: 0.95rem; font-weight: 700;
    border-radius: 12px;
    letter-spacing: 0.05em;
    box-shadow: 0 8px 24px rgba(67,97,238,0.4);
    transition: var(--transition);
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(67,97,238,0.5); color: white; }

/* ============================================================
   ABSENSI TABLE
   ============================================================ */
.absensi-row .status-radio { display: none; }
.absensi-row .status-options { display: flex; gap: 4px; flex-wrap: wrap; }
.absensi-row .status-opt {
    padding: 4px 10px; border-radius: 20px; cursor: pointer;
    font-size: 0.75rem; font-weight: 600;
    border: 2px solid transparent; transition: var(--transition);
    user-select: none;
}
.status-opt-hadir { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.status-opt-ijin  { background: #dbeafe; color: #1e3a5f; border-color: #bfdbfe; }
.status-opt-sakit { background: #fef3c7; color: #78350f; border-color: #fde68a; }
.status-opt-alpha { background: #fee2e2; color: #7f1d1d; border-color: #fecaca; }
input[name^="status"]:checked + .status-opt-hadir,
.status-opt-hadir.selected { background: #065f46; color: white; border-color: #065f46; }
input[name^="status"]:checked + .status-opt-ijin,
.status-opt-ijin.selected  { background: #1e40af; color: white; border-color: #1e40af; }
input[name^="status"]:checked + .status-opt-sakit,
.status-opt-sakit.selected { background: #92400e; color: white; border-color: #92400e; }
input[name^="status"]:checked + .status-opt-alpha,
.status-opt-alpha.selected { background: #7f1d1d; color: white; border-color: #7f1d1d; }

/* ============================================================
   ALERT / WARNING
   ============================================================ */
.alert-alpha-card {
    background: linear-gradient(135deg, #7f1d1d, #991b1b);
    color: white; border-radius: var(--radius);
    padding: 16px 20px;
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.alert-alpha-card:hover { transform: translateX(4px); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-in-up { animation: fadeInUp 0.4s ease forwards; }

@keyframes pulse-dot {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}
.pulse-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    display: inline-block;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-overlay.show { display: block; }
    .app-main { margin-left: 0; }
}

/* Scrollbar global */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Utility */
.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.fw-500 { font-weight: 500; }
.fw-400 { font-weight: 400; }
.text-gradient { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Print */
@media print {
    .app-navbar, .app-sidebar, .btn, .no-print { display: none !important; }
    .app-main { margin-left: 0 !important; }
    body { background: white; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .page-header { background: #333 !important; -webkit-print-color-adjust: exact; }
}
