:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --bg-tertiary: #1e1e1e;
    --bg-card: rgba(20, 20, 20, 0.95);
    --bg-card-light: rgba(30, 30, 30, 0.95);
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #707070;
    --accent: #00ff88;
    --accent-dim: #00cc6a;
    --accent-glow: rgba(0, 255, 136, 0.15);
    --accent-bg: rgba(0, 255, 136, 0.1);
    --border: #2a2a2a;
    --border-light: #3a3a3a;
    --radius: 16px;
    --radius-lg: 24px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    position: relative;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    width: 100%;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 255, 136, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 200, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(138, 43, 226, 0.04) 0%, transparent 50%);
    z-index: 0;
    pointer-events: none;
}

main, header, nav, footer {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
header {
    background: var(--bg-primary);
    padding: 4rem 0 2.5rem;
    border-bottom: 1px solid var(--border);
}

header .container {
    text-align: center;
}

header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent), #00c8ff);
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

header h1 a {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.tagline {
    color: var(--text-secondary);
    font-size: clamp(0.875rem, 1.5vw, 1rem);
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* Navigation Tabs */
.tab-navigation {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(0, 255, 136, 0.05);
}

.tab-navigation .container {
    display: flex;
    gap: 0.5rem;
}

.tab-btn {
    flex: 1;
    padding: 1rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: clamp(0.875rem, 1.5vw, 0.9375rem);
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    border-radius: var(--radius) var(--radius) 0 0;
    position: relative;
}

.tab-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-glow);
    opacity: 0;
    transition: opacity var(--transition);
    border-radius: var(--radius) var(--radius) 0 0;
}

.tab-btn:hover {
    color: var(--text-primary);
    transform: translateY(-2px);
}

.tab-btn:hover::before {
    opacity: 1;
}

.tab-btn.active {
    color: var(--accent);
    background: var(--bg-tertiary);
    border-bottom-color: var(--accent);
    box-shadow: 0 -2px 12px var(--accent-glow);
}

.tab-btn.active .icon {
    animation: iconPop 0.5s var(--transition-bounce);
}

@keyframes iconPop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(5deg); }
}

.tab-btn .icon {
    display: none;
}

/* Main Content */
main {
    padding: 2rem 0;
    min-height: calc(100vh - 250px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

#search-section.active:not(:has(#product-detail[style*="display: block"])) {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 300px);
}

#compare-section.active {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100vh - 300px);
}

#recipe-section.active .recipe-layout {
    display: block;
}

#recipe-section.active:not(:has(#recipe-items:not(:empty))) .recipe-layout {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 300px);
}

#recipe-section.active:not(:has(#recipe-items:not(:empty))) .recipe-ingredients {
    width: 100%;
    max-width: 1400px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Search Box */
.search-box {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    width: 100%;
}

/* Search boxes in main sections (not in recipe) */
#search-section .search-box,
#compare-section .search-box {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

.search-box h2, .search-box h3 {
    margin-bottom: 1.25rem;
    color: var(--accent);
    font-weight: 600;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
    text-align: center;
}

.input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-group input {
    flex: 1;
    width: 100%;
    padding: 0.875rem 2.5rem 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    transition: var(--transition);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

/* Clear Button */
.clear-btn {
    position: absolute;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
    z-index: 10;
}

.clear-btn:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
    transform: scale(1.1);
}

/* Buttons */
.btn {
    padding: 0.875rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
    border-color: var(--accent);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    background: var(--accent-dim);
    border-color: var(--accent-dim);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 24px rgba(0, 255, 136, 0.3),
        0 0 40px var(--accent-glow);
}

.btn-secondary {
    background: var(--bg-card-light);
    color: var(--text-primary);
    border-color: var(--border-light);
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: rgba(42, 42, 42, 0.9);
    border-color: var(--accent);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), 0 0 20px var(--accent-glow);
}

.btn-danger {
    background: #ff3860;
    color: white;
    border-color: #ff3860;
    position: relative;
    overflow: hidden;
}

.btn-danger::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transition: opacity var(--transition);
}

