/* =========================================
   GLOBAL STYLE & RESET
   ========================================= */
:root {
    --primary: #3498db;
    --primary-dark: #2980b9;
    --success: #2ecc71;
    --danger: #e74c3c;
    --dark: #2c3e50;
    --light: #f4f7f6;
    --white: #ffffff;
    --gray: #95a5a6;
    --border: #dfe6e9;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--light);
    margin: 0;
    padding: 0;
    color: #333;
    line-height: 1.6;
}

a { text-decoration: none; transition: 0.3s; }
ul { list-style: none; padding: 0; margin: 0; }

/* Wrapper Container Utama */
.container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
}

/* =========================================
   NAVBAR ADMIN
   ========================================= */
nav {
    background: var(--white);
    padding: 15px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu {
    display: flex;
    align-items: center;
}

.nav-menu a {
    margin-left: 25px;
    color: #666;
    font-weight: 600;
    font-size: 0.95rem;
    padding-bottom: 5px;
    border-bottom: 2px solid transparent;
}

.nav-menu a:hover, .nav-menu a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* =========================================
   CARDS & SECTIONS
   ========================================= */
.card, .input-card, .section-box {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    border: 1px solid rgba(0,0,0,0.02);
}

.card h2, .card h3 {
    margin-top: 0;
    color: var(--dark);
}

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

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 5px solid transparent; /* Garis warna di atas */
    transition: transform 0.3s ease;
}

.stat-card:hover { transform: translateY(-5px); }

.stat-card h3 { margin: 0; font-size: 0.9rem; color: #7f8c8d; text-transform: uppercase; letter-spacing: 1px; }
.stat-card h1 { margin: 15px 0 0; font-size: 2.8rem; font-weight: 800; color: var(--dark); }

.stat-card.blue { border-top-color: var(--primary); }
.stat-card.green { border-top-color: var(--success); }
.stat-card.red { border-top-color: var(--danger); }

/* Custom Text Colors inside stats */
.text-green { color: var(--success) !important; }
.text-red { color: var(--danger) !important; }

/* =========================================
   FORMS & INPUTS (Modern)
   ========================================= */
/* Grid Layout untuk Form Whitelist */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}

input[type="text"], 
input[type="password"], 
select {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 5px; /* Spacing handled by grid gap usually */
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background-color: #fcfcfc;
}

input:focus, select:focus {
    border-color: var(--primary);
    background-color: var(--white);
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* =========================================
   BUTTONS
   ========================================= */
button {
    cursor: pointer;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover { opacity: 0.9; transform: translateY(-1px); }
button:active { transform: translateY(1px); }

.btn-primary { background: var(--primary); color: var(--white); width: 100%; }
.btn-success { background: var(--success); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-add { background: var(--success); color: var(--white); width: 100%; margin-top: 10px; }
.btn-danger-block { background: var(--danger); color: var(--white); width: 100%; margin-top: 20px; }

.btn-del {
    background: #ffecec;
    color: var(--danger);
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
}
.btn-del:hover { background: var(--danger); color: var(--white); }

.btn-logout {
    background: #f1f2f6;
    color: var(--danger);
    padding: 8px 15px;
    margin-left: 20px;
}
.btn-logout:hover { background: #ffecec; }

/* =========================================
   TABLES (Responsive & Clean)
   ========================================= */
.table-container {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.03);
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* Mencegah tabel gepeng di HP */
}

thead {
    background: var(--dark);
    color: var(--white);
}

th, td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 0.95rem;
}

th { text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.5px; }
tr:last-child td { border-bottom: none; }
tr:hover { background-color: #f8f9fa; }

/* =========================================
   PROGRESS BAR (Dashboard)
   ========================================= */
.progress-track {
    background: #ecf0f1;
    height: 24px;
    border-radius: 12px;
    margin-top: 8px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-fill {
    height: 100%;
    text-align: right;
    padding-right: 12px;
    line-height: 24px;
    color: var(--white);
    font-size: 0.75rem;
    font-weight: bold;
    width: 0%;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   LOGIN PAGE
   ========================================= */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: #eef2f7;
}

.login-card {
    background: var(--white);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

/* =========================================
   RESPONSIVE (Mobile)
   ========================================= */
@media (max-width: 768px) {
    nav {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .nav-menu a {
        margin: 0 5px;
        font-size: 0.9rem;
    }
    
    .btn-logout {
        margin-left: 0;
        width: 100%;
        margin-top: 10px;
    }

    /* Ubah Grid Form menjadi 1 kolom di HP */
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .btn-add {
        grid-column: 1; /* Reset span */
    }

    .stat-card h1 { font-size: 2rem; }
}
