/* General & Font Styles */
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap');

:root {
    --primary-color: #556B2F; /* Dark Olive Green */
    --secondary-color: #8FBC8F; /* Dark Sea Green */
    --light-color: #F0F8FF; /* Alice Blue */
    --dark-color: #2F4F4F; /* Dark Slate Gray */
    --text-color: #333;
    --white-color: #FFFFFF;
    --border-color: #ddd;
    --alert-error-bg: #f2dede;
    --alert-error-text: #a94442;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    background-color: var(--light-color);
    color: var(--text-color);
}

/* --- Login Page Styles --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background-color: var(--dark-color);
}

.login-box {
    background: var(--white-color);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header .fa-hospital-user { font-size: 48px; color: var(--primary-color); margin-bottom: 10px; }
.login-header h2 { margin: 10px 0; color: var(--dark-color); }
.login-header p { color: #777; margin-bottom: 30px; }

.input-group { text-align: left; margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.input-icon { position: relative; }
.input-icon .fas { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #aaa; }
.input-icon input { width: 100%; padding: 12px 12px 12px 40px; border: 1px solid var(--border-color); border-radius: 5px; box-sizing: border-box; }
.input-icon input:focus { outline: none; border-color: var(--primary-color); }

.btn-login { width: 100%; padding: 12px; background-color: var(--primary-color); color: var(--white-color); border: none; border-radius: 5px; font-size: 18px; font-weight: 700; cursor: pointer; transition: background-color 0.3s; }
.btn-login:hover { background-color: #4a5d28; }
.alert-error { padding: 15px; margin-bottom: 20px; border: 1px solid var(--alert-error-text); border-radius: 4px; color: var(--alert-error-text); background-color: var(--alert-error-bg); font-weight: bold; }

/* --- Admin Dashboard Styles --- */
.admin-wrapper { display: flex; min-height: 100vh; }

.sidebar { width: 260px; background-color: var(--dark-color); color: var(--white-color); display: flex; flex-direction: column; flex-shrink: 0; }

