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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: #ffffff;
    overflow-x: hidden;
}

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

/* Hero Section */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    overflow: hidden;
    animation: gradientShift 8s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    }
    25% {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 25%, #667eea 50%, #764ba2 75%, #f093fb 100%);
    }
    50% {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 25%, #4facfe 50%, #00f2fe 75%, #667eea 100%);
    }
    75% {
        background: linear-gradient(135deg, #43e97b 0%, #38f9d7 25%, #f093fb 50%, #f5576c 75%, #667eea 100%);
    }
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    z-index: 1;
}

.background-icon {
    position: absolute;
    width: 120px;
    height: 120px;
    color: #48bb78;
    animation: float 6s ease-in-out infinite;
}

.background-icon:nth-child(1) {
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.background-icon:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: 2s;
}

.background-icon:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 1s;
}

.background-icon:nth-child(4) {
    bottom: 15%;
    right: 10%;
    animation-delay: 3s;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(5deg); }
    50% { transform: translateY(-10px) rotate(-5deg); }
    75% { transform: translateY(-15px) rotate(3deg); }
}

.hero-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff, #f0f9ff, #dbeafe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: fadeInUp 1s ease-out, titleGlow 3s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 255, 255, 0.3); }
    50% { text-shadow: 0 0 40px rgba(255, 255, 255, 0.6), 0 0 60px rgba(129, 140, 248, 0.4); }
}

.hero-tagline {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    font-weight: 400;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 3rem;
    animation: fadeInUp 1s ease-out 0.2s both;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.scroll-cue {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 16px 32px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    transition: all 0.3s ease;
    animation: fadeInUp 1s ease-out 0.4s both, pulseGlow 2s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 0 0 0 rgba(255, 255, 255, 0.4); }
    50% { box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(255, 255, 255, 0.1); }
}

.scroll-cue:hover {
    transform: translateY(-3px) scale(1.05);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.15));
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 0 15px rgba(255, 255, 255, 0.1);
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-5px); }
    60% { transform: translateY(-3px); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Section */
.input-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e0 100%);
    position: relative;
    overflow: hidden;
}

.input-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(240, 147, 251, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 60%, rgba(79, 172, 254, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 60% 40%, rgba(67, 233, 123, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.input-container {
    max-width: 700px;
    margin: 0 auto;
}

/* Language Selector */
.language-selector {
    margin-bottom: 24px;
    text-align: right;
}

.language-selector select {
    padding: 10px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.95rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.language-selector select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

/* Dietary Filters */
.dietary-filters {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px;
    border-radius: 16px;
    margin-bottom: 28px;
    border: 2px solid #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.dietary-filters:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.dietary-filters h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.filter-checkbox:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.filter-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #43e97b;
    cursor: pointer;
}

.filter-checkbox span {
    font-size: 0.95rem;
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Input Wrapper with Autocomplete */
.input-wrapper {
    position: relative;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #48bb78;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 0.95rem;
    color: #4a5568;
}

.suggestion-item:hover,
.suggestion-item.selected {
    background: #f0fff4;
    color: #48bb78;
}

.suggestion-item:last-child {
    border-radius: 0 0 12px 12px;
}

.ingredients-textarea {
    width: 100%;
    min-height: 200px;
    padding: 24px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 1.1rem;
    font-family: inherit;
    resize: vertical;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    line-height: 1.6;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.ingredients-textarea:focus {
    outline: none;
    border-color: #48bb78;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.1), 0 8px 25px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #ffffff 0%, #f0fff4 100%);
    transform: translateY(-3px) scale(1.01);
}

.ingredients-textarea::placeholder {
    background: linear-gradient(135deg, #94a3b8, #64748b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-style: italic;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    gap: 16px;
}

.example-link,
.barcode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    background: none;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.barcode-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.barcode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

.example-link:hover {
    color: #48bb78;
    background: #f0fff4;
}

.example-link svg {
    width: 16px;
    height: 16px;
}

.analyze-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    border: none;
    padding: 18px 36px;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 160px;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.4);
    overflow: hidden;
}

.analyze-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.analyze-btn:hover::before {
    left: 100%;
}

.analyze-btn:hover:not(:disabled) {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.5);
}

.analyze-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.loader-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: white;
    animation: loader 1.4s ease-in-out infinite both;
}

.loader-dot:nth-child(1) { animation-delay: -0.32s; }
.loader-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes loader {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Results Section */
.results-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    position: relative;
    animation: resultsGradientShift 12s ease-in-out infinite;
}

@keyframes resultsGradientShift {
    0%, 100% {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    }
    33% {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 25%, #43e97b 50%, #38f9d7 75%, #667eea 100%);
    }
    66% {
        background: linear-gradient(135deg, #f093fb 0%, #f5576c 25%, #667eea 50%, #764ba2 75%, #43e97b 100%);
    }
}

.results-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 80% 20%, rgba(102, 126, 234, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(240, 147, 251, 0.05) 0%, transparent 50%);
    pointer-events: none;
    background: #f8fafc;
    animation: fadeIn 0.5s ease-out;
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.results-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin: 0;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from {
        text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    }
    to {
        text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.3);
    }
}

.results-actions {
    display: flex;
    gap: 12px;
}

.export-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #4299e1, #3182ce);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(66, 153, 225, 0.3);
}

.export-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.4);
}

