/* =========================================
   1. IMPORT FONT & VARIABLES
   ========================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    /* Warna Utama */
    --primary: #38a1e5;
    --primary-dark: #2980b9;
    --secondary: #6c757d;
    --success: #2e7d32;
    --danger: #dc3545;
    --warning: #ff9800;

    /* Latar Belakang & Teks */
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #333333;
    --text-muted: #666666;
    --border: #e1e1e1;

    /* Bayang & Radius */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.12);
    --radius: 10px;
}

/* =========================================
   2. GLOBAL RESET
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 15px;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

/* =========================================
   3. HEADER & NAVIGASI (ADMIN & PELAJAR)
   ========================================= */
.header {
    background: linear-gradient(135deg, var(--primary) 0%, #1e5799 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header h1 {
    font-size: 1.4rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logout-icon {
    color: white;
    font-size: 1.1rem;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    transition: 0.3s;
}

.logout-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* =========================================
   4. DASHBOARD LAYOUT (CONTAINER & BANNER)
   ========================================= */
.dashboard-container,
.main-content {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

/* Welcome Banner (Biru Besar) */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #15467d 100%);
    border-radius: 15px;
    padding: 30px;
    color: white;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.welcome-banner h2 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    font-weight: 700;
}

.welcome-banner p {
    opacity: 0.9;
}

.welcome-banner i {
    position: absolute;
    right: 20px;
    bottom: -20px;
    font-size: 150px;
    opacity: 0.1;
    transform: rotate(-10deg);
}

/* =========================================
   5. STATS CARDS (GRID SYSTEM)
   ========================================= */
.stats-grid,
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card,
.info-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    border-left: 5px solid transparent;
    cursor: default;
}

.stat-card:hover,
.info-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Warna Kad Spesifik */
.stat-card.blue {
    border-left-color: var(--primary);
}

.stat-card.green {
    border-left-color: var(--success);
}

.stat-card.orange {
    border-left-color: var(--warning);
}

.stat-card.red {
    border-left-color: var(--danger);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 20px;
    flex-shrink: 0;
}

/* Warna Ikon Latar */
.stat-card.blue .stat-icon {
    background: rgba(56, 161, 229, 0.1);
    color: var(--primary);
}

.stat-card.green .stat-icon {
    background: rgba(46, 125, 50, 0.1);
    color: var(--success);
}

.stat-card.orange .stat-icon {
    background: rgba(255, 152, 0, 0.1);
    color: var(--warning);
}

.stat-card.red .stat-icon {
    background: rgba(220, 53, 69, 0.1);
    color: var(--danger);
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0;
    line-height: 1;
}

.stat-info p {
    color: #777;
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    margin-top: 5px;
}

/* =========================================
   6. JADUAL (MODERN TABLES)
   ========================================= */
.content-panel,
.table-responsive {
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    padding: 25px;
    margin-bottom: 30px;
    overflow-x: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.modern-table,
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
}

.modern-table th,
table th {
    background: #f8f9fa;
    padding: 15px;
    font-weight: 600;
    color: #555;
    text-align: left;
    border-bottom: 2px solid #eee;
    white-space: nowrap;
}

.modern-table td,
table td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.modern-table tr:hover td,
table tr:hover td {
    background-color: #fcfcfc;
}

/* Status Badges */
.badge,
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-green,
.status-hadir {
    background: rgba(46, 125, 50, 0.15);
    color: #2e7d32;
}

.badge-red,
.status-lewat {
    background: rgba(220, 53, 69, 0.15);
    color: #c62828;
}

.badge-blue {
    background: rgba(56, 161, 229, 0.15);
    color: #1565c0;
}

.badge-gray {
    background: #eee;
    color: #666;
}

/* =========================================
   7. BORANG (FORMS)
   ========================================= */
.section-container {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: var(--shadow-sm);
    max-width: 800px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #444;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e1e1;
    border-radius: 8px;
    font-size: 1rem;
    transition: 0.3s;
    background: #fafafa;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(56, 161, 229, 0.15);
}

/* Butang */
button,
.nav-button,
.btn-small {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: 0.3s;
}

.btn-blue-nav,
.btn-small,
.btn-kemaskini,
.btn-daftar {
    background: var(--primary);
    color: white;
}

.btn-blue-nav:hover,
.btn-small:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-logout,
.btn-hapus-merah {
    background: var(--danger);
    color: white;
}

.btn-logout:hover {
    background: #b71c1c;
}

.btn-kembali {
    background: var(--secondary);
    color: white;
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* =========================================
   8. NOTIFIKASI (DROPDOWN)
   ========================================= */
.notification-container,
.notification-wrapper {
    position: relative;
}

.notification-icon,
.notification-button {
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    position: relative;
    padding: 5px;
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--warning);
    color: #333;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
    font-weight: bold;
    border: 2px solid var(--primary);
}

.notification-dropdown {
    display: none;
    position: absolute;
    top: 45px;
    right: -10px;
    width: 320px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    overflow: hidden;
    border: 1px solid #eee;
    color: #333;
    /* Reset text color specifically for dropdown */
}

.notification-dropdown.open {
    display: block;
}

.notification-header {
    background: #f8f9fa;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
}

.notification-header a {
    color: var(--primary);
    font-size: 0.8rem;
    text-decoration: none;
}

.notification-header a:hover {
    text-decoration: underline;
}

.notification-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.notification-item {
    padding: 15px;
    border-bottom: 1px solid #f1f1f1;
    transition: 0.2s;
}

.notification-item:hover {
    background: #f9f9f9;
}

.notification-item.unread {
    background: #e3f2fd;
    border-left: 3px solid var(--primary);
}

.notif-message {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 5px;
}

.notif-time {
    font-size: 0.75rem;
    color: #888;
}

.notification-footer {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    color: #333;
}

.notification-footer a {
    color: var(--primary-dark);
    font-weight: 600;
    text-decoration: none;
}

.notification-footer a:hover {
    text-decoration: underline;
}

/* =========================================
   9. LOGIN & LUPA PASSWORD (SPLIT & CARD)
   ========================================= */

/* A. Layout Split Screen (index.html) */
.brand-section {
    flex: 1;
    background: linear-gradient(135deg, var(--primary), #1e5799);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    padding: 40px;
    text-align: center;
}

.brand-logo {
    font-size: 4rem;
    margin-bottom: 20px;
}

.login-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: white;
    padding: 40px;
}

/* B. Layout Card Tengah (Lupa Password) */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90vh;
    padding: 20px;
}