.btn-danger:hover {
    background: #ff1744;
    border-color: #ff1744;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 8px 24px rgba(255, 56, 96, 0.4),
        0 0 32px rgba(255, 56, 96, 0.3);
    animation: dangerPulse 2s infinite;
}

.btn-danger:hover::after {
    opacity: 1;
}

@keyframes dangerPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(255, 56, 96, 0.4), 0 0 32px rgba(255, 56, 96, 0.3); }
    50% { box-shadow: 0 8px 24px rgba(255, 56, 96, 0.6), 0 0 48px rgba(255, 56, 96, 0.5); }
}

.btn-small {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
}

/* Results List */
.results-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 0.5rem;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.result-card {
    background: var(--bg-card);
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    opacity: 0;
    animation: slideIn 0.3s ease forwards;
    position: relative;
    overflow: visible;
    min-height: 60px;
}

.result-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-glow), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-card:nth-child(1) { animation-delay: 0.05s; }
.result-card:nth-child(2) { animation-delay: 0.1s; }
.result-card:nth-child(3) { animation-delay: 0.15s; }
.result-card:nth-child(4) { animation-delay: 0.2s; }
.result-card:nth-child(5) { animation-delay: 0.25s; }
.result-card:nth-child(6) { animation-delay: 0.3s; }
.result-card:nth-child(7) { animation-delay: 0.35s; }
.result-card:nth-child(8) { animation-delay: 0.4s; }
.result-card:nth-child(9) { animation-delay: 0.45s; }
.result-card:nth-child(10) { animation-delay: 0.5s; }

.result-card:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: translateX(6px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 255, 136, 0.15);
}

.result-card.added {
    background: var(--accent-bg);
    border-color: var(--accent);
}

.result-card.added::before {
    opacity: 0.3;
}

.result-card.added h3 {
    color: var(--accent);
}

.result-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.result-card-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.result-card h3 {
    font-size: 0.9375rem;
    margin: 0;
    color: var(--text-primary);
    flex: 1;
    font-weight: 500;
    transition: color var(--transition);
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.result-card .category {
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 150px;
}

.result-card .generic-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.8125rem;
    white-space: nowrap;
    font-weight: 500;
}

.result-card .max-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background: rgba(255, 56, 96, 0.2);
    color: #ff3860;
    border: 1px solid #ff3860;
    border-radius: 6px;
    font-size: 0.8125rem;
    white-space: nowrap;
    font-weight: 500;
}

/* Back to Search Button */
#back-to-search {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

#back-to-search:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateX(-4px) scale(1.02);
    box-shadow: 0 4px 16px rgba(0, 255, 136, 0.15);
}

/* Product Detail */
.product-detail {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

#product-info {
    margin: 0 0 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

#product-info h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nutrition Table */
.nutrition-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card-light);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.nutrition-table th {
    background: rgba(30, 30, 30, 0.8);
    color: var(--text-primary);
    padding: 0.875rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: clamp(0.8125rem, 1.5vw, 0.875rem);
    border-bottom: 1px solid var(--border);
}

.nutrition-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: clamp(0.8125rem, 1.5vw, 0.875rem);
    color: var(--text-secondary);
}

.nutrition-table .group-header {
    background: rgba(20, 20, 20, 0.8);
    font-weight: 600;
    color: var(--accent) !important;
    padding-top: 1.5rem;
    font-size: clamp(0.875rem, 1.5vw, 0.9375rem);
    text-shadow: 0 0 20px var(--accent-glow);
    position: relative;
}

.nutrition-table .group-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.nutrition-table .group-header td {
    color: var(--accent) !important;
}