.sidebar-header { 
    padding: 20px; 
    text-align: center; 
    border-bottom: 1px solid #4a6868; 
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header .fas { font-size: 24px; margin-right: 10px; }
.sidebar-header h3 { margin: 0; font-size: 20px; display: inline-block; vertical-align: middle; }
.sidebar-nav { flex-grow: 1; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 20px 0; }
.sidebar-nav a { display: flex; align-items: center; padding: 15px 20px; color: var(--light-color); text-decoration: none; transition: background-color 0.3s; border-left: 4px solid transparent; }
.sidebar-nav a .fa-fw { width: 20px; margin-right: 15px; }
.sidebar-nav a:hover { background-color: #4a6868; }
.sidebar-nav a.active { background-color: var(--primary-color); font-weight: 700; border-left-color: var(--secondary-color); }
.sidebar-nav hr { border-color: #4a6868; margin: 15px 20px; }

.main-content { flex-grow: 1; display: flex; flex-direction: column; }

.main-header {
    background: var(--white-color);
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    
    /* Tambahkan 3 baris ini */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.main-header h1 { margin: 0; font-size: 24px; }
.main-header p { margin: 5px 0 0; color: #777; }

.content-body { padding: 30px; flex-grow: 1; }
.content-section { background-color: var(--white-color); padding: 25px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.content-section h2 { color: var(--primary-color); border-bottom: 2px solid var(--secondary-color); padding-bottom: 10px; margin-top: 0; }
.content-section h2 .fas { margin-right: 10px; }

/* Table and Form Styles */
.data-table { width: 100%; border-collapse: collapse; margin-top: 20px; }
.data-table th, .data-table td { border: 1px solid var(--border-color); padding: 12px; text-align: left; }
.data-table th { background-color: #f2f2f2; }
.btn-primary, .btn-edit, .btn-delete, .btn-info { padding: 8px 12px; border: none; border-radius: 4px; color: white; cursor: pointer; font-size: 14px; margin-right: 5px; }
.btn-primary { background-color: var(--primary-color); }
.btn-edit { background-color: #f0ad4e; }
.btn-delete { background-color: #d9534f; }
.btn-info { background-color: #5bc0de; }
.btn-primary .fas, .btn-edit .fas, .btn-delete .fas, .btn-info .fas { margin-right: 5px; }
.profile-form, .data-form { max-width: 600px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; }
.form-group input { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 4px; box-sizing: border-box; }

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: none;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 1001;
    width: 90%;
    max-width: 500px;
    display: none;
    flex-direction: column;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--dark-color);
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 10px;
    margin-top: 20px;
}

/* Style untuk Tag Jadwal */
.schedule-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.schedule-tag {
    background-color: #e9ecef;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 13px;
    white-space: nowrap;
    border: 1px solid #ddd;
}
.schedule-tag.day-1 { background-color: #d4edda; border-color: #c3e6cb;}
.schedule-tag.day-2 { background-color: #cce5ff; border-color: #b8daff;}
.schedule-tag.day-3 { background-color: #fff3cd; border-color: #ffeeba;}
.schedule-tag.day-4 { background-color: #f8d7da; border-color: #f5c6cb;}
.schedule-tag.day-5 { background-color: #d1ecf1; border-color: #bee5eb;}
.schedule-tag-empty { font-style: italic; color: #888; }
/* Style untuk daftar jadwal di modal */
.schedule-item { display:flex; justify-content:space-between; align-items:center; padding:8px; border-bottom:1px solid #eee; }

/* File: style.css (Tambahkan di bawah) */

/* Style untuk Select2 agar sesuai tema */
.select2-container--default .select2-selection--single {
    height: 42px; /* Samakan tinggi dengan input lain */
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 40px;
    padding-left: 10px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px;
}

/* Style saat dropdown di-klik (fokus) */
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: var(--primary-color);
}

/* Style untuk daftar opsi */
.select2-dropdown {
    border: 1px solid var(--border-color);
    border-radius: 4px;
}
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--primary-color);
}

.select2-container {
    width: 100% !important;
}

/* --- Queue Display Styles --- */
.queue-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; }
.queue-header .form-group { margin-bottom: 0; }
.queue-header select { min-width: 300px; padding: 10px; border: 1px solid var(--border-color); border-radius: 4px; }
.queue-container { display: grid; grid-template-columns: 1fr 1fr; gap: 25px; }
.queue-card { border-radius: 8px; padding: 20px; color: white; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.queue-card h3 { margin: 0 0 15px 0; border-bottom: 2px solid rgba(255,255,255,0.5); padding-bottom: 10px; font-size: 1.2em; text-align: center; }
.now-serving { background: linear-gradient(135deg, var(--primary-color), #4a5d28); }
.next-in-queue { background: linear-gradient(135deg, #5bc0de, #46b8da); }
.queue-content .queue-number { font-size: 4em; font-weight: 700; text-align: center; line-height: 1; }
.queue-content .patient-name { font-size: 1.5em; text-align: center; margin-top: 10px; font-weight: 500;}
.queue-content .queue-actions { margin-top: 20px; display: flex; justify-content: center; gap: 10px; }
.queue-content .empty-queue { font-size: 1.2em; text-align: center; opacity: 0.7; padding: 30px 0; }
.waiting-list-container { grid-column: 1 / -1; }
#waiting-list-content { display: flex; flex-wrap: wrap; gap: 10px; }
.waiting-item { background-color: #f8f9fa; border: 1px solid var(--border-color); padding: 10px 15px; border-radius: 5px; font-weight: 500; }
#no-doctor-selected { text-align: center; padding: 40px; font-size: 1.2em; color: #888;}

/* Filter Container */
.filter-container {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border: 1px solid #ddd;
}
.filter-container .form-group {
    margin-bottom: 0;
}
.filter-container input[type="date"] {
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 500;
    color: white;
    font-size: 12px;
}
.status-selesai { background-color: #28a745; }
.status-dipanggil { background-color: #007bff; }
.status-menunggu { background-color: #ffc107; color: #333; }
.status-dilewati { background-color: #dc3545; }
.status-booked { background-color: #6c757d; }
.status-followup_sent { background-color: #6c757d; }

/* Gaya untuk tombol logout baru */
.btn-logout {
    background-color: #d9534f; /* Warna merah seperti tombol hapus */
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.3s;
}

.btn-logout:hover {
    background-color: #c9302c; /* Warna merah lebih gelap saat hover */
    color: white;
}

.btn-logout .fas {
    margin-right: 8px;
}

/* --- Dashboard Styles --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px;
    margin-top: 25px;
}

.dashboard-card {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.dashboard-card h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.dashboard-card h4 {
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.dashboard-card h4 .fas, .dashboard-card h4 .fab {
    margin-right: 10px;
    color: var(--primary-color);
}

.instruction-list {
    list-style: none;
    padding: 0;
    line-height: 1.8;
}

.instruction-list li {
    margin-bottom: 10px;
}

.instruction-list .fa-fw {
    margin-right: 8px;
    color: #888;
}

.whatsapp-info {
    text-align: center;
}

.whatsapp-number {
    font-size: 1.8em;
    font-weight: 700;
    color: #25D366;
    background-color: #f0f0f0;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    letter-spacing: 2px;
}

.whatsapp-format {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.4em;
    font-weight: 600;
    background-color: #e9ecef;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    color: var(--dark-color);
}

.whatsapp-info .small-text {
    font-size: 0.9em;
    color: #888;
    margin-top: 15px;
}

/* --- User Menu Dropdown Styles --- */
.user-menu {
    position: relative; /* Diperlukan untuk posisi dropdown */
}

.user-menu-toggle {
    background-color: #f8f9fa;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 8px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.user-menu-toggle .fa-user-circle {
    font-size: 1.2em;
    color: var(--primary-color);
}

.user-menu-toggle .fa-chevron-down {
    font-size: 0.8em;
}

.user-menu-dropdown {
    display: none; /* Sembunyi secara default */
    position: absolute;
    top: 110%; /* Posisi di bawah tombol */
    right: 0;
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 200px;
    z-index: 100;
    overflow: hidden;
}

.user-menu-dropdown.show {
    display: block; /* Tampilkan saat class 'show' ditambahkan */
}

.user-menu-dropdown a {
    display: block;
    padding: 12px 15px;
    color: var(--dark-color);
    text-decoration: none;
    transition: background-color 0.2s;
}

.user-menu-dropdown a:hover {
    background-color: #f8f9fa;
}

.user-menu-dropdown a .fa-fw {
    margin-right: 10px;
    color: #888;
}

/* --- Admin Layout (Desktop) --- */
.admin-wrapper {
    display: flex;
}

.sidebar {
    width: 260px;
    background-color: var(--dark-color);
    color: var(--white-color);
    flex-shrink: 0; /* Mencegah sidebar menyusut */
}

.main-content {
    flex-grow: 1; /* Mengisi sisa ruang */
    display: flex;
    flex-direction: column;
}

/* Sembunyikan tombol hamburger di desktop */
.sidebar-toggle-btn {
    display: none;
}

/* Sembunyikan overlay di desktop */
#sidebar-overlay {
    display: none;
}

/* --- Responsive Styles (Mobile & Tablet) --- */
@media (max-width: 992px) {
    /* Saat sidebar aktif, tampilkan */
    body.sidebar-active .sidebar {
        transform: translateX(0);
    }
    
    body.sidebar-active #sidebar-overlay {
        display: block;
    }

    /* Atur sidebar agar bisa meluncur */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 1002;
        transform: translateX(-100%); /* Sembunyikan di luar layar */
        transition: transform 0.3s ease-in-out;
        box-shadow: 0 0 15px rgba(0,0,0,0.2);
    }

    /* Konten utama mengisi layar penuh */
    .main-content {
        width: 100%;
    }

    /* Tampilkan tombol hamburger */
    .sidebar-toggle-btn {
        display: block !important;
        background: none;
        border: none;
        font-size: 24px;
        color: var(--dark-color);
        cursor: pointer;
        margin-right: 15px;
    }

    /* Tampilkan overlay saat sidebar terbuka */
    #sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1001;
    }
}