.login-box {
    background: white;
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary);
    background: #f0f7ff;
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    display: inline-block;
}

.login-box h1 {
    font-size: 1.6rem;
    color: #333;
    margin-bottom: 10px;
}

.login-subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* Butang Login Besar */
.login-button {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 1rem;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(56, 161, 229, 0.3);
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(56, 161, 229, 0.4);
}

/* Kotak Arahan Biru */
.login-instructions {
    background: #f0f7ff;
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: 6px;
    margin-top: 25px;
    text-align: left;
    font-size: 0.9rem;
}

.instruction-title {
    color: var(--primary-dark);
    font-weight: bold;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Paparan Password Pelajar */
.password-display {
    background: #2d3436;
    color: #00cec9;
    padding: 15px;
    border-radius: 8px;
    font-family: monospace;
    font-size: 1.5rem;
    letter-spacing: 2px;
    margin: 20px 0;
    border: 2px solid #00cec9;
}

/* =========================================
   10. MODAL (POPUP)
   ========================================= */
.modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* =========================================
   11. RESPONSIF (MOBILE)
   ========================================= */
@media (max-width: 768px) {

    /* Login Split jadi Stack */
    body:has(.brand-section) {
        flex-direction: column;
    }

    .brand-section {
        padding: 30px;
        flex: 0 0 auto;
    }

    .brand-logo {
        font-size: 3rem;
    }

    .login-section {
        padding: 30px 20px;
        border-radius: 20px 20px 0 0;
        margin-top: -20px;
    }

    /* Dashboard */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 1.1rem;
    }

    /* Form */
    .section-container form .form-group {
        display: block;
    }

    .separator {
        display: none;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button,
    .button-group a {
        width: 100%;
    }
}

@media (min-width: 769px) {

    /* Desktop Form Alignment */
    .section-container form .form-group {
        display: flex;
        align-items: center;
    }

    .section-container form label {
        width: 180px;
        flex-shrink: 0;
        margin-bottom: 0;
    }

    .separator {
        display: block;
        width: 20px;
        text-align: center;
        color: #999;
    }
}

/* =========================================
   STYLE UNTUK BUTANG IMPORT/EXPORT (ADDITION)
   ========================================= */

.import-controls {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
}

/* Base style untuk butang ikon */
.btn-icon-action {
    display: inline-flex;
    flex-direction: column;
    /* Icon atas, teks bawah */
    align-items: center;
    justify-content: center;
    width: 120px;
    /* Lebar butang */
    height: 100px;
    /* Tinggi butang */
    border-radius: 12px;
    text-decoration: none;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    font-weight: 500;
}

.btn-icon-action i {
    font-size: 32px;
    /* Saiz ikon besar */
    margin-bottom: 10px;
}

/* Hover Effect: Naik ke atas sedikit */
.btn-icon-action:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

/* Warna Butang 1: Download (Hijau Teal) */
.btn-download {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

/* Warna Butang 2: Pilih File (Ungu Biru) */
.btn-choose {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Warna Butang 3: Upload (Pink Merah) */
.btn-upload {
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
}

/* Teks paparan nama fail */
#file-name-display {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: #555;
    font-style: italic;
    min-height: 24px;
}

/* --- TAMBAHAN UNTUK REGISTER PELAJAR --- */

/* Gaya Pemisah "ATAU" */
.divider-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 30px 0;
    color: #999;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.divider-line {
    flex-grow: 1;
    height: 1px;
    background-color: #e0e0e0;
}

.divider-text {
    padding: 0 20px;
    text-transform: uppercase;
}

/* Header kecil dalam kad */
.section-title {
    font-size: 1.1rem;
    color: #444;
    font-weight: 700;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Container butang import supaya center */
.import-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
}