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

:root {
    --background: #f8fafc;
    --foreground: #020817;
    --card: #ffffff;
    --border: #e2e8f0;
    --primary: #16a34a;
    --primary-hover: #15803d;
    --hover-amber: #f59e0b;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --danger: #ef4444;
    --radius: 0.5rem;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    height: 100vh;
    display: flex;
    font-size: 0.875rem;
    overflow: hidden;
}

/* LAYOUT */
.layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 260px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100%;
    flex-shrink: 0;
}

.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.top-header {
    height: 64px;
    background: white;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    flex-shrink: 0;
}

.content-body {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: var(--background);
}

/* SIDEBAR COMPONENTS */
.sidebar-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: #0f172a;
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-name {
    font-weight: 700;
    font-size: 1.1rem;
    color: #0f172a;
}

.sidebar-menu {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.menu-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    color: #475569;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    background-color: transparent;
    font-size: 0.9rem;
}

.nav-item:hover:not(.active) {
    background-color: var(--hover-amber);
    color: white;
    transform: translateX(4px);
}

.nav-item.active {
    background-color: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.3);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* HEADER RIGHT */
.user-mini {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    transition: background 0.2s;
}

.user-mini:hover {
    background-color: var(--muted);
}

.user-info .name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--foreground);
    margin: 0;
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin: 0;
}

.avatar {
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #64748b;
    border: 1px solid var(--border);
}

/* CARDS & GRID */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
    width: 100%;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.card-header2 {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    border-top: 1px solid var(--border);
    margin-top: -1px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #0f172a;
    margin: 0;
}

.card-sub {
    font-size: 0.85rem;
    color: #64748b;
    margin-top: 4px;
}

.card-body {
    padding: 1.5rem;
}

.card-body2 {
    padding: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media(max-width: 1200px) {
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width: 768px) {

    .grid-4,
    .grid-2 {
        grid-template-columns: 1fr;
    }

    /* Mobile Sidebar Logic */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        width: 100%;
    }

    .top-header {
        padding: 0 1rem;
    }

    /* Hamburger Menu */
    .mobile-menu-btn {
        display: flex !important;
    }

    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 40;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: all;
    }
}

.mobile-menu-btn {
    display: none;
    margin-right: 1rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #475569;
}

/* FORM ELEMENTS */
label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #334155;
}

input,
select,
textarea {
    width: 100%;
    height: 42px;
    padding: 0 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    background: white;
    color: #0f172a;
    font-size: 0.875rem;
    transition: all 0.2s;
}

textarea {
    height: auto;
    min-height: 100px;
    padding: 0.75rem;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.2);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}

/* DASHBOARD FILTERS (Updated Layout) */
.dashboard-filters {
    display: flex;
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    align-items: flex-end;
}

.filter-item {
    flex: 1;
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: white;
    border-color: #cbd5e1;
    color: #334155;
}

.btn-outline:hover {
    background: #f1f5f9;
}

.btn-ghost {
    background: transparent;
    color: #334155;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-sm {
    height: 32px;
    font-size: 0.75rem;
    padding: 0 0.75rem;
}

.btn-icon {
    width: 40px;
    padding: 0;
}

/* STATS */
.stat-card {
    padding: 1.25rem;
}

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

.stat-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
}

.stat-desc {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}

.text-green {
    color: var(--primary);
}

.text-red {
    color: #ef4444;
}

/* TABLE */
.table-container {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th {
    text-align: left;
    padding: 1rem;
    background: #f8fafc;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    color: #64748b;
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    color: #334155;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.35rem 0.8rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.bg-green {
    background: #dcfce7;
    color: #15803d;
}

.bg-yellow {
    background: #fef9c3;
    color: #a16207;
}

.bg-red {
    background: #fee2e2;
    color: #b91c1c;
}

.export-area {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed #cbd5e1;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* QUESTIONNAIRE (Fix Validasi Form) */
.radio-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.radio-opt {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    transition: 0.2s;
    font-weight: 500;
    position: relative;
}

.radio-opt:has(input:checked) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* CRITICAL FIX: Opacity 0 agar tetap bisa divalidasi 'required', jangan display none */
.radio-opt input {
    opacity: 0;
    position: absolute;
    inset: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    margin: 0;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-box {
    background: #eff6ff;
    color: #1e40af;
    padding: 1rem;
    border-radius: var(--radius);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* UTILS */
.hidden {
    display: none !important;
}

.w-auto {
    width: auto !important;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    backdrop-filter: blur(2px);
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    transform: translateY(10px);
    transition: transform 0.2s;
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: white;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--foreground);
    font-weight: 500;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--border);
    font-size: 0.875rem;
}

/* Update CSS untuk Modal agar lebih Lebar */
.modal {
    background: white;
    width: 90%;
    /* Lebar 90% dari layar */
    max-width: 1000px;
    /* Maksimal 1000px (Wide) */
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    /* Supaya tidak melebihi tinggi layar */
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    /* Scroll jika konten panjang */
}

/* Layout Grid untuk Modal (Kiri: Teks, Kanan: Grafik) */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Bagi 2 kolom rata */
    gap: 24px;
}

/* Responsif: Jika di HP, jadi 1 kolom ke bawah */
@media (max-width: 768px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 5px;
    margin-top: 15px;
}

.section-title:first-child {
    margin-top: 0;
}

/* Custom Searchable Dropdown */
.custom-select-container {
    position: relative;
}

.custom-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #cbd5e1;
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    box-shadow: var(--shadow);
    display: none;
}

.custom-dropdown-list.show {
    display: block;
}

.custom-dropdown-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s;
    border-bottom: 1px solid #f1f5f9;
}

.custom-dropdown-item:last-child {
    border-bottom: none;
}

.custom-dropdown-item:hover {
    background-color: #f1f5f9;
}

.custom-dropdown-item .sub-text {
    font-size: 0.75rem;
    color: #64748b;
}