:root {
    --primary: #ee4d2d;
    --primary-dark: #d03e1f;
    --secondary: #26aa99;
    --dark: #2c3e50;
    --light: #f8f9fa;
    --grey: #6c757d;
    --border: #e9ecef;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --radius: 10px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    color: var(--dark);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

h1, h2, h3 { 
    font-family: 'Poppins', sans-serif; 
    margin: 0; 
    color: var(--dark); 
}

/* --- Navbar --- */
.navbar {
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
}

.brand-icon { 
    font-size: 1.5rem; 
    color: var(--primary); 
}

.nav-brand h1 { 
    font-size: 1.2rem; 
    font-weight: 700; 
}

.badge {
    font-size: 0.65rem; 
    padding: 2px 6px; 
    border-radius: 4px;
    font-weight: 700; 
    text-transform: uppercase; 
    margin-left: 5px; 
    vertical-align: middle;
}

.badge-free { 
    background: #e2e8f0; 
    color: #475569; 
}

.badge-pro { 
    background: #ffc107; 
    color: #000; 
}

.nav-info { 
    display: flex; 
    gap: 15px; 
    font-size: 0.85rem; 
    color: var(--grey); 
}

.info-item { 
    display: flex; 
    align-items: center; 
    gap: 5px; 
}

/* --- Main Container --- */
.container {
    max-width: 1200px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    background: white;
    border-radius: var(--radius);
    margin-bottom: 25px;
    border: 1px dashed var(--border);
}

.empty-state i {
    color: var(--grey);
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--dark);
}

.empty-state p {
    color: var(--grey);
    font-size: 0.9rem;
}

/* --- Control Panel Grid --- */
.control-panel-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0,0,0,0.03);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.card-header h2 { 
    font-size: 1rem; 
    font-weight: 600; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

/* --- Guide Card --- */
.guide-body { 
    padding: 25px; 
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    margin-bottom: 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.video-wrapper iframe { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
}

.steps-list details { 
    font-size: 0.9rem; 
}

.steps-list summary { 
    cursor: pointer; 
    color: var(--primary); 
    font-weight: 500; 
}

/* --- Upload Card --- */
.upload-body {
    padding: 50px; /* Kurangi padding dari 25px menjadi 20px */
    display: flex;
    flex-direction: column; /* Ubah jadi column agar langkah di atas, upload di bawah */
    align-items: center;
    justify-content: flex-start; /* Mulai dari atas */
    height: 100%;
    gap: 12px; /* Beri jarak antar elemen */
}

.upload-compact-wrapper {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    text-align: center;
}

.file-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 10px;
    padding: 15px; /* Kurangi padding dari 20px menjadi 15px */
    background: #f8fafc;
    position: relative;
    transition: 0.3s;
    margin-bottom: 10px; /* Kurangi margin dari 15px menjadi 10px */
}

.file-drop-zone:hover { 
    border-color: var(--primary); 
    background: #fff5f2; 
}

.file-drop-zone i { 
    color: var(--grey); 
    margin-bottom: 8px; 
}

.file-drop-zone p { 
    margin: 5px 0 0; 
    font-size: 0.85rem; 
    color: #64748b; 
}

.file-drop-zone input {
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    opacity: 0; 
    cursor: pointer;
}

.status-text { 
    font-size: 0.8rem; 
    margin-bottom: 10px; /* Kurangi dari 15px */
    color: var(--grey); 
    font-style: italic; 
}

.action-buttons-compact {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 8px 16px; 
    border-radius: 6px; 
    border: none; 
    font-weight: 600;
    cursor: pointer; 
    transition: 0.2s; 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px;
    font-size: 0.9rem;
}

.btn-primary { 
    background: var(--primary); 
    color: white; 
    width: 100%; 
}

.btn-primary:hover:not(:disabled) { 
    background: var(--primary-dark); 
}

.btn-primary:disabled { 
    background: #cbd5e1; 
    cursor: not-allowed; 
}

.secondary-actions { 
    display: flex; 
    gap: 8px; 
    justify-content: center; 
}

.btn-outline { 
    background: transparent; 
    border: 1px solid #cbd5e1; 
    color: var(--dark); 
    flex: 1; 
}

.btn-danger { 
    background: #fee2e2; 
    color: #ef4444; 
    border: 1px solid #fecaca; 
    flex: 1; 
}

/* --- KPI Cards --- */
.kpi-flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.kpi-card {
    background: white;
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid rgba(0,0,0,0.03);
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.08);
}

.kpi-card.top-row {
    flex: 1 1 18%;
    min-width: 160px;
}

.kpi-card.bottom-row {
    flex: 1 1 30%; 
    min-width: 200px;
    background-color: #fdfdfd;
}

.icon-box {
    width: 40px; 
    height: 40px; 
    border-radius: 8px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 1.1rem; 
    flex-shrink: 0;
}