.export-btn svg {
    width: 16px;
    height: 16px;
}

/* Analysis Summary */
.analysis-summary {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
}

.stat-item.safe {
    background: linear-gradient(135deg, #f0fff4, #c6f6d5);
    border: 2px solid #48bb78;
}

.stat-item.questionable {
    background: linear-gradient(135deg, #fffbf0, #fed7aa);
    border: 2px solid #ed8936;
}

.stat-item.banned {
    background: linear-gradient(135deg, #fff5f5, #fed7d7);
    border: 2px solid #e53e3e;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-item.safe .stat-number {
    color: #38a169;
}

.stat-item.questionable .stat-number {
    color: #dd6b20;
}

.stat-item.banned .stat-number {
    color: #c53030;
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
}

.allergen-warning,
.dietary-conflicts {
    margin-top: 20px;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid #ed8936;
    background: #fffbf0;
}

.allergen-warning h4,
.dietary-conflicts h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #dd6b20;
}

.allergen-warning p,
.dietary-conflicts p {
    font-size: 0.95rem;
    color: #7c2d12;
    margin: 0;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.ingredient-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    padding: 28px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(255, 255, 255, 0.5);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: slideInUp 0.6s ease-out both;
}

.ingredient-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 49%, rgba(255, 255, 255, 0.1) 50%, transparent 51%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.ingredient-card:hover::after {
    opacity: 1;
}

.ingredient-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    transition: all 0.3s ease;
}

.ingredient-card.safe {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 50%, #10b981 100%);
    color: white;
}

.ingredient-card.safe h3,
.ingredient-card.safe p {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ingredient-card.safe::before {
    background: linear-gradient(90deg, #10b981, #34d399, #6ee7b7);
}

.ingredient-card.questionable {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #f093fb 0%, #ff9a9e 50%, #f59e0b 100%);
    color: white;
}

.ingredient-card.questionable h3,
.ingredient-card.questionable p {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ingredient-card.questionable::before {
    background: linear-gradient(90deg, #f59e0b, #fbbf24, #fcd34d);
}

.ingredient-card.banned {
    border-left-color: #ef4444;
    background: linear-gradient(135deg, #f5576c 0%, #ff6b6b 50%, #ef4444 100%);
    color: white;
}

.ingredient-card.banned h3,
.ingredient-card.banned p {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ingredient-card.banned::before {
    background: linear-gradient(90deg, #ef4444, #f87171, #fca5a5);
}

.ingredient-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255, 255, 255, 0.8);
}

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

.ingredient-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    text-transform: capitalize;
}

.ingredient-emoji {
    font-size: 1.5rem;
}

.ingredient-explanation {
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 16px;
}

.ingredient-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.ingredient-card.expanded .ingredient-details {
    max-height: 200px;
}

.why-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #48bb78;
    font-size: 0.9rem;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.why-link:hover {
    color: #38a169;
}

.expand-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.ingredient-card.expanded .expand-icon {
    transform: rotate(180deg);
}

/* Ingredient Card Enhancements */
.allergen-info,
.dietary-violation {
    margin: 12px 0;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.allergen-info {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    color: #c53030;
}

.dietary-violation {
    background: #fffbf0;
    border: 1px solid #fed7aa;
    color: #dd6b20;
}

.nutrition-info {
    margin-top: 16px;
    padding: 15px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.8));
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.6);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.nutrition-info h5 {
    margin: 0 0 10px 0;
    font-size: 1rem;
    color: #2d3748;
    font-weight: 600;
    text-align: center;
}

.nutrition-source {
    font-size: 0.8rem;
    color: #718096;
    margin: 0 0 12px 0;
    text-align: center;
    font-style: italic;
}

.nutrition-info h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2d3748;
}

.nutrition-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nutrition-main {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.nutrition-vitamins {
    padding-top: 10px;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 6px;
    margin-top: 8px;
}

.nutrition-vitamins h6 {
    grid-column: 1 / -1;
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: #4a5568;
    font-weight: 500;
    text-align: center;
}

.nutrition-main span,
.nutrition-vitamins span {
    font-size: 0.85rem;
    color: #2d3748;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.7));
    border-radius: 6px;
    font-weight: 500;
    text-align: center;
    border: 1px solid rgba(226, 232, 240, 0.4);
    transition: all 0.2s ease;
}

.nutrition-main span:hover,
.nutrition-vitamins span:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, rgba(255, 255, 255, 1), rgba(248, 250, 252, 0.9));
}

/* Sustainability Visualization Styles */
.sustainability-info {
    margin-top: 16px;
    padding: 15px;
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(34, 197, 94, 0.2);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.1);
}

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

.sustainability-header h5 {
    margin: 0;
    font-size: 1rem;
    color: #065f46;
    font-weight: 600;
}

.sustainability-score {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sustainability-score.very_low {
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #15803d;
    border: 1px solid #86efac;
}

.sustainability-score.low {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    color: #059669;
    border: 1px solid #6ee7b7;
}

.sustainability-score.moderate {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
    border: 1px solid #fcd34d;
}

.sustainability-score.high {
    background: linear-gradient(135deg, #fed7aa, #fdba74);
    color: #ea580c;
    border: 1px solid #fb923c;
}

.sustainability-score.very_high {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #dc2626;
    border: 1px solid #f87171;
}

.score-emoji {
    font-size: 1.1rem;
}

.score-text {
    font-weight: 500;
}

.score-number {
    font-weight: 700;
    font-size: 0.9rem;
}

.environmental-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
    margin: 12px 0;
}

.metric {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #374151;
    padding: 8px 12px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.metric.carbon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1), rgba(220, 38, 38, 0.05));
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.metric.water {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.metric.land {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.metric:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sustainability-source {
    font-size: 0.8rem;
    color: #6b7280;
    margin: 8px 0 0 0;
    text-align: center;
    font-style: italic;
}

/* Responsive adjustments for sustainability cards */
@media (max-width: 768px) {
    .sustainability-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .sustainability-score {
        align-self: flex-end;
    }
    
    .environmental-metrics {
        grid-template-columns: 1fr;
    }
}

/* Sustainability Summary Styles */
.sustainability-summary {
    margin-top: 16px;
    padding: 16px;
    background: linear-gradient(145deg, rgba(34, 197, 94, 0.08), rgba(16, 185, 129, 0.03));
    border-radius: 12px;
    border: 1px solid rgba(34, 197, 94, 0.15);
}

.sustainability-summary h4 {
    margin: 0 0 12px 0;
    font-size: 1.1rem;
    color: #065f46;
    font-weight: 600;
    text-align: center;
}

.sustainability-overview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.overall-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
}

.impact-breakdown {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.impact-stat {
    font-size: 0.85rem;
    color: #374151;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
}

.impact-stat.carbon {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.08), rgba(220, 38, 38, 0.03));
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.impact-stat.water {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(37, 99, 235, 0.03));
    border: 1px solid rgba(59, 130, 246, 0.15);
}

.clear-results {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
    background: #64748b;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-results:hover {
    background: #4a5568;
    transform: translateY(-1px);
}

.clear-results svg {
    width: 16px;
    height: 16px;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* About Section */
.about-section {
    padding: 80px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
}

.about-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 30%, rgba(79, 172, 254, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 70%, rgba(67, 233, 123, 0.2) 0%, transparent 50%);
    pointer-events: none;
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about-content h3 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.about-content p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 24px;
    line-height: 1.8;
}

.built-with-love {
    font-size: 1.2rem;
    font-weight: 500;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Floating particles animation */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb);
    border-radius: 50%;
    animation: floatUp 8s linear infinite;
    opacity: 0.7;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 0.7;
    }
    90% {
        opacity: 0.7;
    }
    100% {
        transform: translateY(-100px) rotate(360deg);
        opacity: 0;
    }
}

