/* --- Reset & Global --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --sidebar-bg: #111827; /* Dark Gray */
    --sidebar-text: #d1d5db; /* Light Gray */
    --sidebar-hover-bg: #374151; /* Medium Gray */
    --sidebar-active-bg: #1d4ed8; /* Blue */
    --content-bg: #f3f4f6; /* Off-white */
    --text-primary: #1f2937; /* Darker Gray */
    --text-secondary: #6b7280; /* Medium Gray */
    --border-color: #e5e7eb; /* Light border */
    --white: #ffffff;
    --blue: #3b82f6;
    --green: #10b981;
    --yellow: #f59e0b;
    --red: #ef4444;
    --black: #111827;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--content-bg);
    color: var(--text-primary);
}

/* --- Layout Dashboard --- */
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

#sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100%;
    display: flex;
    flex-direction: column;
}

#main-content {
    margin-left: 260px;
    flex-grow: 1;
    padding: 2rem;
    min-height: calc(100vh - 6rem); /* Adjusted for header and padding */
}

/* --- Sidebar --- */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--sidebar-hover-bg);
}

.sidebar-header h3 {
    color: var(--white);
    text-align: center;
    font-size: 1.25rem;
}

.sidebar-nav {
    flex-grow: 1; /* Allows this element to grow and fill available space */
    overflow-y: auto; /* Enables vertical scrolling only when needed */
    padding: 0.5rem 0; /* Reduced padding */
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem; /* Reduced vertical padding */
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background-color: var(--sidebar-hover-bg);
    color: var(--white);
}

.nav-link.active {
    background-color: var(--sidebar-active-bg);
    color: var(--white);
}

.nav-link .icon {
    margin-right: 1rem;
    font-size: 1.2rem;
}

/* --- Main Content --- */
.main-header {
    margin-bottom: 2rem;
}

#main-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}



.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
}

/* --- Kartu Statistik Dashboard --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
}

#stat-total-penyulang {
    cursor: pointer;
}

.stat-card .icon {
    font-size: 2rem;
    padding: 1rem;
    border-radius: 50%;
    margin-right: 1rem;
    color: var(--white);
}

.stat-card .stat-info h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-info p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}


/* --- Komponen UI --- */
.btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--blue);
    color: var(--white);
}

