/* app/static/css/style.css */

/* --- Variabel Warna & Font --- */
:root {
    --primary-color: #4e73df; /* Biru Indigo Profesional */
    --secondary-color: #858796;
    --sidebar-bg: #ffffff;
    --sidebar-width: 240px;
    --body-bg: #f8f9fc; /* Latar belakang abu-abu sangat terang */
    --text-dark: #3a3b45;
    --text-light: #f8f9fa;
    --border-color: #e3e6f0;
    --card-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-dark);
    font-size: 0.9rem;
}

/* --- Layout Utama dengan Sidebar --- */
#wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

#sidebar-wrapper {
    width: var(--sidebar-width);
    min-height: 100vh;
    background-color: var(--sidebar-bg);
    box-shadow: var(--card-shadow);
    transition: margin-left 0.3s ease-in-out;
    z-index: 1000;
}

#sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 900;
}

#sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#page-content-wrapper {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.content-fluid {
    flex-grow: 1;
    padding: 1.5rem;
}

/* --- State Sidebar Tersembunyi (Toggled) --- */
#wrapper.toggled #sidebar-wrapper {
    margin-left: calc(-1 * var(--sidebar-width));
}

/* --- Sidebar Styling --- */
.sidebar-heading {
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
}
.sidebar-heading .logo {
    height: 30px;
    margin-right: 0.5rem;
}

.list-group-item {
    background-color: transparent;
    border: none;
    color: var(--text-dark);
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    border-left: 4px solid transparent;
}

.list-group-item:hover, .list-group-item.active {
    background-color: var(--body-bg);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.list-group-item i {
    margin-right: 0.75rem;
    width: 20px;
    text-align: center;
    color: var(--secondary-color);
}
.list-group-item:hover i, .list-group-item.active i {
    color: var(--primary-color);
}

/* Dropdown di Sidebar */
.sidebar-dropdown .dropdown-menu {
    background-color: transparent;
    border: none;
    padding: 0;
    margin-left: 2.75rem;
}
.sidebar-dropdown .dropdown-item {
    color: var(--text-dark);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
}
.sidebar-dropdown .dropdown-item:hover {
    background-color: var(--body-bg);
    color: var(--primary-color);
}

/* --- Topbar (Navbar di atas konten) --- */
.topbar {
    background-color: #fff;
    box-shadow: var(--card-shadow);
    padding: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
}

#sidebarToggle {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

/* --- Konten Lainnya --- */
.card {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: var(--card-shadow);
}
.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--primary-color);
    padding: 0.75rem 1.25rem;
}
.footer {
    background-color: #fff;
    border-top: 1px solid var(--border-color);
    padding: 1rem 0;
}

/* --- Form (PERBAIKAN) --- */
.form-label {
    font-weight: 500;
    color: #3a3b45; /* Warna teks gelap agar terlihat di latar belakang terang */
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 0.35rem;
    color: #6e707e;
    border-color: #d1d3e2;
    background-color: #ffffff; /* Pastikan latar belakang input putih */
}

.form-control:focus, .form-select:focus {
    color: #495057;
    background-color: #fff;
    border-color: #8c9fde;
    box-shadow: 0 0 0 0.25rem rgba(78, 115, 223, 0.25);
}

/* --- Tabel --- */
.table {
    --bs-table-bg: #ffffff;
    --bs-table-striped-bg: #f8f9fc;
    color: var(--text-dark); /* Menggunakan warna teks utama */
}

.table th {
    background-color: #eaecf4;
    font-weight: 600;
    color: #5a5c69;
}

.table td {
    vertical-align: middle;
}

.camera-feed-container {
    width: 100%;
    border-radius: 0.75rem;
    overflow: hidden;
    background: #0f172a;
}

.camera-feed-container img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: cover;
}

.camera-capture-card {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.9rem;
    background: #fff;
}

.camera-preview {
    width: 100%;
    max-height: 360px;
    border-radius: 0.6rem;
    background: #111827;
    object-fit: cover;
}

/* --- Media Queries untuk Responsivitas --- */
@media (max-width: 768px) {
    body {
        font-size: 0.85rem;
    }

    #sidebar-wrapper {
        width: min(86vw, var(--sidebar-width));
        margin-left: calc(-1 * var(--sidebar-width));
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.22);
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }

    .topbar {
        padding: 0.65rem 0.85rem;
        margin-bottom: 1rem;
    }

    .content-fluid {
        padding: 1rem 0.8rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .main-title {
        font-size: 1.35rem;
        line-height: 1.25;
    }

    .camera-feed-container img {
        max-height: 52vh;
    }

    .camera-preview {
        max-height: 300px;
    }
}

@media (max-width: 576px) {
    .btn.btn-lg {
        font-size: 0.95rem;
        padding: 0.55rem 0.8rem;
    }

    .status-indicator {
        width: 100%;
        text-align: center;
    }
}