/* Footer */
.footer {
    padding: 40px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    animation: footerGradientShift 10s ease-in-out infinite;
}

@keyframes footerGradientShift {
    0%, 100% {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #f5576c 75%, #4facfe 100%);
    }
    50% {
        background: linear-gradient(135deg, #43e97b 0%, #38f9d7 25%, #667eea 50%, #764ba2 75%, #f093fb 100%);
    }
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.footer .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-links a {
    color: #a0aec0;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: #48bb78;
}

.social-links svg {
    width: 20px;
    height: 20px;
}

/* Barcode Scanner Modal */
.barcode-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.barcode-modal-content {
    background: white;
    border-radius: 20px;
    max-width: 90vw;
    max-height: 90vh;
    width: 600px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.barcode-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.barcode-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.close-scanner {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-scanner:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.close-scanner svg {
    width: 18px;
    height: 18px;
}

.scanner-container {
    position: relative;
    background: #000;
    height: 400px;
    overflow: hidden;
}

.scanner-viewport {
    width: 100%;
    height: 100%;
}

.scanner-viewport video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
    /* Improve image sharpness */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.scanner-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scanner-frame {
    position: relative;
    width: 280px;
    height: 120px;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

.scanner-frame::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ff0040, transparent);
    transform: translateY(-50%);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.scanner-corners {
    position: absolute;
    inset: -8px;
}

.scanner-corners::before,
.scanner-corners::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #ff0040;
}

.scanner-corners::before {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
    border-radius: 12px 0 0 0;
}

.scanner-corners::after {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
    border-radius: 0 0 12px 0;
}

.scanner-instructions {
    color: white;
    margin-top: 20px;
    font-size: 0.95rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
}

.scanner-controls {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: #f8fafc;
}

.flashlight-btn,
.manual-input-btn,
.lookup-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.flashlight-btn {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.3);
}

.manual-input-btn {
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(100, 116, 139, 0.3);
}

.lookup-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    width: 100%;
    justify-content: center;
}

.flashlight-btn:hover,
.manual-input-btn:hover,
.lookup-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.flashlight-btn svg,
.manual-input-btn svg,
.lookup-btn svg {
    width: 18px;
    height: 18px;
}

.barcode-status {
    padding: 16px 20px;
    text-align: center;
    font-size: 0.9rem;
    min-height: 20px;
}

.barcode-status.success {
    background: #dcfce7;
    color: #166534;
    border-top: 2px solid #22c55e;
}

.barcode-status.error {
    background: #fef2f2;
    color: #dc2626;
    border-top: 2px solid #ef4444;
}

.barcode-status.loading {
    background: #fefbf0;
    color: #92400e;
    border-top: 2px solid #f59e0b;
}

/* Manual Barcode Input */
.manual-input-container {
    padding: 30px;
}

.manual-input-container label {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    font-size: 1rem;
}

.manual-input-container input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1.1rem;
    margin-bottom: 20px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.manual-input-container input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Packaged Food Header (from barcode scan) */
.packaged-food-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    margin-bottom: 0;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    animation: slideDown 0.5s ease-out;
}

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

