* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #e67e22;
    --primary-dark: #d35400;
    --secondary: #2c3e50;
    --accent-green: #27ae60;
    --accent-red: #e74c3c;
    --accent-blue: #3498db;
    --accent-orange: #f39c12;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --text-primary: #2d3748;
    --text-secondary: #636e72;
    --border: #e2e8f0;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.12);
    --radius: 12px;
    --radius-lg: 16px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1100px;
    margin: auto;
    padding: 0 24px;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--bg-white);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-brand i {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

/* ===== HERO ===== */
.hero {
    text-align: center;
    padding: 4rem 0 3rem;
    background: linear-gradient(135deg, var(--secondary) 0%, #1a252f 100%);
    color: white;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 1.15rem;
    opacity: 0.85;
    margin-bottom: 1.5rem;
}

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.12);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ===== PREDICTION FORM ===== */
.prediction-section {
    padding: 4rem 0;
}

.prediction-section h2 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.prediction-form {
    background: var(--bg-white);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    padding: 12px 14px;
    border-radius: 8px;
    border: 2px solid var(--border);
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--bg-light);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 126, 34, 0.15);
    background: var(--bg-white);
}

.form-group input.input-error,
.form-group select.input-error {
    border-color: var(--accent-red);
}

.field-error {
    font-size: 0.8rem;
    color: var(--accent-red);
    margin-top: 4px;
    min-height: 1em;
}

.form-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff5f5;
    color: var(--accent-red);
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 1rem;
    font-size: 0.9rem;
    border: 1px solid #fed7d7;
}

.btn-predict {
    width: 100%;
    margin-top: 1.5rem;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    transition: transform 0.15s, box-shadow 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-predict:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(230, 126, 34, 0.35);
}

.btn-predict:active {
    transform: translateY(0);
}

.btn-predict:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== LOADING ===== */
.loading-spinner {
    text-align: center;
    margin-top: 2rem;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.warmup-note {
    font-size: 0.8rem !important;
    opacity: 0.6;
    margin-top: 4px;
}

/* ===== RESULT ===== */
.result-section {
    margin-top: 2rem;
}

.result-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.result-card h3 {
    font-size: 1rem;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.price-display {
    font-size: 3.5rem;
    font-weight: 800;
    margin: 0.5rem 0;
    letter-spacing: -1px;
}

.confidence-interval {
    font-size: 0.95rem;
    opacity: 0.85;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.confidence-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
}

.result-footer {
    font-size: 0.85rem;
    opacity: 0.75;
    margin-bottom: 1.25rem;
}

.result-footer i {
    margin-right: 4px;
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* ===== METRICS / COMPARISON TABLE ===== */
.metrics-section {
    padding: 4rem 0;
    background: var(--bg-white);
}

.metrics-section h2,
.importance-section h2 {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.table-loading,
.importance-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.table-wrapper {
    overflow-x: auto;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.comparison-table th {
    background: var(--secondary);
    color: white;
    padding: 14px 18px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.comparison-table tbody tr:hover {
    background: #fef9f4;
}

.comparison-table .best-row {
    background: #f0fdf4;
    font-weight: 600;
}

.comparison-table .best-row:hover {
    background: #dcfce7;
}

.comparison-table .rank-col {
    text-align: center;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

.rank-1 { background: #fef3c7; color: #b45309; }
.rank-2 { background: #e5e7eb; color: #374151; }
.rank-3 { background: #fee2e2; color: #b91c1c; }
.rank-4 { background: #fce7f3; color: #9d174d; }

.dataset-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 1.5rem;
    padding: 12px 20px;
    background: var(--bg-light);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== FEATURE IMPORTANCE ===== */
.importance-section {
    padding: 4rem 0;
    background: var(--bg-light);
}

.importance-image-wrapper {
    max-width: 700px;
    margin: 0 auto;
}

.importance-image {
    width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.importance-ranking {
    max-width: 500px;
    margin: 1.5rem auto 0;
    padding: 1.5rem;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.importance-ranking h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.importance-ranking ol {
    padding-left: 1.25rem;
}

.importance-ranking li {
    padding: 6px 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ===== SERVER STATUS ===== */
.server-status {
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 16px;
    border-radius: 20px;
    display: inline-block;
    transition: opacity 0.5s;
}

.server-status.waking {
    background: rgba(243, 156, 18, 0.2);
    color: #f39c12;
}

.server-status.ready {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
}

.server-status.fade-out {
    opacity: 0;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--secondary);
    color: white;
    text-align: center;
    padding: 2rem 0;
}

.footer .footer-title {
    font-weight: 600;
    margin-bottom: 4px;
}

/* ===== UTILITIES ===== */
.hidden {
    display: none !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    .prediction-form {
        padding: 1.5rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .price-display {
        font-size: 2.5rem;
    }

    .nav-brand span {
        font-size: 1rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}
