:root {
    --bg-main: #0a0e17;
    --bg-card: rgba(18, 24, 38, 0.7);
    --bg-card-hover: rgba(26, 34, 52, 0.85);
    --bg-glass: rgba(255, 255, 255, 0.03);
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(99, 102, 241, 0.3);

    --primary: #6366f1;
    --primary-glow: rgba(99, 102, 241, 0.35);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-full: 9999px;

    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
    color-scheme: dark;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(168, 85, 247, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
}

/* Typography & Links */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

/* Glassmorphism Containers */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    transition: border-color var(--transition-normal), transform var(--transition-normal);
}

.glass-panel:hover {
    border-color: var(--border-highlight);
}

/* Container */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 14px 0;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(10, 14, 23, 0.85);
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand-logo {
    display: flex;
    align-items: center;
}

/* Horizontal Logo Image Style */
.nav-horizontal-logo {
    height: 62px;
    width: auto;
    max-width: 280px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-fast);
}

.nav-horizontal-logo:hover {
    transform: scale(1.03);
}

.footer-horizontal-logo {
    height: 54px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 28px;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-links a:hover {
    color: #fff;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 4px 20px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.5);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Hero Section */
.hero-section {
    padding: 70px 0 50px;
    text-align: center;
    position: relative;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 24px;
}

.hero-tag .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-emerald);
    box-shadow: 0 0 10px var(--accent-emerald);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.8); }
}

.hero-title {
    font-size: 3.5rem;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
    line-height: 1.15;
}

.hero-title span.gradient-text {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 720px;
    margin: 0 auto 36px;
}

.hero-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 44px;
}

/* Live Simulator / Demo Grid */
.simulator-section {
    padding: 30px 0 70px;
}

.simulator-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 30px;
    align-items: start;
}

.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.sample-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.sample-pill {
    padding: 6px 12px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.sample-pill:hover, .sample-pill.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: rgba(99, 102, 241, 0.5);
    color: #fff;
}

.editor-textarea {
    width: 100%;
    min-height: 140px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    transition: border-color var(--transition-fast);
}

.editor-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Dietary Profile Selector in Simulator */
.dietary-tags-box {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.tags-title {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-dim);
    margin-bottom: 10px;
}

.diet-toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.diet-toggle {
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    user-select: none;
    transition: all var(--transition-fast);
}

.diet-toggle.selected {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--accent-cyan);
    color: #38bdf8;
    font-weight: 600;
}

/* Analysis Result Card */
.result-box {
    min-height: 440px;
    display: flex;
    flex-direction: column;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.risk-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    font-weight: 700;
}

.risk-safe {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
}

.risk-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.risk-danger {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #f87171;
    animation: dangerPulse 2s infinite;
}

@keyframes dangerPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.2); }
    50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.5); }
}

.score-meter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.score-value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

.result-card-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.result-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.result-item h4 {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-badge {
    font-size: 0.8rem;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.tag-badge.tag-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.tag-badge.tag-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.tag-badge.tag-safe {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Feature Grid */
.features-section {
    padding: 70px 0;
}

.section-head {
    text-align: center;
    max-width: 680px;
    margin: 0 auto 44px;
}

.section-head h2 {
    font-size: 2.3rem;
    margin-bottom: 12px;
}

.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.feature-card {
    padding: 28px;
}

.feature-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 18px;
    color: #818cf8;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-top: 40px;
}

.stat-item {
    text-align: center;
    padding: 24px 16px;
}

.stat-number {
    font-size: 2.1rem;
    font-weight: 800;
    font-family: var(--font-heading);
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 4px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 50px 0 30px;
    margin-top: 50px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

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

/* Input Mode Tabs & Photo Upload Dropzone */
.input-mode-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.input-mode-tab {
    flex: 1;
    padding: 10px 14px;
    text-align: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.input-mode-tab.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
    color: #fff;
}

.upload-dropzone {
    width: 100%;
    min-height: 160px;
    border: 2px dashed rgba(99, 102, 241, 0.4);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-preview-box {
    position: relative;
    max-width: 100%;
    margin-top: 12px;
}

.upload-preview-img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.btn-export {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid var(--accent-cyan);
    color: #38bdf8;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-export:hover {
    background: var(--accent-cyan);
    color: #fff;
}

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE MEDIA QUERIES (TABLETS & MOBILE)
   ========================================================================== */

/* Tablet (Under 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 20px;
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .simulator-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .nav-links {
        gap: 20px;
    }

    .nav-links a {
        font-size: 0.9rem;
    }
}

/* Mobile & Small Tablet (Under 768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    /* Navbar Mobile Layout */
    .navbar {
        padding: 10px 0;
    }

    .nav-container {
        flex-wrap: wrap;
        gap: 12px;
    }

    .nav-horizontal-logo {
        height: 36px;
        max-width: 150px;
    }

    .nav-links {
        gap: 14px;
        font-size: 0.85rem;
        width: 100%;
        justify-content: center;
        border-top: 1px solid rgba(255,255,255,0.05);
        padding-top: 8px;
        margin-top: 4px;
    }

    /* Hero Section Mobile */
    .hero-section {
        padding: 40px 0 30px;
    }

    .hero-tag {
        font-size: 0.78rem;
        padding: 4px 12px;
    }

    .hero-title {
        font-size: 2.1rem;
        letter-spacing: -0.5px;
    }

    .hero-subtitle {
        font-size: 0.98rem;
        padding: 0 4px;
        margin-bottom: 28px;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .hero-cta .btn {
        width: 100%;
        padding: 12px 20px !important;
        font-size: 0.95rem !important;
    }

    /* Stats Bar Mobile */
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-top: 28px;
    }

    .stat-item {
        padding: 16px 10px;
    }

    .stat-number {
        font-size: 1.6rem;
    }

    .stat-label {
        font-size: 0.78rem;
    }

    /* Simulator Section Mobile */
    .simulator-section {
        padding: 20px 0 50px;
    }

    .section-head h2 {
        font-size: 1.75rem;
    }

    .glass-panel {
        border-radius: var(--radius-md);
        padding: 20px 16px !important;
    }

    .sample-pills {
        gap: 6px;
    }

    .sample-pill {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .editor-textarea {
        min-height: 120px;
        font-size: 0.88rem;
        padding: 12px;
    }

    .diet-toggle {
        font-size: 0.75rem;
        padding: 4px 10px;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .score-meter {
        width: 100%;
        justify-content: space-between;
    }

    .result-item {
        padding: 12px 14px;
    }

    .feature-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .feature-card {
        padding: 20px 16px;
    }

    /* Footer Mobile */
    .footer-bottom {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
}

/* Small Phones (Under 480px) */
@media (max-width: 480px) {
    .nav-horizontal-logo {
        height: 42px;
        max-width: 190px;
    }

    .hero-title {
        font-size: 1.8rem;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .sample-pills {
        flex-direction: column;
    }

    .sample-pill {
        width: 100%;
        text-align: center;
    }

    .input-mode-tabs {
        flex-direction: column;
        gap: 6px;
    }
}
