/* ============================================================
   SIKEMAS – Custom Stylesheet
   Tema: Hijau-Biru Kesehatan, Modern, Profesional
   ============================================================ */

/* ── Google Font: Inter ─────────────────────────────────── */
:root {
    /* Color Palette */
    --primary:        #0d6efd;
    --primary-dark:   #0a58ca;
    --primary-light:  #cfe2ff;
    --success:        #198754;
    --success-light:  #d1e7dd;
    --teal:           #0d9488;
    --teal-light:     #ccfbf1;
    --green:          #16a34a;
    --green-light:    #dcfce7;
    --warning:        #f59e0b;
    --danger:         #dc3545;
    --info:           #0dcaf0;
    --gray-50:        #f8fafc;
    --gray-100:       #f1f5f9;
    --gray-200:       #e2e8f0;
    --gray-300:       #cbd5e1;
    --gray-400:       #94a3b8;
    --gray-500:       #64748b;
    --gray-600:       #475569;
    --gray-700:       #334155;
    --gray-800:       #1e293b;
    --gray-900:       #0f172a;

    /* Sidebar */
    --sidebar-width:       260px;
    --sidebar-bg:          #0f172a;
    --sidebar-hover:       rgba(255,255,255,0.07);
    --sidebar-active:      rgba(13,110,253,0.18);
    --sidebar-active-text: #60a5fa;
    --sidebar-text:        #94a3b8;
    --sidebar-label:       #475569;

    /* Navbar */
    --navbar-height:  64px;
    --navbar-bg:      #ffffff;
    --navbar-shadow:  0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.05);

    /* Layout */
    --content-bg:     #f1f5f9;
    --card-bg:        #ffffff;
    --card-shadow:    0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --card-shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
    --border-color:   #e2e8f0;
    --border-radius:  0.75rem;
    --border-radius-sm: 0.5rem;

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --font-size-base: 0.9rem;

    /* Transition */
    --transition: all 0.2s ease;
}

/* ── Base ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { 
    scroll-behavior: smooth; 
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    background-color: var(--content-bg);
    color: var(--gray-700);
    line-height: 1.6;
    margin: 0;
    overflow-x: hidden;
    width: 100%;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--gray-800);
    line-height: 1.3;
}

a { text-decoration: none; transition: var(--transition); }
a:hover { text-decoration: none; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar sidebar */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--gray-700); border-radius: 4px; }

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0d6efd, #0d9488);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(13,110,253,0.4);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.brand-subtitle {
    font-size: 0.68rem;
    color: var(--sidebar-text);
    font-weight: 400;
}

/* Sidebar User Info */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: var(--sidebar-text);
    flex-shrink: 0;
}

.user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.user-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.badge-admin   { background: #dc3545 !important; font-size: 0.65rem; }
.badge-petugas { background: #0d6efd !important; font-size: 0.65rem; }

/* Sidebar Menu */
.sidebar-menu {
    list-style: none;
    margin: 8px 0 0;
    padding: 0 12px;
    flex: 1;
}

.menu-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--sidebar-label);
    padding: 14px 8px 6px;
    pointer-events: none;
}

.menu-item { margin: 2px 0; }

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 450;
    transition: var(--transition);
    white-space: nowrap;
}

.menu-link:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
    transform: translateX(2px);
}

.menu-item.active .menu-link {
    background: var(--sidebar-active);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.menu-icon {
    font-size: 1.05rem;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    color: var(--sidebar-label);
    font-size: 0.72rem;
    flex-shrink: 0;
}

/* ── Sidebar Overlay (Mobile) ────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1030;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active { display: block; }

/* ── Top Navbar ──────────────────────────────────────────── */
.top-navbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--navbar-height);
    background: var(--navbar-bg);
    box-shadow: var(--navbar-shadow);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 1020;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    gap: 8px;
}

