/* Theme Variables */
:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #1a1a3e;
    --bg-tertiary: #0f0f2d;
    --bg-card: rgba(255, 255, 255, 0.04);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #e0e0ff;
    --text-secondary: #8b8ba7;
    --accent-primary: #7c3aed;
    --accent-secondary: #06b6d4;
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f5f9;
    --bg-card: rgba(0, 0, 0, 0.02);
    --border-color: rgba(0, 0, 0, 0.1);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-primary: #7c3aed;
    --accent-secondary: #0891b2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.3s, color 0.3s;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.quantum-icon {
    font-size: 1.2rem;
}

.nav-links {
    display: flex;
    gap: 0.15rem;
    flex-wrap: nowrap;
    align-items: center;
    overflow-x: auto;
    max-width: calc(100% - 180px);
}

/* Hide scrollbar but allow scrolling */
.nav-links::-webkit-scrollbar {
    display: none;
}

.nav-links {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.nav-links a {
    color: #8b8ba7;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s, background 0.2s;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: #e0e0ff;
    background: rgba(124, 58, 237, 0.2);
}

.menu-toggle {
    display: none;
    background: rgba(124, 58, 237, 0.2);
    border: 1px solid rgba(124, 58, 237, 0.4);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.4rem 0.6rem;
    order: 1;
}

.menu-toggle:hover {
    background: rgba(124, 58, 237, 0.4);
}

/* Mobile/Tablet: hamburger menu */
@media (max-width: 900px) {
    .menu-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.25rem;
        padding-top: 0.75rem;
        margin-top: 0.5rem;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        order: 2;
        max-width: 100%;
        max-height: 60vh;
        overflow-y: auto;
    }

    .nav-links.active {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }

    .nav-links a {
        width: 100%;
        text-align: center;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 8px;
    }

    .nav-links a:hover,
    .nav-links a.active {
        background: rgba(124, 58, 237, 0.3);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(90deg, #00d4ff, #7c3aed, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: #8b8ba7;
    margin-bottom: 1.5rem;
}

.hero-badges {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.section-desc {
    color: #8b8ba7;
    margin-bottom: 1.5rem;
}

/* Badges */
.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-ml {
    background: linear-gradient(90deg, #10b981, #3b82f6);
}

.badge-quantum {
    background: linear-gradient(90deg, #7c3aed, #06b6d4);
}

.badge-rl {
    background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.badge-conformal {
    background: linear-gradient(90deg, #ec4899, #8b5cf6);
}

/* Upload Area */
.upload-area {
    border: 2px dashed rgba(124, 58, 237, 0.5);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #7c3aed;
    background: rgba(124, 58, 237, 0.1);
}

.upload-area.dragover {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

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

.upload-hint {
    color: #8b8ba7;
    font-size: 0.9rem;
}

/* Sample Cards */
.sample-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.sample-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
}

.sample-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124, 58, 237, 0.5);
    box-shadow: 0 10px 40px rgba(124, 58, 237, 0.2);
}

.sample-card.featured {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.05);
}

.sample-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.sample-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.sample-card p {
    color: #8b8ba7;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.feature-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.tag {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
}

.tag-required {
    background: #3b82f6;
}

.tag-inventory {
    background: #10b981;
}

.tag-pricing {
    background: #f59e0b;
}

.tag-costs {
    background: #ef4444;
}

.tag-external {
    background: #8b5cf6;
}

.accuracy-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.accuracy-label {
    font-size: 0.75rem;
    color: #8b8ba7;
}

.accuracy-value {
    font-weight: 700;
    font-size: 0.9rem;
}

.accuracy-low {
    color: #ef4444;
}

.accuracy-medium {
    color: #f59e0b;
}

.accuracy-good {
    color: #10b981;
}

.accuracy-high {
    color: #3b82f6;
}

.accuracy-excellent {
    color: #8b5cf6;
}

/* Feature Explanations */
.feature-explain-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.feature-explain-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1.25rem;
}

.feature-explain-card h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.feature-explain-card p {
    color: #8b8ba7;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.contribution-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.contribution-fill {
    height: 100%;
    border-radius: 3px;
}

.contribution-label {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

/* Quality Indicators */
.quality-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.quality-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.quality-status {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin: 0 auto 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.quality-good {
    background: rgba(16, 185, 129, 0.2);
}

.quality-warning {
    background: rgba(245, 158, 11, 0.2);
}

.quality-missing {
    background: rgba(239, 68, 68, 0.2);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: linear-gradient(90deg, #7c3aed, #06b6d4);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(124, 58, 237, 0.4);
}

/* Table */
.table-container {
    overflow-x: auto;
    margin: 1rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    color: #8b8ba7;
    font-weight: 500;
    font-size: 0.85rem;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    color: #8b8ba7;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Preview Stats */
.preview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #7c3aed;
}

.stat-label {
    font-size: 0.75rem;
    color: #8b8ba7;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a3e;
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-close {
    float: right;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
    border-color: var(--accent-primary);
}

/* Export Button */
.btn-export {
    background: linear-gradient(90deg, #10b981, #3b82f6);
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(16, 185, 129, 0.4);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin: 1rem 0;
}

/* Anomaly Indicators */
.anomaly-badge {
    background: linear-gradient(90deg, #ef4444, #f59e0b);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}

.anomaly-point {
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Form Controls */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

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

.control-group label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.control-group input,
.control-group select {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    width: 100%;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

.input-with-suffix {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-suffix input {
    flex: 1;
}

.input-suffix {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==============================================
   MOBILE RESPONSIVE STYLES
   ============================================== */

/* Tablet breakpoint: 768px */
@media (max-width: 768px) {

    /* Container adjustments */
    .container {
        padding: 1rem;
    }

    /* Hero section */
    .hero h1 {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-badges {
        gap: 0.5rem;
    }

    /* Cards */
    .card {
        padding: 1.25rem;
        border-radius: 12px;
    }

    .card h2 {
        font-size: 1.25rem;
    }

    /* Sample grid */
    .sample-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 1rem;
    }

    .sample-card {
        padding: 1rem;
    }

    .sample-icon {
        font-size: 1.5rem;
    }

    .sample-card h3 {
        font-size: 1rem;
    }

    /* Feature grids */
    .feature-explain-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Controls grid */
    .controls-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
    }

    /* Quality grid */
    .quality-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Preview stats */
    .preview-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Modal */
    .modal-content {
        margin: 1rem;
        padding: 1.5rem;
        max-width: calc(100% - 2rem);
    }

    /* Buttons */
    .btn {
        padding: 0.65rem 1.25rem;
    }
}

/* Phone breakpoint: 480px */
@media (max-width: 480px) {

    /* Navbar mobile improvements */
    .navbar {
        padding: 0.5rem 1rem;
        gap: 0.5rem;
    }

    .nav-brand {
        font-size: 0.95rem;
    }

    .nav-brand span:last-child {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .quantum-icon {
        font-size: 1.2rem;
    }

    .menu-toggle {
        font-size: 1.25rem;
        padding: 0.4rem;
    }

    /* Nav links in mobile menu */
    .nav-links a {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    /* Container */
    .container {
        padding: 0.75rem;
    }

    /* Hero section */
    .hero {
        padding: 1.5rem 0;
    }

    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 0.9rem;
    }

    .hero-badges {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .badge {
        font-size: 0.7rem;
    }

    /* Cards */
    .card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 10px;
    }

    .card h2 {
        font-size: 1.1rem;
    }

    .section-desc {
        font-size: 0.85rem;
    }

    /* Sample grid - single column */
    .sample-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .sample-card {
        padding: 1rem;
    }

    .sample-card p {
        font-size: 0.8rem;
    }

    .feature-tags {
        gap: 0.3rem;
    }

    .tag {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }

    /* Feature explain grid - single column */
    .feature-explain-grid {
        grid-template-columns: 1fr;
    }

    .feature-explain-card {
        padding: 1rem;
    }

    .feature-explain-card h4 {
        font-size: 0.95rem;
    }

    .feature-explain-card p {
        font-size: 0.8rem;
    }

    /* Controls - stack vertically */
    .controls-grid {
        grid-template-columns: 1fr;
    }

    .control-group input,
    .control-group select {
        padding: 0.6rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Quality grid - single column */
    .quality-grid {
        grid-template-columns: 1fr;
    }

    /* Preview stats - single column */
    .preview-stats {
        grid-template-columns: 1fr;
    }

    .stat-item {
        padding: 0.75rem;
    }

    .stat-value {
        font-size: 1.25rem;
    }

    /* Tables - better mobile handling */
    .table-container {
        margin: 0.5rem -1rem;
        padding: 0 1rem;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 500px;
    }

    th,
    td {
        padding: 0.5rem;
        font-size: 0.8rem;
    }

    /* Buttons - full width on mobile */
    .btn {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .btn-primary {
        margin-top: 0.5rem;
    }

    /* Upload area */
    .upload-area {
        padding: 2rem 1rem;
    }

    .upload-icon {
        font-size: 2rem;
    }

    .upload-area p {
        font-size: 0.9rem;
    }

    .upload-hint {
        font-size: 0.8rem;
    }

    /* Modal */
    .modal-content {
        padding: 1rem;
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
        max-height: 90vh;
    }

    /* Charts */
    .chart-container {
        height: 250px;
    }

    /* Footer */
    footer {
        padding: 1.5rem 1rem;
        font-size: 0.85rem;
    }

    /* Theme toggle */
    .theme-toggle {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}