.icon-box.blue { background: #e0f2fe; color: #0284c7; }
.icon-box.green { background: #dcfce7; color: #16a34a; }
.icon-box.orange { background: #ffedd5; color: #ea580c; }
.icon-box.purple { background: #f3e8ff; color: #9333ea; }
.icon-box.red { background: #fee2e2; color: #dc2626; }
.icon-box.teal { background: #ccfbf1; color: #0d9488; }
.icon-box.yellow { background: #fef9c3; color: #ca8a04; }
.icon-box.indigo { background: #e0e7ff; color: #4f46e5; }

.kpi-info h3 { 
    font-size: 0.75rem; 
    color: var(--grey); 
    font-weight: 500; 
    margin-bottom: 2px; 
}

.kpi-info p { 
    font-size: 1.1rem; 
    font-weight: 700; 
    color: var(--dark); 
    line-height: 1.2; 
}

.kpi-info .small-val { 
    font-size: 0.95rem; 
}

/* --- Heatmap Section (PERBAIKAN UTAMA) --- */
.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 0.85rem;
    color: var(--grey);
    padding: 0 5px;
}

.legend-dot { 
    display: inline-block; 
    width: 20px; 
    height: 20px; 
    border-radius: 50%; 
    margin: 0 4px 0 8px; 
    vertical-align: middle;
    position: relative;
    top: 5px;
}

.legend-dot.red { background: #fee2e2; }
.legend-dot.white { background: #fff; border: 1px solid #ccc; }
.legend-dot.green { background: #dcfce7; }


.table-responsive-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.heatmap-table-wrapper {
    padding: 4px;
}

.heatmap-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 700px; /* Agar tetap rapi di layar kecil */
}

.heatmap-table th, .heatmap-table td {
    border: 1px solid #eee;
    padding: 12px 8px; /* Padding diperbesar agar tidak mepet */
    text-align: center;
    font-size: 0.9rem;
    white-space: nowrap;
}

.heatmap-table th {
    background-color: #f8fafc;
    font-weight: 600;
    color: var(--dark);
}

.heatmap-table td:first-child {
    background-color: #f8fafc;
    font-weight: 500;
}

.highlight-cell-green { 
    background-color: #dcfce7; 
    color: #14532d; 
    font-weight: bold; 
}

.highlight-cell-red { 
    background-color: #fee2e2; 
    color: #7f1d1d; 
}

/* Gradasi untuk heatmap yang lebih halus */
.heatmap-table td.highlight-cell-green[data-intensity="high"] {
    background-color: #bbf7d0;
}

.heatmap-table td.highlight-cell-red[data-intensity="high"] {
    background-color: #fecaca;
}

/* --- Chart Cards (PERBAIKAN) --- */
.chart-card .card-body {
    padding: 15px;
}

.chart-content {
    padding: 5px;
}

/* --- Tables Styling (PERBAIKAN) --- */
.table-scroll-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.table-scroll-wrapper.medium-height {
    max-height: 400px;
    overflow-y: auto;
}

.table-scroll-wrapper.short {
    max-height: 300px;
    overflow-y: auto;
}

.scroll-hint { 
    text-align: center; 
    font-size: 0.75rem; 
    color: var(--grey); 
    margin-top: 8px; 
}

/* Modern Table Styling */
.modern-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 0.9rem;
}

.modern-table th {
    background: #f8fafc; 
    padding: 12px 15px; /* Padding diperbesar */
    text-align: left;
    font-weight: 600; 
    position: sticky; 
    top: 0; 
    z-index: 5;
    border-bottom: 2px solid var(--border);
}

.modern-table td { 
    padding: 10px 15px; /* Padding diperbesar */
    border-bottom: 1px solid var(--border);
}

.modern-table tbody tr:hover {
    background-color: #f8fafc;
    cursor: pointer;
}

.text-center { 
    text-align: center; 
}

.text-right { 
    text-align: right; 
}

/* --- Grid 2 Column --- */
.grid-2-col {
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    margin-bottom: 20px;
}

/* --- Search Inputs --- */
.search-bar { 
    position: relative; 
    margin-bottom: 15px; 
}

.search-bar input { 
    width: 100%; 
    padding: 10px 10px 10px 35px; 
    border: 1px solid #cbd5e1; 
    border-radius: 6px; 
    box-sizing: border-box;
    font-size: 0.9rem;
}

.search-bar i { 
    position: absolute; 
    left: 12px; 
    top: 12px; 
    color: var(--grey); 
    font-size: 0.9rem; 
}

.mini-search { 
    width: 100%; 
    padding: 8px 10px; 
    margin-bottom: 12px; 
    border: 1px solid #cbd5e1; 
    border-radius: 4px; 
    box-sizing: border-box;
    font-size: 0.9rem;
}

/* --- Raw Data Table --- */
.raw-table-container { 
    max-height: 350px; 
    overflow: auto; 
    border: 1px solid var(--border); 
    border-radius: 8px; 
}

.modern-table.striped tbody tr:nth-child(even) { 
    background-color: #fafafa; 
}

/* --- PRO Styles --- */
/* PRO Styles - Perbaikan */
.pro-only {
    position: relative; /* PENTING: Ini yang membuat overlay bisa diposisikan di dalam card */
}
.pro-only .pro-content-blur { 
    filter: blur(4px); 
    pointer-events: none; 
    user-select: none; 
    opacity: 0.8; /* Sedikit transparan agar overlay lebih terlihat */
    transition: all 0.2s;
}

.pro-overlay {
    position: absolute; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    z-index: 20; /* Lebih tinggi dari konten */
    cursor: pointer;
    background-color: rgba(255, 255, 255, 0.3); /* Latar semi transparan */
    backdrop-filter: blur(2px); /* Efek blur tambahan */
}

.pro-overlay-inner {
    background: white; 
    padding: 12px 24px; 
    border-radius: 40px;
    font-weight: bold; 
    color: var(--primary); 
    border: 2px solid var(--primary); 
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(238, 77, 45, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pro-overlay-inner i {
    font-size: 1.1rem;
}

/* Saat di-hover */
.pro-overlay:hover .pro-overlay-inner {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
    transition: all 0.2s;
}

/* Mode PRO - Sembunyikan overlay */
body.is-pro .pro-content-blur { 
    filter: none !important; 
    pointer-events: auto !important; 
    opacity: 1 !important;
}

body.is-pro .pro-overlay { 
    display: none !important; 
}

/* --- Modal --- */
.modal { 
    display: none; 
    position: fixed; 
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.5); 
    z-index: 1000; 
}

.modal-content { 
    background: white; 
    margin: 5% auto; 
    width: 90%; 
    max-width: 600px; 
    border-radius: 10px; 
    padding: 20px; 
}

.modal-header { 
    display: flex; 
    justify-content: space-between; 
    margin-bottom: 15px; 
    border-bottom: 1px solid #eee; 
    padding-bottom: 10px; 
}

.close-btn { 
    cursor: pointer; 
    font-size: 1.2rem; 
}

.full-width-btn { 
    display: block; 
    text-align: center; 
    text-decoration: none; 
    padding: 10px; 
    border-radius: 6px; 
    margin-top: 15px; 
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 20px;
    color: var(--grey);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 30px;
}

/* --- Responsive Design (PERBAIKAN UNTUK MOBILE) --- */
@media (max-width: 1024px) {
    .kpi-card.top-row {
        flex: 1 1 30%;
    }
    
    .kpi-card.bottom-row {
        flex: 1 1 45%;
    }
}

@media (max-width: 768px) {
    .control-panel-grid, 
    .grid-2-col { 
        grid-template-columns: 1fr; 
    }
    
    .kpi-card.top-row, 
    .kpi-card.bottom-row { 
        flex: 1 1 100%; 
    }
    
    .nav-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .nav-info {
        width: 100%;
        justify-content: center;
    }
    
    .heatmap-table th, 
    .heatmap-table td {
        padding: 8px 5px;
        font-size: 0.8rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }
    
    .card-header {
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .card-header h2 {
        justify-content: center;
    }
    
    .video-wrapper {
        margin-bottom: 10px;
    }
    
    .upload-body {
        padding: 15px;
    }
    
    .kpi-card {
        padding: 12px;
    }
    
    .modern-table th,
    .modern-table td {
        padding: 8px 10px;
    }
}

/* --- Print Styles --- */
@media print {
    .navbar,
    .control-panel-grid,
    .pro-overlay,
    .btn,
    footer {
        display: none !important;
    }
    
    body {
        background: white;
        padding: 20px;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
    
    .pro-content-blur {
        filter: none !important;
    }
}

/* Steps List Compact untuk Upload Card */
.steps-list-compact {
    background: #f8fafc;
    border-radius: 8px;
    padding: 10px 15px; /* Kurangi padding vertical */
    margin-bottom: 0; /* Hapus margin-bottom */
    border-left: 3px solid var(--primary);
    font-size: 0.85rem;
    width: 100%; /* Full width */
    max-width: 320px; /* Sama dengan upload wrapper */
    box-sizing: border-box;
}

.steps-list-compact ol {
    margin: 0;
    padding-left: 20px;
}

.steps-list-compact li {
    margin-bottom: 4px; /* Kurangi margin */
    color: var(--dark);
}

.steps-list-compact li:last-child {
    margin-bottom: 0;
}

.btn-locked {
    opacity: 0.5;
    cursor: not-allowed;
}