/* MediCare Analytics - Professional Medical UI */

/* CSS Variables - Soft Green Professional Theme (#00B14F) */
:root {
    --primary-color: #00B14F;
    --primary-dark: #009943;
    --primary-darker: #008137;
    --primary-light: #00C95A;
    --accent-color: #00B14F;
    --accent-light: #00D15F;
    --accent-bright: #33E17E;
    --forest-green: #006930;
    --emerald-dark: #005126;
    --danger-color: #dc2626;
    --warning-color: #f59e0b;
    --info-color: #0891b2;
    --success-color: #00B14F;
    --background: #f9fafb;
    --background-card: #ffffff;
    --background-light: #e8f8f0;
    --gray-light: #f3f4f6;
    --gray-medium: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-white: #ffffff;
    --border-color: #e5e7eb;
    --border-light: #d1fae5;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Poppins', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-weight: 400;
}

/* Navbar - Clean & Modern */
.navbar {
    background: var(--background-card);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo i {
    font-size: 1.8rem;
}

.logo-sub {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-left: 0.25rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-links a:hover,
.nav-links a.active {
    color: #ffffff;
    background: var(--primary-color);
    border-radius: 8px;
}

/* Hero Section - Emerald/Forest Green Professional */
.hero {
    background: linear-gradient(135deg, var(--forest-green) 0%, var(--primary-darker) 50%, var(--primary-dark) 100%);
    color: var(--text-white);
    padding: 4.5rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.1)" d="M0,96L48,112C96,128,192,160,288,160C384,160,480,128,576,122.7C672,117,768,139,864,138.7C960,139,1056,117,1152,101.3C1248,85,1344,75,1392,69.3L1440,64L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 900px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: -0.02em;
}

.hero .subtitle {
    font-size: 1.2rem;
    opacity: 0.92;
    margin-bottom: 2.5rem;
    font-weight: 400;
    line-height: 1.7;
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.stat-item i {
    font-size: 2rem;
    opacity: 0.9;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.85;
}

/* Container & Cards */
.container {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 2rem;
}

.card {
    background: var(--background-card);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    width: 100%;
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: var(--gray-light);
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-header i {
    font-size: 1.75rem;
    color: var(--primary-color);
}

.card-header h2 {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

/* Main Layout - Single Column Centered */
.main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
    max-width: 1300px;
    margin-left: auto;
    margin-right: auto;
}

.input-panel,
.result-panel {
    width: 100%;
}

/* Hide result panel initially */
.result-panel {
    display: none;
}

.result-panel.show {
    display: block;
}

/* Form Styling */
form {
    padding: 2rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.input-wrapper {
    position: relative;
}

.input-wrapper label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--background-card);
    transition: var(--transition);
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(4, 120, 87, 0.1);
}

.input-wrapper input:hover {
    border-color: var(--primary-color);
}

/* Stats Guide */
.stats {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: var(--gray-light);
    border-radius: 6px;
    display: inline-block;
}

.stats strong {
    color: var(--primary-dark);
    font-weight: 600;
}

/* Scrollbar Styling - Emerald */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* CTA Buttons (Analisis & Reset) */
.cta-button {
    width: 100%;
    padding: 1.125rem 2rem;
    margin-top: 2rem;
    background: var(--accent-color);
    color: var(--text-white);
    border: none;
    border-radius: 10px;
    font-size: 1.125rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
    background: var(--accent-light);
}

.cta-button:active {
    transform: translateY(0);
}

.cta-button i {
    font-size: 1.25rem;
}

/* Reset Button Variant */
.reset-btn {
    background: var(--accent-color);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    width: calc(100% - 4rem);
    margin: 1.5rem auto 1.5rem auto;
}

.reset-btn:hover {
    background: var(--accent-light);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.reset-btn:active {
    transform: translateY(0);
}


/* Result Panel */
#result {
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

/* Result Grid Layout - 2x2 */
.result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
}

.result-grid-full {
    grid-column: 1 / -1;
}

.result-visible {
    opacity: 1 !important;
}

.result-placeholder {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.result-placeholder i {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

.result-placeholder p {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 400px;
    margin: 0 auto;
}

/* Loading State */
#loading {
    display: none;
    text-align: center;
    padding: 3rem 2rem;
}

.loader {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Result Sections */
.result-section {
    padding: 2rem;
    border-radius: 12px;
    margin-bottom: 0;
    background: var(--background-card);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    height: 100%;
}

.result-section:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding-bottom: 0.875rem;
    border-bottom: 2px solid var(--border-color);
}

.section-title i {
    color: var(--accent-color);
    font-size: 1.375rem;
}

/* Risk Section */
.risk-section {
    padding: 4rem 3rem;
    border-width: 3px;
    text-align: center;
    border-radius: 16px;
    margin-bottom: 1.5rem;
}

.risk-label {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.icon-indicator {
    font-size: 3.5rem;
}

/* Detail Summary Grid */
.detail-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    background: transparent;
    padding: 2.25rem 2rem;
    border-radius: 12px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

.summary-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--background-card);
}

.summary-card h4 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.detail-value {
    font-size: 2.75rem;
    font-weight: 700;
    margin: 0;
}

.prob-card {
    border-color: var(--primary-color);
}

.prob-card .detail-value {
    color: var(--primary-color);
}

.status-card {
    border-color: var(--accent-color);
}

.status-card .detail-value {
    color: var(--accent-color);
}


/* Chart Section */
.chart-section {
    background: var(--background-card);
    padding: 2rem;
    text-align: center;
}

/* Chart Section - Visualisasi Risiko (border atas & kiri tebal, kanan & bawah tipis) */
.chart-section:first-of-type {
    border-top: 3px solid #00B14F;
    border-left: 3px solid #00B14F;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* Chart Section - Data Klinis (border atas & kanan tebal, kiri & bawah tipis) */
.chart-section:nth-of-type(2) {
    border-top: 3px solid #00B14F;
    border-right: 3px solid #00B14F;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.plot-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem auto;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

/* Clinical Summary Grid */
.clinical-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.summary-item {
    background: transparent;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    border: 2px solid var(--border-color);
    transition: var(--transition);
}

/* Parameter Input Section (border kiri & bawah tebal, atas & kanan tipis) */
.clinical-section {
    border-left: 3px solid #00B14F !important;
    border-bottom: 3px solid #00B14F !important;
    border-top: 1px solid var(--border-color) !important;
    border-right: 1px solid var(--border-color) !important;
}

.summary-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--background-card);
}

.summary-item h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0 0 0.75rem 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.summary-item p {
    font-size: 2rem;
    font-weight: 700;
    margin: 0;
    color: var(--primary-color);
}

/* Recommendation Section (border kanan & bawah tebal, atas & kiri tipis) */
.recommendation-section {
    background: transparent;
    border-right: 3px solid #00B14F !important;
    border-bottom: 3px solid #00B14F !important;
    border-top: 1px solid var(--border-color) !important;
    border-left: 1px solid var(--border-color) !important;
    border-radius: 10px;
    padding: 2rem;
}

.recommendation-text {
    font-size: 1.125rem;
    color: var(--text-primary);
    line-height: 1.8;
    margin: 0;
}

/* Risk Level Colors - Gradient from Green to Red */
.risk-0 {
    border-color: #00B14F;
    background: linear-gradient(135deg, #d4f4e2 0%, #e8f8f0 100%);
    box-shadow: 0 4px 12px rgba(0, 177, 79, 0.2);
}
.risk-0 .risk-label,
.risk-0 .icon-indicator {
    color: #00B14F;
    font-weight: 700;
}

.risk-1 {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fef9c3 0%, #fef3c7 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}
.risk-1 .risk-label,
.risk-1 .icon-indicator {
    color: #d97706;
    font-weight: 700;
}

.risk-2 {
    border-color: #f97316;
    background: linear-gradient(135deg, #ffedd5 0%, #fed7aa 100%);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.25);
}
.risk-2 .risk-label,
.risk-2 .icon-indicator {
    color: #ea580c;
    font-weight: 700;
}

.risk-3 {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.risk-3 .risk-label,
.risk-3 .icon-indicator {
    color: #dc2626;
    font-weight: 700;
}

.risk-4 {
    border-color: #991b1b;
    background: linear-gradient(135deg, #fca5a5 0%, #f87171 100%);
    box-shadow: 0 4px 16px rgba(153, 27, 27, 0.35);
}
.risk-4 .risk-label,
.risk-4 .icon-indicator {
    color: #7f1d1d;
    font-weight: 700;
}

/* Footer - Emerald Professional with Wave */
.footer {
    background: var(--primary-dark);
    color: var(--text-white);
    margin-top: 4rem;
    padding: 3rem 2rem 1.5rem;
    box-shadow: 0 -4px 20px rgba(6, 78, 59, 0.2);
    position: relative;
    overflow: hidden;
}

/* Wave Effect on Footer */
.footer::before {
    content: '';
    position: absolute;
    top: -80px;
    left: 0;
    width: 100%;
    height: 80px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 120" preserveAspectRatio="none"><path fill="%23f9fafb" fill-opacity="1" d="M0,64L1440,0L1440,120L0,120Z"></path></svg>') no-repeat top;
    background-size: cover;
    pointer-events: none;
}

.footer::after {
    content: '';
    position: absolute;
    top: -40px;
    left: 0;
    width: 100%;
    height: 40px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 120" preserveAspectRatio="none"><path fill="%23009943" fill-opacity="0.6" d="M0,32L120,58.7C240,85,480,139,720,144C960,149,1200,107,1320,85.3L1440,64L1440,120L1320,120C1200,120,960,120,720,120C480,120,240,120,120,120L0,120Z"></path></svg>') no-repeat top;
    background-size: cover;
    pointer-events: none;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.footer-section h3 {
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.footer-section h3 i {
    font-size: 1.5rem;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
    font-size: 0.95rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.875rem;
}

.footer-section ul li a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.95rem;
}

.footer-section ul li a:hover {
    color: white;
    transform: translateX(5px);
}

.footer-section ul li i {
    width: 20px;
    color: rgba(255, 255, 255, 0.8);
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
    padding-top: 1.5rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-layout {
        max-width: 100%;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .nav-links {
        gap: 1rem;
    }
    
    .nav-links a span {
        display: none;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .clinical-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .main-layout {
        max-width: 100%;
        padding: 0;
    }
}

/* --- TAMBAHAN CSS UNTUK MODAL POPUP --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.6); 
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; 
    padding: 2rem;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
}

.modal-content h3 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    right: 20px;
    top: 10px;
    cursor: pointer;
}

.close-modal:hover,
.close-modal:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Tambahan untuk Statistik Dataset */
.stat-info {
    font-size: 0.75rem; /* Ukuran font kecil */
    color: #6c757d;      /* Warna abu-abu */
    margin-top: 5px;
    margin-bottom: 15px; /* Jarak ke input bawahnya */
    background-color: #f8f9fa;
    padding: 5px 10px;
    border-radius: 4px;
    border-left: 3px solid #e9ecef;
}

.stat-val {
    color: #00B14F;      /* Warna Hijau untuk nilai rata-rata */
    font-weight: 600;
}

.input-wrapper input {
    margin-bottom: 0 !important; /* Hilangkan margin default input agar dekat dengan stat */
}

/* =========================================
   TAMBAHAN UNTUK TAMPILAN 3 PENYAKIT (HYBRID)
   ========================================= */

/* Grid untuk menampung 3 kartu penyakit */
.detail-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Paksa 3 kolom */
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Tampilan Kartu (Kotak Putih dengan Shadow) */
.summary-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eee; /* Border tipis default */
}

.summary-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.summary-card h4 {
    font-size: 1.1rem;
    color: #444;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.summary-card .detail-value {
    font-weight: 800;
    margin: 10px 0;
}

.summary-card small {
    display: block;
    font-size: 0.9rem;
    color: #666;
    background: #f8f9fa;
    padding: 5px 10px;
    border-radius: 20px;
    margin-top: 5px;
}

/* Styling untuk Gambar Grafik (Matplotlib) */
.chart-section {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    text-align: center;
    margin-top: 2rem;
}

.plot-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 1rem;
}

/* RESPONSIVE: Agar di HP jadi 1 kolom ke bawah */
@media (max-width: 768px) {
    .detail-summary-grid {
        grid-template-columns: 1fr !important; /* Paksa 1 kolom di HP */
    }
    
    .summary-card {
        margin-bottom: 1rem;
    }
}