.btn-primary:hover { background-color: #2563eb; }

.btn-secondary {
    background-color: #6b7280;
    color: var(--white);
}

.btn-secondary:hover { background-color: #4b5563; }

.btn-edit {
    background-color: var(--yellow);
    color: var(--white);
}

.btn-edit:hover { background-color: #d97706; }

/* --- Tampilan Tabel (Pengganti Kartu) --- */

/* --- Tampilan Grid Kartu (Dashboard) --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-content {
    padding: 1.5rem;
    flex-grow: 1;
    cursor: pointer;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.card-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.card-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background-color: #f9fafb;
    padding: 0.75rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.card-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

.table-container {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}

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

thead {
    background-color: #f9fafb;
}

th, td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

tbody tr:hover { background-color: #f9fafb; }

/* Indikator Warna */
.indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.indicator-green { background-color: var(--green); }
.indicator-yellow { background-color: var(--yellow); }
.indicator-red { background-color: var(--red); }
.indicator-black { background-color: var(--black); }
.indicator-gray { background-color: #9ca3af; }

/* Card Status Backgrounds */
.card-status-green { background-color: #d1fae5; } /* Light green */
.card-status-yellow { background-color: #fef3c7; } /* Light yellow */
.card-status-red { background-color: #fee2e2; } /* Light red */
.card-status-black { background-color: #e5e7eb; } /* Light gray for Kritis/Black */
.card-status-gray { background-color: #f3f4f6; } /* Even lighter gray for Belum Ada Data/Gray */


/* --- Formulir --- */
.form-container {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
}

/* --- Detail View --- */
.detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.detail-info, .detail-chart-container {
    background-color: var(--white);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.detail-info p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.detail-info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.back-button {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}

.back-button:hover { color: var(--text-primary); }

/* Notifikasi */
.notification {
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 5px;
    text-align: center;
}

.notification.success {
    background-color: #d1fae5;
    color: #065f46;
}

.notification.error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Flash Messages */
.flash-messages {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.flash-messages li {
    padding: 12px 20px;
    margin-bottom: 10px;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
}

.flash-messages .success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.flash-messages .danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.flash-messages .info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Logout Button in Sidebar */
.logout-btn {
    display: block;
    width: calc(100% - 3rem); /* Adjust for padding */
    margin: 1rem 1.5rem;
    padding: 0.75rem 1.5rem;
    background-color: #dc3545; /* Red */
    color: white;
    text-align: center;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.logout-btn:hover {
    background-color: #c82333;
}

/* --- Kursor untuk Kartu Status Dashboard --- */
.status-summary-card {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.status-summary-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

/* --- Report Image Styling --- */
.report-image {
    width: 170px;
    height: 170px;
    object-fit: cover; /* Ensures the image covers the area without distortion */
    border-radius: 4px;
    display: block; /* Remove extra space below image */
    margin: 0 auto; /* Center the image if it's in a block element */
    border: 1px solid var(--border-color);
}

/* Submenu styles */
.nav-link.has-submenu {
    position: relative;
}

.nav-link .arrow {
    margin-left: auto;
    transition: transform 0.2s;
}

.nav-link.has-submenu.active .arrow {
    transform: rotate(180deg); /* For dropdown arrow */
}

.submenu {
    display: none; /* Hidden by default */
    background-color: #1f2937; /* Slightly darker than sidebar-bg */
    padding-left: 1.5rem;
}

.submenu.show {
    display: block;
}

.submenu-item {
    padding-left: 2.5rem; /* Indent submenu items */
    font-size: 0.85rem;
}

/* Arrow for nested submenu */
.submenu-item.has-submenu .arrow {
    transform: rotate(90deg); /* For right-pointing arrow */
}

.submenu-item.has-submenu.active .arrow {
    transform: rotate(180deg); /* For down-pointing arrow */
}

/* --- Styles for Dynamically Injected Forms (from input_riwayat.css) --- */

.input-form h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 90px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.submit-btn {
    width: 100%;
    padding: 0.8rem 1.5rem;
    background-color: var(--green);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.submit-btn:hover {
    background-color: #059669;
}

.aux-btn {
    width: 100%;
    padding: 0.7rem 1.5rem;
    background-color: var(--text-secondary);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-align: center;
}

.aux-btn:hover {
    background-color: #4b5563;
}

.status-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    display: none; /* Hidden by default */
}

.status-message.success {
    background-color: #d1fae5;
    color: #065f46;
    display: block;
}

.status-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    display: block;
}

.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.button-group .btn {
    flex-grow: 1;
}

/* --- Overlay Styles --- */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.show {
    opacity: 1;
    visibility: visible;
}

.overlay-content {
    background-color: var(--white);
    padding: 2rem 3rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.overlay.show .overlay-content {
    transform: scale(1);
}

.overlay-content p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.overlay-content button {
    padding: 0.7rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    background-color: var(--blue);
    color: var(--white);
    transition: background-color 0.2s;
}

.overlay-content button:hover {
    background-color: #2563eb;
}

/* --- Toast Notification --- */
.toast-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    background-color: var(--sidebar-bg);
    color: var(--white);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notification.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-notification.toast-success {
    background-color: var(--green);
}

.toast-notification.toast-error {
    background-color: var(--red);
}

/* --- Improved Sidebar Header --- */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
   /*  margin-bottom: 1.5rem; --- */
}
.sidebar-logo {
    font-size: 2rem;
}
.sidebar-brand h3 {
    color: var(--white);
    font-size: 1.25rem;
    text-align: left; /* Override previous center alignment */
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: var(--sidebar-hover-bg);
    padding: 12px;
    border-radius: 8px;
}
.user-avatar {
    font-size: 1.5rem;
    background-color: var(--text-secondary);
    color: var(--white);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
}
.user-details {
    display: flex;
    flex-direction: column;
}
.user-name {
    font-weight: 600;
    color: var(--white);
}
.user-role {
    font-size: 0.8rem;
    color: var(--sidebar-text);
    text-transform: capitalize;
}

