/* =========================================================================
   1. RESET, FONTS & GLOBAL STYLE
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght=300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif !important;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #0f172a; /* Efek glassmorphism kontras & estetik */
    color: #f8fafc;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding: 2rem 1rem;
    line-height: 1.5;
}

/* Memastikan elemen form kontrol mewarisi font dengan benar */
input, button, select, textarea, table, th, td, span, strong, h1, h2, h3, p {
    font-family: 'Poppins', sans-serif !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================================================================
   2. HEADER STYLE
   ========================================================================= */
.app-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.app-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.app-header .version {
    font-size: 1rem;
    vertical-align: super;
    background: rgba(129, 140, 248, 0.2);
    color: #a5b4fc;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 500;
}

.app-header p {
    color: #94a3b8;
    font-size: 1rem;
}

/* =========================================================================
   3. GLASS-MORPHISM CARD BASE
   ========================================================================= */
.glass-card {
    background: rgba(30, 41, 59, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* Aturan Khusus untuk Kerapatan Baris Teks Deskripsi Hasil Analisis */
.glass-card p,
.glass-card div {
    line-height: 1.6; /* Membuat spasi teks deskripsi lebih renggang & proporsional */
    letter-spacing: 0.2px; /* Memberikan ruang napas antar-karakter agar tidak melelahkan mata */
}

/* Menambahkan jarak pemisah antar blok teks di dalam deskripsi Aspek */
.glass-card br {
    content: "";
    margin: 0.5rem 0;
    display: block;
}

/* =========================================================================
   4. FORM SECTION & CONTROLS
   ========================================================================= */
.form-section {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

#irsForm {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #cbd5e1;
}

.form-group input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

button[type="submit"] {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.85rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

button[type="submit"]:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* =========================================================================
   5. LOADING STATUS & SPINNER
   ========================================================================= */
.loading-status {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    margin: 0 auto 1rem auto;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================================================
   6. ERS SUMMARY CARD
   ========================================================================= */
.ers-summary-card {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(30, 41, 59, 0.45) 100%);
}

.ers-circle {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.6);
    border: 4px solid #10b981;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
    flex-shrink: 0;
}

.ers-circle span {
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
}

.ers-circle small {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
}

.ers-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    color: #fff;
}

.ers-info p {
    color: #cbd5e1;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    line-height: 1.7; /* Diselaraskan agar konsisten */
}

.matrix-relation-desc {
    color: #94a3b8 !important;
    font-size: 0.85rem !important;
    line-height: 1.6 !important;
    margin-bottom: 0.6rem !important;
    font-style: italic;
}

/* =========================================================================
   7. RESULT GRID & INDEX INDICATORS (REVISI PREMIUM & MODERN)
   ========================================================================= */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card h3, .index-card h3, .table-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #f1f5f9; /* Membuat judul card sedikit lebih bersinar */
    border-left: 4px solid #6366f1;
    padding-left: 0.75rem;
    letter-spacing: 0.03em;
}

/* --- Tampilan Komponen Metrik Modern (Menghilangkan Kesan Jadul) --- */
.meta-metrics-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.metric-chip {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.metric-chip .label {
    color: #94a3b8; /* Warna abu-abu muted yang selaras dengan bagian atas */
    font-weight: 400;
}

.metric-chip .value {
    color: #38bdf8; /* Sentuhan warna biru cyan modern untuk angka/nilai */
    font-weight: 600;
}

.metric-chip .value.alert {
    color: #f43f5e; /* Merah neon halus untuk teks 'Terdeteksi Stresor' */
}

/* --- PEMBARUAN KUAT UNTUK KOTAK INDIKATOR IDENTITAS (ANTI-KUNO) --- */
.glass-card.index-card {
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 0.25rem !important;
}

/* Memaksa baris item membelah ke kiri dan kanan secara presisi */
.glass-card.index-card .index-item {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 0.95rem 0 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
    background: none !important;
    width: 100% !important;
}

/* Menghapus garis pembatas abu-abu pada baris paling bawah */
.glass-card.index-card .index-item:last-child {
    border-bottom: none !important;
}

/* Mengubah teks deskripsi kiri menjadi abu-abu redup premium */
.glass-card.index-card .index-item span {
    color: #94a3b8 !important;
    font-size: 0.92rem !important;
    font-weight: 400 !important;
    text-align: left !important;
}

/* Mengubah angka/nilai di kanan menjadi putih bersih, tebal, dan rapi */
.glass-card.index-card .index-item strong {
    color: #f1f5f9 !important;
    font-size: 0.98rem !important;
    font-weight: 600 !important;
    text-align: right !important;
    letter-spacing: 0.02em !important;
}

/* --- Penyelarasan Teks Narasi / Deskripsi Laporan --- */
.interpretation-box {
    margin-top: 1rem;
}

.interpretation-box p, 
.interpretation-box div {
    font-size: 0.92rem;
    color: #cbd5e1; /* Menurunkan intensitas putih polos ke abu-abu terang premium */
    line-height: 1.75 !important; /* Jarak baris yang sangat nyaman dibaca */
    margin-bottom: 1rem;
}

.interpretation-box strong {
    color: #f8fafc; /* Hanya teks tebal/penting yang berwarna putih terang */
    font-weight: 600;
}

/* =========================================================================
   8. DATA TABLE & BADGES
   ========================================================================= */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.data-table th, .data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    color: #94a3b8;
    font-weight: 500;
    background: rgba(15, 23, 42, 0.3);
}

.data-table td {
    color: #cbd5e1;
}

/* Teks narasi psikologis di dalam baris tabel */
.narrative-text {
    font-size: 0.9rem;
    line-height: 1.6; /* Renggang proporsional untuk teks di dalam tabel kuadran */
}

/* Badge Sistem Kuadran */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
}

