/* Base & Reset */
* { box-sizing: border-box; font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
body { margin: 0; background-color: #f3f4f6; color: #1f2937; height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

/* Navbar */
.top-navbar { background: #2563eb; padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; color: white; box-shadow: 0 2px 4px rgba(0,0,0,0.1); z-index: 10; }
.nav-brand { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.nav-brand span { font-weight: 400; font-size: 14px; opacity: 0.9; margin-left: 10px; }
.analyze-btn { background: white; color: #2563eb; border: none; padding: 8px 16px; border-radius: 6px; font-weight: 600; cursor: pointer; transition: 0.2s; }
.analyze-btn:hover { background: #f8fafc; transform: scale(1.02); }

/* Main Layout */
.main-layout { display: flex; height: calc(100vh - 55px); width: 100%; transition: all 0.3s ease; }

/* Left Panel (Kertas Word) */
.left-panel { flex: 1; padding: 40px; overflow-y: auto; display: flex; flex-direction: column; align-items: center; transition: all 0.3s ease; }
.page-container { background: white; width: 100%; max-width: 800px; min-height: 800px; padding: 60px 80px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); border-radius: 4px; border: 1px solid #e5e7eb; }
.editor-input { width: 100%; min-height: 500px; font-size: 16px; line-height: 2; color: #334155; outline: none; white-space: pre-wrap; word-wrap: break-word; font-family: "Times New Roman", Times, serif; }
.editor-input:empty:before { content: attr(data-placeholder); color: #94a3b8; pointer-events: none; }

/* Highlight Sesuai Mockup (Blok Oranye/Kuning Transparan) */
.highlight-collocation { background-color: #fde047; padding: 2px 4px; border-radius: 3px; cursor: pointer; transition: 0.2s; border-bottom: 2px solid transparent; }
.highlight-collocation:hover { border-bottom: 2px solid #ca8a04; }

/* Diagnostic Popup Sesuai Mockup */
.popup-hidden { display: none !important; }
.diagnostic-popup { position: absolute; width: 320px; background: white; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.15); border: 1px solid #e2e8f0; z-index: 1000; font-family: "Segoe UI", sans-serif; }
.popup-header { display: flex; justify-content: space-between; padding: 10px 15px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; border-radius: 8px 8px 0 0; }
.popup-body { display: flex; padding: 15px; gap: 12px; }
.popup-icon { font-size: 24px; }
.popup-content h4 { margin: 0 0 5px 0; font-size: 15px; color: #0f172a; }
.popup-content p { margin: 0; font-size: 12px; color: #475569; line-height: 1.4; }
.popup-actions { display: flex; gap: 10px; padding: 0 15px 15px 15px; justify-content: flex-end; }
.popup-actions button { padding: 6px 12px; border-radius: 6px; border: 1px solid #cbd5e1; background: white; cursor: pointer; text-align: center; font-size: 13px; font-weight: 600; line-height: 1.2; transition: 0.2s; }
.popup-actions button span { font-size: 10px; font-weight: 400; color: #64748b; }
.popup-actions .btn-ignore:hover { background: #f1f5f9; }
.popup-actions .btn-view { background: #1e40af; color: white; border-color: #1e40af; }
.popup-actions .btn-view span { color: #bfdbfe; }
.popup-actions .btn-view:hover { background: #1d4ed8; }

/* Sidebar Kanan (Mockup Style) */
.right-panel { width: 0; opacity: 0; background: #f8fafc; border-left: 1px solid #e2e8f0; display: flex; flex-direction: column; transition: all 0.3s ease; overflow: hidden; }
.right-panel.open { width: 650px; opacity: 1; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background: white; border-bottom: 1px solid #e2e8f0; }
.close-btn { background: none; border: none; font-size: 24px; color: #94a3b8; cursor: pointer; padding: 0 5px; }
.close-btn:hover { color: #ef4444; }
.sidebar-content { padding: 20px; overflow-y: auto; flex: 1; }

/* 3 Kolom Metrik di Sidebar */
.metrics-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin-bottom: 25px; }
.metric-col { background: white; border: 1px solid #e2e8f0; border-radius: 8px; padding: 15px; box-shadow: 0 1px 3px rgba(0,0,0,0.02); }

/* Sliders & Bars */
.slider-container { margin-bottom: 20px; }
.slider-label { display: flex; justify-content: space-between; font-size: 12px; color: #475569; margin-bottom: 5px; font-weight: 600; }
.slider-track { height: 4px; background: #e2e8f0; border-radius: 2px; position: relative; margin-bottom: 5px; }
.slider-fill { position: absolute; height: 100%; border-radius: 2px; }
/* ---- PERBAIKAN SLIDER (Bentuk Kotak seperti Mockup) ---- */
.slider-thumb {
    width: 16px;
    height: 8px;
    border-radius: 4px;
    position: absolute;
    top: -3px;
    transform: translateX(-50%);
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    border: none;
}
.scale-marks { display: flex; justify-content: space-between; font-size: 10px; color: #94a3b8; }
/* ---- PERBAIKAN WARNING NOTE T-SCORE ---- */
.warning-note {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 10px;
    border-radius: 4px;
    font-size: 11px;
    display: flex;
    align-items: flex-start;
    margin-top: 15px;
    line-height: 1.4;
}

/* Bar Chart (Corpus Data) */
.bar-chart-row { margin-bottom: 15px; }
.bar-chart-label { font-size: 11px; color: #475569; margin-bottom: 4px; font-weight: 600; }
.bar-chart-sub { font-size: 10px; color: #94a3b8; display: block; margin-bottom: 2px; }
.bar-container { display: flex; align-items: center; gap: 10px; }
.bar-track { flex: 1; height: 20px; background: #f1f5f9; position: relative; }
.bar-fill { height: 100%; position: absolute; left: 0; }
.bar-value { font-size: 14px; font-weight: 700; color: #1e293b; width: 40px; text-align: right; }

/* Speaker Judgment */
.cvi-score { text-align: center; font-size: 24px; font-weight: 700; color: #10b981; margin: 15px 0 5px 0; }
.cvi-sub { text-align: center; font-size: 12px; color: #94a3b8; margin-bottom: 15px; }
/* ---- PERBAIKAN IKON ORANG (CVI) ---- */
.people-icons {
    display: flex;
    justify-content: center;
    gap: 2px; /* Jarak dibuat rapat agar 10 ikon muat di 1 baris */
    margin: 10px 0 15px 0;
}

/* ---- PERBAIKAN BADGE PENILAIAN ---- */
.cvi-col-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.judgment-badge {
    display: inline-block;
    padding: 6px 20px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
}
.judgment-badge.excellent { border: 1px solid #22c55e; color: #16a34a; background: white;}
.judgment-badge.moderate { border: 1px solid #f59e0b; color: #d97706; background: white;}
.judgment-badge.poor { border: 1px solid #ef4444; color: #dc2626; background: white;}
.judgment-badge.unrated { border: 1px solid #94a3b8; color: #64748b; background: white;}
/* ---- PERBAIKAN KOTAK PENJELASAN (NOTES) ---- */
.judgment-note {
    padding: 10px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.5;
    text-align: center;
    width: 100%;
}
.judgment-note.excellent-note { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.judgment-note.moderate-note { background: #fffbeb; color: #92400e; border: 1px solid #fef3c7; }
.judgment-note.poor-note { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.judgment-note.unrated-note { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }

/* POS Tag Section (Terpisah) */
.pos-section { margin-top: 20px; background: white; padding: 20px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); width: 100%; max-width: 800px; border: 1px solid #e2e8f0; }
.pos-section h4 { margin: 0 0 15px 0; color: #334155; font-size: 14px; text-transform: uppercase; }
.pos-tags-container { display: flex; flex-wrap: wrap; gap: 8px; }
.pos-item { background: #f1f5f9; border: 1px solid #cbd5e1; padding: 4px 10px; border-radius: 6px; font-size: 13px; color: #334155; display: flex; gap: 6px; align-items: center; }
.pos-item strong { color: #0f172a; }
.pos-tag-label { background: #e0e7ff; color: #3730a3; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-family: monospace; font-weight: 700; }


/* ========================================= */
/* CSS TAMBAHAN UNTUK MULTI-PHRASE MOCKUP    */
/* ========================================= */

/* Sidebar di-extend lebih lebar untuk mengakomodir tabel yang lebih luas */
.right-panel.open { 
    width: 780px; 
    opacity: 1; 
}

/* Teks biru frasa di dalam masing-masing card metrics */
.phrase-subtitle {
    font-size: 13px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 12px;
}

/* Pembatas antar frasa jika pengguna klik > 1 frasa */
.phrase-divider {
    border: 0;
    height: 1px;
    background: #e2e8f0;
    margin: 20px 0;
}

/* Menengahkan rowspan pada kolom nama frasa original */
table td {
    vertical-align: middle;
}

/* ========================================= */
/* CSS TAMBAHAN UNTUK VERTICAL CHART & CLOSE */
/* ========================================= */

/* Tag Judul Frasa & Tombol Silang (Hapus) */
.phrase-tag { 
    display: inline-flex; 
    align-items: center; 
    background: #fef3c7; 
    color: #d97706; 
    padding: 3px 10px; 
    border-radius: 4px; 
    font-size: 14px; 
    font-weight: 600; 
}
.remove-phrase-btn { 
    margin-left: 8px; 
    font-size: 18px; 
    cursor: pointer; 
    color: #b45309; 
    line-height: 1; 
    opacity: 0.7; 
    transition: 0.2s;
}
.remove-phrase-btn:hover { 
    opacity: 1; 
    transform: scale(1.1); 
}

/* Vertical Bar Charts (Sesuai Mockup) */
.v-chart-container { 
    display: flex; 
    align-items: flex-end; 
    gap: 15px; 
    margin-top: 10px; 
    height: 80px; /* Menentukan tinggi grafik max */
}
.v-chart-value { 
    font-size: 22px; 
    font-weight: 700; 
    width: 60px; 
    text-align: left; 
    margin-bottom: -4px; 
}
.v-chart-axis { 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    height: 100%; 
    font-size: 10px; 
    color: #94a3b8; 
    text-align: right; 
    padding-bottom: 2px;
}
.v-chart-bar-bg { 
    width: 25px; 
    height: 100%; 
    background: #f1f5f9; 
    position: relative; 
    border-radius: 2px 2px 0 0; 
}
.v-chart-bar-fill { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    border-radius: 2px 2px 0 0; 
    transition: height 0.6s ease; 
}

/* Penyempurnaan Slider Sesuai Mockup */
.slider-thumb {
    width: 10px;
    height: 10px;
    top: -4px;
}
.scale-marks span {
    text-align: left;
    line-height: 1.2;
}

/* Kotak Penjelasan Metrik */
/* ---- KOTAK PENJELASAN CORPUS ---- */
.corpus-note {
    padding: 10px;
    border-radius: 6px;
    font-size: 11px;
    margin-top: 15px;
    border: 1px solid;
    line-height: 1.4;
    text-align: center;
}

.corpus-note-neutral {
    background: #f8fafc;
    color: #475569;
    padding: 10px;
    border-radius: 6px;
    font-size: 11px;
    margin-top: 15px;
    border: 1px solid #e2e8f0;
    line-height: 1.4;
    text-align: left;
}

.judgment-badge-dynamic {
    display: block; 
    width: max-content; 
    margin: 0 auto 10px auto; 
    padding: 4px 16px; 
    background: white; 
    border-radius: 4px; 
    font-size: 12px; 
    font-weight: 600;
}

/* ---- PERBAIKAN HEADER JUDUL "ANALYSIS FOR:" ---- */
.header-title-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
}
.analysis-label {
    font-weight: 700;
    color: #000000;
}
.title-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- KOTAK PENJELASAN INFO MI SCORE ---- */
.info-note {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
    padding: 10px;
    border-radius: 4px;
    font-size: 11px;
    display: flex;
    align-items: flex-start;
    margin-top: 15px;
    line-height: 1.4;
}
.info-note span {
    margin-right: 5px;
}

/* ---- TABS HEADER METRICS (Desain Tab Terpisah) ---- */
.metrics-header-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 10px; /* Jarak antara tab atas dengan kotak di bawahnya */
}
.tab-blue {
    background: #2563eb;
    color: white;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.tab-purple {
    background: #fdfcff;
    color: #6b21a8;
    border: 1px solid #e9d5ff;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}
.tab-green {
    background: #fcfdfc;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}

/* ---- COL SUB TITLE (Judul Sub Ikon di Dalam Kotak Kolom) ---- */
.col-sub-title {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #1e40af;
    margin: -15px -15px 20px -15px;
    padding: 15px;
    border-bottom: 1px solid #e2e8f0;
}

/* ========================================= */
/* CSS TAMBAHAN UNTUK METADATA BADGES        */
/* ========================================= */

.meta-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

.badge-neutral {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.badge-warning {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.badge-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}