/* ============================================
   SIPANTAU - Mobile-First Stylesheet
   ============================================ */

:root {
    --primary:       #2563eb;
    --primary-dark:  #1d4ed8;
    --success:       #16a34a;
    --danger:        #dc2626;
    --warning:       #d97706;
    --bg:            #f1f5f9;
    --surface:       #ffffff;
    --border:        #e2e8f0;
    --text:          #1e293b;
    --text-muted:    #64748b;
    --header-h:      56px;
    --bottom-nav-h:  64px;
    --radius:        14px;
    --radius-sm:     8px;
}

/* ============================================
   RESET / BASE
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    margin: 0;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
body.login-page {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 1rem;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
    color: #fff;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 1rem;
}

/* ============================================
   APP HEADER
   ============================================ */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--primary);
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.app-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Brand */
.app-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: #fff;
}

.app-brand-icon {
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.app-brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
}

/* Header Right */
.app-header-right {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.app-icon-btn {
    width: 38px;
    height: 38px;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.app-icon-btn:hover {
    background: rgba(255,255,255,0.25);
}

.dropdown-toggle-noarrow::after {
    display: none !important;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    padding-top: var(--header-h);
    padding-bottom: calc(var(--bottom-nav-h) + 1rem);
    min-height: 100vh;
}

.content-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottom-nav-h);
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 1000;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    /* Safe area for iPhone notch */
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    transition: color 0.15s;
    padding: 6px 4px 4px;
    border-top: 2px solid transparent;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item i {
    font-size: 1.3rem;
    line-height: 1;
}

.bottom-nav-item.active {
    color: var(--primary);
    border-top-color: var(--primary);
}

.bottom-nav-item:active {
    background: rgba(37,99,235,0.06);
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    /* Sudah ada padding bottom dari main-content */
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    margin-bottom: 1.25rem;
}

.page-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.2rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    overflow: hidden;
}

.card-header {
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.card-body {
    padding: 1rem;
}

/* ============================================
   STAT CARDS (Dashboard)
   ============================================ */
.stat-card {
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-card .card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card-primary .stat-icon { background: #dbeafe; color: var(--primary); }
.stat-card-success .stat-icon { background: #dcfce7; color: var(--success); }
.stat-card-danger  .stat-icon { background: #fee2e2; color: var(--danger); }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 0.2rem;
}

.stat-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

/* ============================================
   CARD INFO SISWA
   ============================================ */
.card-info {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    border-radius: var(--radius);
    box-shadow: 0 4px 16px rgba(37,99,235,0.3);
    color: #fff;
}

.card-info .card-body {
    padding: 1.25rem;
}

.student-avatar {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    flex-shrink: 0;
}

.card-info .student-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0;
}

.card-info .student-meta {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.8);
}

/* ============================================
   SHORTCUT / MENU CARDS (2-column grid)
   ============================================ */
.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.menu-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    text-decoration: none;
    color: var(--text) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    min-height: 90px;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.menu-card:active {
    transform: scale(0.97);
}

.menu-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(37,99,235,0.12);
    color: var(--primary) !important;
}

.menu-card i {
    font-size: 1.75rem;
    line-height: 1;
}

.menu-card span {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Warna icon per menu */
.menu-card.mc-tagihan    i { color: var(--primary); }
.menu-card.mc-kehadiran  i { color: var(--success); }
.menu-card.mc-pelanggaran i { color: var(--danger); }
.menu-card.mc-profil     i { color: #7c3aed; }

/* ============================================
   SECTION LABEL
   ============================================ */
.section-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 0.6rem;
    margin-top: 1.25rem;
}

/* ============================================
   TABLES
   ============================================ */
.table th {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.table td {
    font-size: 0.825rem;
    color: #334155;
}

/* ============================================
   LONCENG BADGE
   ============================================ */
.badge-notif {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: #fff;
    border-radius: 10px;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    min-width: 17px;
    text-align: center;
    line-height: 1.5;
    pointer-events: none;
    border: 2px solid var(--primary);
}

/* ============================================
   NOTIFICATION DROPDOWN PANEL
   ============================================ */
.notif-dropdown-wrapper { position: relative; }

.notif-panel {
    position: fixed;
    top: calc(var(--header-h) + 6px);
    right: 8px;
    width: min(340px, calc(100vw - 16px));
    max-height: 480px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0,0,0,0.16);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notif-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    background: #f8fafc;
    flex-shrink: 0;
}

.notif-panel-body {
    overflow-y: auto;
    flex-grow: 1;
    max-height: 400px;
}

.notif-panel-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: background 0.15s;
}

.notif-panel-item:last-child { border-bottom: none; }
.notif-panel-item:hover { background: #f8fafc; }

.notif-panel-item.unread {
    background: #fffbeb;
    border-left: 3px solid var(--warning);
}

.notif-panel-item.unread:hover { background: #fef9c3; }

.notif-panel-icon { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }

.notif-panel-content { flex-grow: 1; min-width: 0; }

.notif-panel-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notif-panel-item:not(.unread) .notif-panel-title {
    font-weight: 400;
    color: var(--text-muted);
}

.notif-panel-msg {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.notif-panel-time { font-size: 0.7rem; color: #94a3b8; margin-top: 3px; }

.notif-icon-PAYMENT      { color: var(--success); }
.notif-icon-ATTENDANCE   { color: var(--primary); }
.notif-icon-VIOLATION    { color: var(--danger); }
.notif-icon-ANNOUNCEMENT { color: var(--warning); }
.notif-icon-SYSTEM       { color: var(--text-muted); }

.btn-plain {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 0.72rem;
    color: var(--text-muted);
    transition: color 0.15s;
}

.btn-plain:hover { color: var(--primary); }

.notif-empty { padding: 2rem 1rem; }

/* ============================================
   PROFILE AVATAR
   ============================================ */
.profile-avatar {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #fff;
}

/* ============================================
   PLACEHOLDER PAGE (Kehadiran / Pelanggaran)
   ============================================ */
.placeholder-page {
    text-align: center;
    padding: 3rem 1.5rem;
}

.placeholder-page .placeholder-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

/* ============================================
   DESKTOP (max-width 600px content)
   ============================================ */
@media (min-width: 601px) {
    .content-container {
        padding: 1.5rem 1rem;
    }

    .notif-panel {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        width: 340px;
    }
}

@media (min-width: 1024px) {
    .app-header-inner,
    .content-container {
        max-width: 680px;
    }

    .bottom-nav {
        max-width: 600px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius) var(--radius) 0 0;
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}

/* ============================================
   NAV ICON LINK (untuk lonceng)
   ============================================ */
.nav-icon-link {
    color: var(--text-muted);
    text-decoration: none;
    background: none;
    border: none;
}

.user-info {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
}