.packaged-food-header .product-info h3 {
    margin: 0 0 8px 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
}

.packaged-food-header .product-details {
    margin: 4px 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.packaged-food-header .barcode-info {
    margin: 8px 0 0 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: monospace;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .barcode-modal-content {
        width: 95vw;
        height: 90vh;
    }
    
    .scanner-container {
        height: 300px;
    }
    
    .scanner-frame {
        width: 240px;
        height: 100px;
    }
    
    .scanner-controls {
        flex-direction: column;
        gap: 12px;
    }
    
    .input-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .barcode-btn,
    .example-link {
        flex: 1;
        min-width: 140px;
        justify-content: center;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-tagline {
        font-size: 1.2rem;
    }
    
    .input-section {
        padding: 60px 0;
    }
    
    .ingredients-textarea {
        min-height: 150px;
        padding: 20px;
        font-size: 1rem;
    }
    
    .input-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .analyze-btn {
        width: 100%;
        margin-top: 16px;
    }
    
    .results-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    
    .results-title {
        font-size: 2rem;
        text-align: center;
    }
    
    .results-actions {
        justify-content: center;
    }
    
    .ingredient-card {
        padding: 20px;
    }
    
    .footer .container {
        flex-direction: column;
        gap: 16px;
    }
    
    .about-section {
        padding: 60px 0;
    }
    
    .about-content h3 {
        font-size: 1.75rem;
    }
    
    .about-content p {
        font-size: 1rem;
    }
    
    .background-icon {
        width: 80px;
        height: 80px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .filter-options {
        flex-direction: column;
        gap: 8px;
    }
    
    .language-selector {
        text-align: center;
    }
    
    .nutrition-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Responsive ad containers */
    .ad-container {
        margin: 16px 0;
        padding: 12px;
        min-height: 100px;
    }
    
    .ad-banner-top,
    .ad-mid-content,
    .ad-results-bottom {
        max-width: 100%;
        margin: 20px 0;
    }
}

/* AdSense Ad Containers */
.ad-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 24px 0;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 120px;
    position: relative;
    overflow: hidden;
}

.ad-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 49%, rgba(226, 232, 240, 0.3) 50%, transparent 51%);
    pointer-events: none;
}

