/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f3f4f6;
    --bg-white: #ffffff;
    --border-color: #d1d5db;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-primary);
    line-height: 1.6;
    background-color: var(--bg-light);
}

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

/* Header */
.header {
    background: var(--bg-white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav a:hover {
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 5rem 0;
    text-align: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.cta-button {
    display: inline-block;
    background: white;
    color: var(--primary-color);
    padding: 1rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.125rem;
    transition: transform 0.3s, box-shadow 0.3s;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Sections */
.prediction-section,
.stats-section,
.about-section {
    padding: 5rem 0;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 1.125rem;
}

/* Prediction Container */
.prediction-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Form */
.form-container {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.submit-button {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.submit-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.submit-button:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results */
.results-container {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.result-card {
    text-align: center;
}

.result-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
}

.result-icon.rejected {
    background: var(--danger-color);
}

.result-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.confidence-bar {
    margin-bottom: 2rem;
}

.confidence-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.confidence-progress {
    height: 12px;
    background: var(--border-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    transition: width 1s ease-out;
}

.confidence-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.probability-bars {
    margin-bottom: 2rem;
}

.probability-item {
    margin-bottom: 1rem;
}

.probability-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.probability-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.probability-fill {
    height: 100%;
    transition: width 1s ease-out;
}

.probability-fill.approved {
    background: var(--success-color);
}

.probability-fill.rejected {
    background: var(--danger-color);
}

.warnings {
    background: #fef3c7;
    border: 1px solid var(--warning-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    text-align: left;
}

.warnings h4 {
    margin-bottom: 0.5rem;
    color: var(--warning-color);
}

.warnings ul {
    margin-left: 1.5rem;
}

.warnings li {
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.secondary-button {
    padding: 0.75rem 1.5rem;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.secondary-button:hover {
    background: var(--border-color);
}

/* Model Comparison Section */
.comparison-section {
    background: var(--bg-white);
    padding: 5rem 0;
}

/* Metrics table styling */
.metrics-table table {
    width: auto;
    border-collapse: collapse;
    table-layout: auto;
}

.metrics-table th,
.metrics-table td {
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.metrics-table th {
    text-align: center;
    font-weight: 700;
    color: var(--text-primary);
}

/* Left-align the first header (Model) so it aligns with first column values */
.metrics-table th:first-child {
    text-align: left;
    padding-left: 0;
    width: 260px;
}

/* Align numeric columns to the right for readability */
.metrics-table td:nth-child(n+2) {
    text-align: center;
    white-space: nowrap;
}

.metrics-table td:first-child {
    text-align: left;
    padding-left: 0;
    width: 260px;
}

/* Center the metrics section and constrain width so headers align above values */
.performance-comparison {
    text-align: center;
}

.performance-comparison .metrics-table {
    max-width: 920px;
    margin: 0.5rem auto 0 auto;
}

.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.model-card {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.model-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.model-card.best {
    border-color: var(--success-color);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(16, 185, 129, 0.1) 100%);
}

.model-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.model-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.best-badge {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.model-metrics {
    margin: 1rem 0;
}

.metric-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.metric-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.metric-value {
    font-weight: 600;
    color: var(--primary-color);
}

.benchmark-container {
    background: var(--bg-light);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.benchmark-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.benchmark-result-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.benchmark-result-card.approved {
    border-color: var(--success-color);
}

.benchmark-result-card.rejected {
    border-color: var(--danger-color);
}

.consensus-box {
    background: var(--primary-color);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
}

.consensus-prediction {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.consensus-agreement {
    font-size: 1.125rem;
    opacity: 0.9;
}

/* Statistics Section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.stats-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stats-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.stats-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stats-label {
    color: var(--text-secondary);
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.about-card {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.about-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 2rem 0;
    text-align: center;
}

.footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .prediction-container {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .nav {
        display: none;
    }

    .models-grid {
        grid-template-columns: 1fr;
    }

    .benchmark-results-grid {
        grid-template-columns: 1fr;
    }
}
