/* =====================================================
   SISTEM PAKAR GIZI BURUK - Main Stylesheet
   ===================================================== */

:root {
    --primary:    #2d6a4f;
    --primary-dk: #1b4332;
    --primary-lt: #40916c;
    --accent:     #52b788;
    --accent-lt:  #d8f3dc;
    --warning:    #e76f51;
    --danger:     #c0392b;
    --info:       #2980b9;
    --dark:       #1a1a2e;
    --gray:       #6c757d;
    --gray-lt:    #f8f9fa;
    --white:      #ffffff;
    --border:     #dee2e6;
    --shadow:     0 2px 15px rgba(0,0,0,0.08);
    --radius:     10px;
    --transition: all 0.25s ease;
}

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

body {
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    background: #f0f4f0;
    color: #333;
    font-size: 14px;
    line-height: 1.6;
}

a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--primary-lt); }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: 250px;
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-dk) 0%, var(--primary) 100%);
    overflow-y: auto;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 20px 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-icon {
    width: 42px; height: 42px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
}

.sidebar-brand .brand-text h4 {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-brand .brand-text span {
    color: rgba(255,255,255,0.6);
    font-size: 11px;
}

.sidebar-nav { padding: 15px 0; }

.nav-section-title {
    color: rgba(255,255,255,0.4);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 10px 20px 5px;
}

.nav-item { margin: 2px 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    color: rgba(255,255,255,0.75);
    border-radius: 8px;
    transition: var(--transition);
    font-size: 13px;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
}

.nav-link.active { background: var(--accent); color: #fff; }

.nav-link i { width: 18px; text-align: center; font-size: 15px; }

.sidebar-user {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 15px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-info .user-name {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    display: block;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info .user-role {
    color: rgba(255,255,255,0.5);
    font-size: 11px;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 250px;
    min-height: 100vh;
    padding: 0;
}

.topbar {
    background: #fff;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-title h5 {
    font-size: 16px;
    font-weight: 700;
    color: var(--dark);
}

.topbar-title span {
    color: var(--gray);
    font-size: 12px;
}

.topbar-actions { display: flex; align-items: center; gap: 15px; }

.page-content { padding: 25px; }

/* ===== CARDS ===== */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: none;
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fff;
}

.card-header h6 {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h6 i { color: var(--primary); }

.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,0.12); }

.stat-icon {
    width: 56px; height: 56px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.green  { background: #d8f3dc; color: var(--primary); }
.stat-icon.blue   { background: #dbeafe; color: #1d4ed8; }
.stat-icon.orange { background: #fed7aa; color: #c2410c; }
.stat-icon.red    { background: #fee2e2; color: #dc2626; }
.stat-icon.teal   { background: #ccfbf1; color: #0d9488; }
.stat-icon.purple { background: #ede9fe; color: #7c3aed; }

.stat-info .stat-number {
    font-size: 24px;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
}

.stat-info .stat-label {
    color: var(--gray);
    font-size: 12px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 7px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; }
.btn-success { background: #27ae60; color: #fff; }
.btn-success:hover { background: #219a52; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d45f3c; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; color: #fff; }
.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2471a3; color: #fff; }
.btn-secondary { background: var(--gray); color: #fff; }
.btn-secondary:hover { background: #5a6268; color: #fff; }
.btn-outline-primary { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

thead th {
    background: #f8fffe;
    color: var(--primary-dk);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    border-bottom: 2px solid var(--accent-lt);
    white-space: nowrap;
}

tbody tr { border-bottom: 1px solid #f0f0f0; transition: var(--transition); }
tbody tr:hover { background: #f8fffe; }
tbody td { padding: 11px 14px; vertical-align: middle; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

.badge-success { background: #d8f3dc; color: var(--primary-dk); }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f3f4f6; color: #6b7280; }
.badge-primary { background: var(--accent-lt); color: var(--primary-dk); }

.badge-role-admin   { background: #ede9fe; color: #4c1d95; }
.badge-role-dokter  { background: #dbeafe; color: #1e3a8a; }
.badge-role-bidan   { background: #fce7f3; color: #831843; }
.badge-role-kader   { background: #d1fae5; color: #064e3b; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

.form-control, select, textarea {
    width: 100%;
    padding: 9px 13px;
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: 13px;
    color: #333;
    background: #fff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.15);
}

.form-control.is-invalid { border-color: var(--danger); }
.form-text { font-size: 11px; color: var(--gray); margin-top: 4px; }

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
}

.alert-success { background: #d8f3dc; color: #1b4332; border-left: 4px solid var(--primary); }
.alert-danger  { background: #fee2e2; color: #7f1d1d; border-left: 4px solid var(--danger); }
.alert-warning { background: #fef3c7; color: #78350f; border-left: 4px solid #f59e0b; }
.alert-info    { background: #dbeafe; color: #1e3a8a; border-left: 4px solid var(--info); }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.page-link {
    padding: 6px 12px;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    color: var(--primary);
    font-size: 13px;
    transition: var(--transition);
}

.page-link:hover, .page-link.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ===== DIAGNOSA / KONSULTASI KHUSUS ===== */
.gejala-list { list-style: none; }

.gejala-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    margin-bottom: 10px;
    transition: var(--transition);
    cursor: pointer;
}

.gejala-item:hover { border-color: var(--accent); background: #f8fffe; }
.gejala-item.selected { border-color: var(--primary); background: var(--accent-lt); }

.gejala-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.gejala-item .gejala-name { font-size: 13px; font-weight: 500; flex: 1; }
.gejala-item .gejala-kode { font-size: 11px; color: var(--gray); }

.cf-input {
    width: 80px;
    padding: 5px 8px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    font-size: 12px;
    text-align: center;
    display: none;
}

.gejala-item.selected .cf-input { display: block; }

/* Hasil Diagnosa */
.hasil-card {
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
}

.hasil-card.rank-1 { border-color: var(--primary); }
.hasil-card.rank-1::before {
    content: 'DIAGNOSA UTAMA';
    position: absolute;
    top: 0; right: 0;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 12px;
    border-bottom-left-radius: 8px;
}

.cf-bar {
    height: 10px;
    border-radius: 10px;
    background: #e9ecef;
    overflow: hidden;
    margin: 10px 0;
}

.cf-fill {
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--accent), var(--primary));
    transition: width 0.8s ease;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dk) 0%, var(--primary) 50%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 18px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .logo-circle {
    width: 70px; height: 70px;
    background: var(--accent-lt);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
    margin: 0 auto 12px;
}

.login-logo h4 { font-size: 18px; color: var(--primary-dk); font-weight: 800; }
.login-logo p  { color: var(--gray); font-size: 12px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { width: 0; overflow: hidden; }
    .sidebar.open { width: 250px; }
    .main-content { margin-left: 0; }
    .page-content { padding: 15px; }
    .topbar { padding: 12px 15px; }
}

/* ===== PRINT ===== */
@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .main-content { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ===== MISC ===== */
.text-primary { color: var(--primary) !important; }
.text-muted   { color: var(--gray) !important; }
.text-danger  { color: var(--danger) !important; }
.text-success { color: #27ae60 !important; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 12px; }
.mt-3 { margin-top: 12px; }
.p-0 { padding: 0; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
@media (max-width: 900px) {
    .grid-4 { grid-template-columns: repeat(2,1fr); }
    .grid-3 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 600px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
}