.ad-banner-top {
    margin: 32px 0;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.ad-mid-content {
    margin: 48px 0;
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}

.ad-results-bottom {
    margin: 32px 0;
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}

.ad-container .adsbygoogle {
    width: 100%;
    min-height: 90px;
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .hero-section {
        padding: 40px 0;
    }
    
    .input-section,
    .results-section,
    .about-section {
        padding: 40px 0;
    }
    
    .results-title {
        font-size: 1.75rem;
        margin-bottom: 32px;
    }
    
    .ingredient-card {
        padding: 16px;
    }
    
    .ingredient-name {
        font-size: 1.1rem;
    }
    
    .scroll-cue {
        padding: 14px 28px;
        font-size: 1rem;
    }
}

/* Enhanced Mobile Experience Optimizations */
@media (max-width: 768px) {
    /* Improved touch targets and spacing */
    .btn {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 1rem;
        border-radius: 12px;
    }
    
    .analyze-btn {
        width: 100%;
        margin: 16px 0;
    }
    
    /* Better textarea experience */
    .input-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 16px;
        line-height: 1.6;
        border-radius: 12px;
        min-height: 120px;
    }
    
    /* Optimized ingredient cards */
    .ingredient-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .ingredient-emoji {
        align-self: flex-end;
        font-size: 2.2rem;
    }
    
    .ingredient-name {
        font-size: 1.1rem;
        line-height: 1.3;
        margin: 0;
    }
    
    .ingredient-explanation {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-top: 8px;
    }
    
    /* Mobile-optimized sustainability displays */
    .sustainability-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .sustainability-score {
        align-self: stretch;
        justify-content: center;
        padding: 10px 16px;
        border-radius: 12px;
    }
    
    .environmental-metrics {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .metric {
        padding: 10px 14px;
        font-size: 0.85rem;
        border-radius: 8px;
        text-align: center;
    }
    
    /* Nutrition display mobile optimization */
    .nutrition-main {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .nutrition-vitamins {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .nutrition-main span,
    .nutrition-vitamins span {
        padding: 8px 10px;
        font-size: 0.8rem;
        text-align: center;
        border-radius: 6px;
    }
    
    /* Summary stats mobile layout */
    .summary-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin: 16px 0;
    }
    
    .stat-item {
        padding: 16px 8px;
        border-radius: 10px;
        text-align: center;
    }
    
    .stat-number {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    /* Dietary filters mobile layout */
    .dietary-filters {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin: 16px 0;
    }
    
    .dietary-filter {
        padding: 12px 14px;
        font-size: 0.85rem;
        border-radius: 8px;
    }
    
    .dietary-filter input[type="checkbox"] {
        width: 18px;
        height: 18px;
        margin-right: 8px;
    }
    
    /* Enhanced touch interactions */
    .why-link {
        padding: 16px;
        margin: 12px -16px -12px -16px;
        border-radius: 8px;
        min-height: 48px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9rem;
    }
    
    .expand-icon {
        width: 20px;
        height: 20px;
        margin-left: 8px;
    }
}

/* Extra small devices optimization */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    .header {
        padding: 20px 12px;
        text-align: center;
    }
    
    .header h1 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    
    .header p {
        font-size: 0.9rem;
    }
    
    .analyze-section {
        padding: 16px 12px;
    }
    
    /* Single column layout for very small screens */
    .dietary-filters {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .summary-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .stat-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px;
        text-align: left;
    }
    
    .stat-number {
        font-size: 2rem;
        order: 2;
    }
    
    .stat-label {
        font-size: 0.95rem;
        order: 1;
    }
    
    /* Sustainability adjustments for small screens */
    .overall-score {
        flex-direction: column;
        gap: 6px;
        text-align: center;
        padding: 12px;
    }
    
    .impact-breakdown {
        flex-direction: column;
        gap: 8px;
    }
    
    .impact-stat {
        text-align: center;
        padding: 8px 12px;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 16px 0;
    }
    
    .header h1 {
        font-size: 1.8rem;
    }
    
    .analyze-section {
        padding: 20px;
    }
    
    .input-group textarea {
        min-height: 80px;
    }
    
    .controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .controls .btn {
        flex: 1;
        min-width: 140px;
    }
    
    .dietary-filters {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .summary-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .ingredient-card:hover {
        transform: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .why-link:hover {
        background: rgba(59, 130, 246, 0.1);
    }
    
    .metric:hover,
    .nutrition-main span:hover,
    .nutrition-vitamins span:hover {
        transform: none;
    }
    
    /* Add active states for better feedback */
    .metric:active,
    .nutrition-main span:active,
    .nutrition-vitamins span:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
}

/* High DPI display optimization */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .ingredient-emoji {
        font-size: 2.4rem;
    }
    
    .score-emoji {
        font-size: 1.2rem;
    }
    
    .expand-icon {
        stroke-width: 2.5px;
    }
}

/* iOS specific optimizations */
@supports (-webkit-touch-callout: none) {
    .input-group textarea {
        font-size: 16px; /* Prevents zoom */
        border-radius: 12px;
        -webkit-appearance: none;
    }
    
    .btn {
        -webkit-appearance: none;
        border-radius: 12px;
    }
    
    /* Safe area adjustments for newer iPhones */
    @media (max-width: 480px) {
        .container {
            padding-left: env(safe-area-inset-left, 8px);
            padding-right: env(safe-area-inset-right, 8px);
        }
        
        .header {
            padding-top: max(20px, env(safe-area-inset-top));
        }
    }
}

/* Health Score Card */
.health-score-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 20%, #f093fb 40%, #f5576c 60%, #4facfe 80%, #43e97b 100%);
    color: white;
    padding: 30px;
    border-radius: 20px;
    margin: 30px 0;
    text-align: center;
    box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4);
    animation: scoreCardAppear 0.8s ease-out, scoreCardGlow 4s ease-in-out infinite;
    background-size: 400% 400%;
}

@keyframes scoreCardGlow {
    0%, 100% {
        background-position: 0% 50%;
        box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4), 0 0 40px rgba(240, 147, 251, 0.3);
    }
    25% {
        background-position: 100% 50%;
        box-shadow: 0 25px 50px rgba(79, 172, 254, 0.4), 0 0 40px rgba(245, 87, 108, 0.3);
    }
    50% {
        background-position: 100% 100%;
        box-shadow: 0 25px 50px rgba(67, 233, 123, 0.4), 0 0 40px rgba(79, 172, 254, 0.3);
    }
    75% {
        background-position: 0% 100%;
        box-shadow: 0 25px 50px rgba(245, 87, 108, 0.4), 0 0 40px rgba(67, 233, 123, 0.3);
    }
}