.sidebar-toggle {
    border: none;
    background: transparent;
    font-size: 1.4rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: var(--transition);
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: var(--gray-100);
    color: var(--gray-700);
}

.breadcrumb { font-size: 0.82rem; }
.breadcrumb-item a { color: var(--primary); }

.navbar-right { gap: 12px; }

/* ── Main Content Layout ─────────────────────────────────── */
.page-wrapper {
    margin-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
    min-height: 100vh;
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-content {
    padding: 28px 28px 40px;
    max-width: 1400px;
}

/* Page header */
.page-header {
    margin-bottom: 24px;
}

.page-header h1, .page-header .page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-800);
    margin: 0 0 4px;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin: 0;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 0.9rem;
}

.card-body { padding: 20px; }
.card-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--border-color);
    padding: 12px 20px;
}

/* Stat Cards */
.stat-card {
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    cursor: default;
    border: 1px solid transparent;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--card-shadow-hover);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-info { flex: 1; min-width: 0; }

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Stat Card Color Variants */
.stat-card-blue    { background: linear-gradient(135deg, #1d4ed8, #2563eb); color: white; }
.stat-card-teal    { background: linear-gradient(135deg, #0d9488, #0f766e); color: white; }
.stat-card-green   { background: linear-gradient(135deg, #16a34a, #15803d); color: white; }
.stat-card-purple  { background: linear-gradient(135deg, #7c3aed, #6d28d9); color: white; }
.stat-card-orange  { background: linear-gradient(135deg, #ea580c, #c2410c); color: white; }
.stat-card-pink    { background: linear-gradient(135deg, #db2777, #be185d); color: white; }
.stat-card-indigo  { background: linear-gradient(135deg, #4338ca, #3730a3); color: white; }
.stat-card-cyan    { background: linear-gradient(135deg, #0891b2, #0e7490); color: white; }

.stat-card-blue   .stat-icon { background: rgba(255,255,255,0.2); }
.stat-card-teal   .stat-icon { background: rgba(255,255,255,0.2); }
.stat-card-green  .stat-icon { background: rgba(255,255,255,0.2); }
.stat-card-purple .stat-icon { background: rgba(255,255,255,0.2); }
.stat-card-orange .stat-icon { background: rgba(255,255,255,0.2); }
.stat-card-pink   .stat-icon { background: rgba(255,255,255,0.2); }
.stat-card-indigo .stat-icon { background: rgba(255,255,255,0.2); }
.stat-card-cyan   .stat-icon { background: rgba(255,255,255,0.2); }

/* ── Tables ──────────────────────────────────────────────── */
.table {
    font-size: 0.855rem;
    color: var(--gray-700);
}

.table thead th {
    background: var(--gray-50);
    color: var(--gray-500);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    padding: 12px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover { background-color: var(--gray-50); }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    font-weight: 500;
    font-size: 0.855rem;
    padding: 8px 18px;
    border-radius: 8px;
    transition: var(--transition);
    letter-spacing: 0.2px;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(13,110,253,0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(13,110,253,0.4);
    transform: translateY(-1px);
}

.btn-success {
    box-shadow: 0 2px 8px rgba(25,135,84,0.3);
}
.btn-success:hover {
    box-shadow: 0 4px 12px rgba(25,135,84,0.4);
    transform: translateY(-1px);
}

.btn-danger:hover { transform: translateY(-1px); }

.btn-outline-primary:hover { transform: translateY(-1px); }

/* ── Forms ───────────────────────────────────────────────── */
.form-control, .form-select {
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    padding: 9px 14px;
    transition: var(--transition);
    color: var(--gray-700);
    background-color: var(--card-bg);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,110,253,0.12);
    outline: none;
}

.form-label {
    font-weight: 500;
    font-size: 0.855rem;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.form-text {
    font-size: 0.78rem;
    color: var(--gray-400);
}

.input-group-text {
    background: var(--gray-50);
    border-color: var(--border-color);
    color: var(--gray-500);
    font-size: 0.875rem;
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    letter-spacing: 0.2px;
}

.bg-pink { background-color: #db2777 !important; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    border: none;
    border-radius: 10px;
    font-size: 0.875rem;
    padding: 14px 16px;
}

.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #dbeafe; color: #1e40af; }

/* ── Pagination ──────────────────────────────────────────── */
.pagination {
    gap: 4px;
    margin: 0;
}

.page-link {
    border-radius: 7px !important;
    border: 1.5px solid var(--border-color);
    color: var(--gray-600);
    font-size: 0.835rem;
    padding: 6px 12px;
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
}

/* ── Search & Filter Bar ─────────────────────────────────── */
.filter-bar {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray-400);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h5 {
    font-size: 1.1rem;
    color: var(--gray-500);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.875rem;
    color: var(--gray-400);
}

/* ── IMT Calc Result ─────────────────────────────────────── */
.imt-result-box {
    background: var(--gray-50);
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 0.875rem;
}

/* ── Avatar / Initials ───────────────────────────────────── */
.avatar-initials {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.78rem;
    flex-shrink: 0;
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
    .sidebar, .top-navbar, .sidebar-overlay,
    .btn, .breadcrumb, .filter-bar { display: none !important; }
    .page-wrapper { margin-left: 0 !important; padding-top: 0 !important; }
    .page-content { padding: 10px !important; }
    .card { box-shadow: none !important; border: 1px solid #dee2e6 !important; }
    body { background: white !important; font-size: 12px; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 8px 0 40px rgba(0,0,0,0.3);
    }

    .top-navbar {
        left: 0;
    }

    .page-wrapper {
        margin-left: 0;
    }

    .page-content {
        padding: 20px 16px 40px;
    }
}

@media (max-width: 575.98px) {
    .stat-value { font-size: 1.5rem; }
    .page-content { padding: 16px 12px 40px; }
    .card-body { padding: 16px; }
}

/* ── Utilities ───────────────────────────────────────────── */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-card { box-shadow: var(--card-shadow) !important; }
.rounded-card { border-radius: var(--border-radius) !important; }

/* Divider */
.divider {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 20px 0;
}

/* Section title */
.section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    margin-bottom: 12px;
}

/* Action button group in table */
.action-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: nowrap;
}

/* Warna khusus Tabel Riwayat */
.riwayat-row:hover { background: #f0f9ff !important; }

/* ── Animasi ─────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
    animation: fadeInUp 0.4s ease both;
}

.fade-in-up:nth-child(1) { animation-delay: 0.05s; }
.fade-in-up:nth-child(2) { animation-delay: 0.10s; }
.fade-in-up:nth-child(3) { animation-delay: 0.15s; }
.fade-in-up:nth-child(4) { animation-delay: 0.20s; }
.fade-in-up:nth-child(5) { animation-delay: 0.25s; }
.fade-in-up:nth-child(6) { animation-delay: 0.30s; }
.fade-in-up:nth-child(7) { animation-delay: 0.35s; }
.fade-in-up:nth-child(8) { animation-delay: 0.40s; }

/* ── Login Page ──────────────────────────────────────────── */
.login-page {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #0d4f3c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(13,110,253,0.15) 0%, transparent 70%);
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(13,148,136,0.12) 0%, transparent 70%);
    border-radius: 50%;
}

.login-card {
    background: rgba(255,255,255,0.97);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.4);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.5s ease;
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #0d6efd, #0d9488);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(13,110,253,0.4);
}

.login-title {
    font-size: 1.6rem;
    font-weight: 700;
    text-align: center;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: var(--gray-500);
    font-size: 0.82rem;
    margin-bottom: 28px;
    line-height: 1.4;
}

/* ── Chart container ─────────────────────────────────────── */
.chart-container {
    position: relative;
    height: 280px;
}

/* Scrollable table wrapper */
.table-responsive-custom {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