/* Compare Section */
.compare-container {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    max-width: 1400px;
    margin: 1.5rem auto 0;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.compare-header h3,
.recipe-summary h3 {
    color: var(--accent);
}

.compare-list {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.compare-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 1rem;
    background: var(--bg-card-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: clamp(0.8125rem, 1.5vw, 0.875rem);
    color: var(--text-primary);
    transition: all var(--transition);
}

.compare-item:hover {
    border-color: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.compare-item .remove-btn {
    background: transparent;
    color: var(--text-tertiary);
    border: none;
    cursor: pointer;
    font-size: 1.125rem;
    padding: 0;
    width: 20px;
    height: 20px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.compare-item .remove-btn:hover {
    color: var(--accent);
}

.compare-table-wrapper {
    overflow-x: auto;
    margin-top: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Mobile Cards (hidden on desktop) */
.compare-mobile-cards {
    display: none;
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.compare-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.compare-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.compare-table .best-value {
    background: rgba(0, 255, 136, 0.05);
    color: var(--accent);
    font-weight: 500;
    border: 2px solid var(--accent);
    border-radius: 6px;
}

/* Best value in mobile cards */
    .mobile-card-row .nutrient-value.best-value {
        color: var(--accent);
        font-weight: 600;
        border: 2px solid var(--accent);
        border-radius: 6px;
        padding: 0.25rem 0.5rem;
        background: var(--accent-bg);
    }.compare-table .group-header td {
    color: var(--accent) !important;
    font-weight: 600;
}

.compare-table .group-header td strong {
    color: var(--accent) !important;
}

/* Recipe Section */
.recipe-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.recipe-ingredients {
    grid-column: 1 / -1;
}

.recipe-ingredients .search-box {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 1024px) {
    .recipe-layout {
        grid-template-columns: 1fr;
    }
    
    .recipe-summary {
        margin-top: 1.5rem;
    }
    
    .recipe-ingredients {
        grid-column: auto;
    }
}

.recipe-ingredients {
    background: transparent;
    padding: 0;
    border: none;
}

.recipe-summary {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all var(--transition);
}

.recipe-summary:hover {
    border-color: var(--border-light);
    box-shadow: 
        0 12px 48px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 0 0 1px var(--accent-glow);
}

.recipe-list {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-top: 1.5rem;
}

.recipe-list h3 {
    margin-bottom: 1rem;
    color: var(--accent);
    font-weight: 600;
}

#recipe-items {
    margin-bottom: 1rem;
}

.recipe-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-card-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 0.75rem;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.recipe-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--accent-glow), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.recipe-item:hover {
    border-color: var(--accent);
    transform: translateX(4px) scale(1.01);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.recipe-item:hover::before {
    opacity: 1;
}

.recipe-item .item-name {
    flex: 1;
    font-weight: 500;
    font-size: clamp(0.875rem, 1.5vw, 0.9375rem);
    color: var(--text-primary);
    position: relative;
    z-index: 1;
    transition: all var(--transition);
}

.recipe-item:hover .item-name {
    color: var(--accent);
    transform: translateX(4px);
}

.recipe-item .item-amount {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    color: var(--text-secondary);
    position: relative;
    z-index: 2;
}

.recipe-item .item-amount button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--accent);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
}

.recipe-item .item-amount button:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

.recipe-item .item-amount input {
    width: 70px;
    min-width: 70px;
    padding: 0.4rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--bg-secondary);
    color: var(--text-primary);
    position: relative;
    z-index: 2;
    flex-shrink: 0;
}

.recipe-item .item-amount span {
    flex-shrink: 0;
}

.recipe-item input {
    width: 80px;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    font-size: 0.875rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    position: relative;
    z-index: 2;
}

.recipe-item input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Remove number input arrows */
.recipe-item input[type="number"]::-webkit-inner-spin-button,
.recipe-item input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.recipe-item input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.recipe-item .remove-btn {
    background: transparent;
    color: var(--text-tertiary);
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.25rem;
    position: relative;
    z-index: 2;
}

.recipe-item .remove-btn:hover {
    color: var(--accent);
}

.servings-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.servings-control label {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.servings-control input {
    width: 80px;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: center;
    font-size: 0.9375rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.servings-control input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Remove number input arrows for servings control */
.servings-control input[type="number"]::-webkit-inner-spin-button,
.servings-control input[type="number"]::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button,
.no-spinner::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.servings-control input[type="number"],
.no-spinner {
    -moz-appearance: textfield;
    appearance: textfield;
}

.nutrition-summary {
    background: transparent;
    padding: 0;
}

.nutrition-item {
    display: flex;
    justify-content: space-between;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9375rem;
}

.nutrition-item:last-child {
    border-bottom: none;
}

.nutrition-item strong {
    color: var(--text-primary);
    font-weight: 500;
}

.nutrition-item .value {
    color: var(--accent);
    font-weight: 500;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 2.5rem 0;
    text-align: center;
    margin-top: 4rem;
}

footer p {
    font-size: 0.9375rem;
    line-height: 1.6;
    margin: 0;
}

footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

footer a:hover {
    color: var(--accent-dim);
    text-decoration: underline;
}

footer .small {
    font-size: 0.8125rem;
    margin-top: 1rem;
    opacity: 0.7;
    line-height: 1.5;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 10, 0.98);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.empty-state .icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Nutrition Bar */
.nutrition-bar-container {
    position: relative;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.nutrition-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-dim));
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 3px;
    min-width: 2px;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.nutrition-bar-label {
    position: absolute;
    top: -22px;
    left: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

.compare-table .nutrition-bar-container {
    margin: 0.25rem 0;
    height: 4px;
}

.best-value .nutrition-bar {
    background: linear-gradient(90deg, var(--accent), var(--accent-dim));
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    header {
        padding: 2.5rem 0 1.5rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .tagline {
        font-size: 0.875rem;
    }

    .tab-btn {
        font-size: 0.8125rem;
        padding: 0.875rem 0.5rem;
    }

    .search-box {
        padding: 1.5rem 1rem;
        max-width: none;
        margin-left: 0;
        margin-right: 0;
    }

    .input-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    /* Compare Mobile Optimization */
    .compare-container {
        padding: 1rem;
    }

    .compare-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .compare-header h3 {
        font-size: 1.125rem;
    }

    .compare-header .btn-danger {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }

    .compare-list {
        flex-direction: column;
        gap: 0.5rem;
    }

    .compare-item {
        width: 100%;
        justify-content: space-between;
    }

    /* Hide table on mobile, show card layout instead */
    .compare-table-wrapper {
        display: none;
    }

    /* Mobile Card Layout */
    .compare-mobile-cards {
        display: grid;
        gap: 1rem;
    }

    .compare-mobile-card {
        background: var(--bg-card-light);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 1rem;
    }

    .mobile-card-title {
        color: var(--accent);
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border);
    }

    .mobile-card-group {
        margin-bottom: 1rem;
    }

    .mobile-card-group:last-child {
        margin-bottom: 0;
    }

    .mobile-card-group h5 {
        color: var(--accent);
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        opacity: 0.8;
    }

    .mobile-card-row {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid rgba(42, 42, 42, 0.5);
        font-size: 0.875rem;
    }

    .mobile-card-row:last-child {
        border-bottom: none;
    }

    .nutrient-name {
        color: var(--text-secondary);
    }

    .nutrient-value {
        color: var(--text-primary);
        font-weight: 500;
    }

    .nutrition-bar-container {
        height: 3px;
    }

    /* Recipe Mobile */
    .recipe-layout {
        gap: 1rem;
    }

    .recipe-ingredients,
    .recipe-summary {
        padding: 1.5rem 1rem;
    }

    .recipe-item {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .recipe-item .item-name {
        text-align: left;
        white-space: normal;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    .recipe-item .item-amount {
        justify-content: space-between;
        width: 100%;
    }

    .recipe-item .remove-btn {
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
    }

    /* Back to Search Mobile */
    #back-to-search {
        width: 100%;
        justify-content: center;
        padding: 0.875rem 1.25rem;
        margin-bottom: 1.25rem;
    }

    /* Product Detail Mobile */
    .product-detail {
        padding: 1.5rem 1rem;
    }

    #product-info h2 {
        font-size: 1.5rem;
    }

    .nutrition-table th,
    .nutrition-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8125rem;
    }

    /* Results Grid Mobile */
    .results-grid {
        max-height: 280px;
    }

    .result-card {
        padding: 1rem;
    }

    .result-card h3 {
        font-size: 0.875rem;
    }

    /* Footer Mobile */
    footer {
        padding: 2rem 1rem;
    }

    footer p {
        font-size: 0.875rem;
    }

    footer .small {
        font-size: 0.75rem;
    }
}