.health-score-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 20px;
    color: white;
}

.score-display {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 30px;
    align-items: center;
    text-align: left;
}

.score-circle {
    position: relative;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 4px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    animation: scoreCircleGlow 3s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

@keyframes scoreCircleGlow {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.2), 0 0 15px rgba(102, 126, 234, 0.5);
    }
    33% {
        transform: scale(1.05);
        box-shadow: 0 0 35px rgba(255, 255, 255, 0.3), 0 0 20px rgba(240, 147, 251, 0.6);
    }
    66% {
        transform: scale(1.02);
        box-shadow: 0 0 32px rgba(255, 255, 255, 0.25), 0 0 18px rgba(67, 233, 123, 0.5);
    }
}

.score-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.score-label {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

.score-breakdown {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    margin-bottom: 16px;
}

.score-breakdown h4 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: white;
}

.score-breakdown ul {
    list-style: none;
    padding: 0;
}

.score-breakdown li {
    padding: 4px 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
}

.recommendations {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.recommendations h4 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: white;
}

.recommendations ul {
    list-style: none;
    padding: 0;
}

.recommendations li {
    padding: 6px 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommendations li::before {
    content: "💡";
    font-size: 0.8rem;
}

@keyframes scoreCardAppear {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes scoreCircleGlow {
    from {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
    }
    to {
        box-shadow: 0 0 30px rgba(255, 255, 255, 0.5);
    }
}

/* Responsive Health Score */
@media (max-width: 768px) {
    .score-display {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
    
    .score-circle {
        margin: 0 auto;
    }
    
    .health-score-card {
        padding: 20px;
    }
}

/* Suggestions Dropdown */
.input-wrapper {
    position: relative;
    width: 100%;
}

.suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    animation: dropdownAppear 0.2s ease-out;
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.suggestion-item:hover,
.suggestion-item.highlighted {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    transform: translateX(4px);
}

.suggestion-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.suggestion-item .ingredient-name {
    font-weight: 500;
    flex: 1;
}

.suggestion-item .ingredient-category {
    font-size: 0.8rem;
    opacity: 0.7;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

.suggestion-item:hover .ingredient-category {
    background: rgba(255, 255, 255, 0.3);
}

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

.suggestions-dropdown::-webkit-scrollbar {
    width: 6px;
}

.suggestions-dropdown::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.suggestions-dropdown::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 3px;
}

.suggestions-dropdown::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5a6fd8, #6a4190);
}

/* Show all ingredients button */
.show-all-ingredients {
    display: block;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: none;
    border-top: 1px solid #e2e8f0;
    color: #4a5568;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 0 0 12px 12px;
}

.show-all-ingredients:hover {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* Packaged Food Notification Animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.packaged-food-header {
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    border: 2px solid #cbd5e0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: fadeInUp 0.5s ease-out;
}

.packaged-food-header .icon {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.packaged-food-header .content {
    flex: 1;
}

.packaged-food-header .product-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 4px;
}

.packaged-food-header .brand-name {
    color: #64748b;
    font-size: 0.9rem;
}

/* Animation delays for staggered card appearance */
.ingredient-card:nth-child(1) { animation-delay: 0.1s; }
.ingredient-card:nth-child(2) { animation-delay: 0.2s; }
.ingredient-card:nth-child(3) { animation-delay: 0.3s; }
.ingredient-card:nth-child(4) { animation-delay: 0.4s; }
.ingredient-card:nth-child(5) { animation-delay: 0.5s; }
.ingredient-card:nth-child(6) { animation-delay: 0.6s; }
.ingredient-card:nth-child(7) { animation-delay: 0.7s; }
.ingredient-card:nth-child(8) { animation-delay: 0.8s; }
.ingredient-card:nth-child(9) { animation-delay: 0.9s; }
.ingredient-card:nth-child(n+10) { animation-delay: 1s; }

/* Photo Capture Styles */
.photo-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.photo-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.photo-btn svg {
    width: 18px;
    height: 18px;
}

.photo-capture-container {
    padding: 20px;
    text-align: center;
}

.camera-viewport {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 300px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

#photo-camera-stream {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.capture-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.capture-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 60%;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    animation: captureFramePulse 2s ease-in-out infinite;
}

.capture-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #10b981;
}

.capture-corner.top-left {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-radius: 12px 0 0 0;
}

.capture-corner.top-right {
    top: -3px;
    right: -3px;
    border-left: none;
    border-bottom: none;
    border-radius: 0 12px 0 0;
}

.capture-corner.bottom-left {
    bottom: -3px;
    left: -3px;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 12px;
}

.capture-corner.bottom-right {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 12px 0;
}

.capture-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.photo-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.capture-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.capture-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
}

.upload-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.upload-btn:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}

.upload-btn svg, .capture-btn svg {
    width: 18px;
    height: 18px;
}

@keyframes captureFramePulse {
    0%, 100% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.02);
    }
}

/* Mobile responsive for photo capture */
@media (max-width: 768px) {
    .camera-viewport {
        height: 250px;
    }
    
    .photo-controls {
        flex-direction: column;
        align-items: center;
    }
    
    .capture-btn, .upload-btn {
        width: 100%;
        max-width: 200px;
    }
}