.badge-masterpiece { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-giant { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.badge-overdrive { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-dormant { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* =========================================================================
   DRAMATISASI VISUAL LINGKARAN ERS SCORE
   ========================================================================= */

/* Pastikan elemen lingkaran asli memiliki transisi yang halus saat berganti warna */
.ers-circle {
    transition: border-color 0.5s ease, box-shadow 0.5s ease, background-color 0.5s ease !important;
}

/* 1. Highly Coherent: Hijau Emerald Neon Full */
.ers-glow-highly-coherent {
    border-color: #10b981 !important;
    box-shadow: 0 0 18px rgba(16, 185, 129, 0.6), inset 0 0 10px rgba(16, 185, 129, 0.3) !important;
    background: rgba(16, 185, 129, 0.05) !important;
}

/* 2. Coherent: Hijau Teal Stabil */
.ers-glow-coherent {
    border-color: #059669 !important;
    box-shadow: 0 0 12px rgba(5, 150, 105, 0.4), inset 0 0 8px rgba(5, 150, 105, 0.2) !important;
    background: rgba(5, 150, 105, 0.03) !important;
}

/* 3. Neutral: Biru Sapphire Sederhana */
.ers-glow-neutral {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.4), inset 0 0 8px rgba(59, 130, 246, 0.2) !important;
    background: rgba(59, 130, 246, 0.03) !important;
}

/* 4. Tense: Oranye Amber Peringatan */
.ers-glow-tense {
    border-color: #f59e0b !important;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5), inset 0 0 8px rgba(245, 158, 11, 0.2) !important;
    background: rgba(245, 158, 11, 0.03) !important;
}

/* 5. Opposing: Merah Neon Bahaya (Full Alert) */
.ers-glow-opposing {
    border-color: #ef4444 !important;
    box-shadow: 0 0 22px rgba(239, 68, 68, 0.7), inset 0 0 12px rgba(239, 68, 68, 0.4) !important;
    background: rgba(239, 68, 68, 0.08) !important;
}