/* ===========================================
   KnowExpire - Styles
   =========================================== */

/* Font Face Declarations (self-hosted) */
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/dm-sans.woff2') format('woff2');
}

@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/fonts/dm-sans.woff2') format('woff2');
}

@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/dm-sans.woff2') format('woff2');
}

@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/dm-sans.woff2') format('woff2');
}

@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/fraunces.woff2') format('woff2');
}

@font-face {
    font-family: 'Fraunces';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/fraunces.woff2') format('woff2');
}

/* ===========================================
   Reset & CSS Variables
   =========================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --bg-card-hover: #1f2b4d;
    --accent-coral: #ff6b6b;
    --accent-yellow: #ffd93d;
    --accent-green: #6bcb77;
    --accent-blue: #4d96ff;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #6b6b7b;
    --radius: 16px;
    --radius-sm: 10px;
}

/* ===========================================
   Base Layout
   =========================================== */
body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.app {
    max-width: 480px;
    margin: 0 auto;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: 0 20px 90px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ===========================================
   Offline Indicator (NEW)
   =========================================== */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--accent-coral);
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 0.8125rem;
    font-weight: 500;
    z-index: 300;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-indicator.show {
    transform: translateY(0);
}

.app.has-offline-banner {
    padding-top: 40px;
}

/* ===========================================
   Header
   =========================================== */
header {
    padding: 12px 0 8px;
    text-align: center;
    position: relative;
}

.logo {
    font-family: 'Fraunces', serif;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-coral), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.settings-btn {
    position: absolute;
    right: 0;
    top: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.settings-btn svg {
    width: 22px;
    height: 22px;
}

/* ===========================================
   Notification Banner
   =========================================== */
.notification-banner {
    background: linear-gradient(135deg, var(--bg-card), var(--bg-card-hover));
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    display: none;
}

.notification-banner.show {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.notification-banner-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.notification-banner-icon {
    flex-shrink: 0;
    color: var(--accent-coral);
}

.notification-banner-icon svg {
    width: 24px;
    height: 24px;
}

.notification-banner-text h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.notification-banner-text p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.notification-banner-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.notification-banner-btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    border: none;
}

.notification-banner-btn.primary {
    background: var(--accent-coral);
    color: white;
}

.notification-banner-btn.primary:hover {
    background: #ff5252;
}

.notification-banner-btn.secondary {
    background: transparent;
    color: var(--text-secondary);
}

.notification-banner-btn.secondary:hover {
    color: var(--text-primary);
}

/* ===========================================
   Stats Bar
   =========================================== */
.stats-bar {
    display: flex;
    gap: 10px;
    margin: 10px 0 10px;
    flex-shrink: 0;
}

.stat-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 12px 10px;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-number {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    font-weight: 700;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stat-card:hover .stat-number {
    transform: scale(1.2);
}

/* Animated number change */
.stat-number.changed {
    animation: popIn 0.4s ease;
}

.stat-number.urgent {
    color: var(--accent-coral);
}

.stat-number.soon {
    color: var(--accent-yellow);
}

.stat-number.fresh {
    color: var(--accent-green);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===========================================
   Section Headers
   =========================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 24px 0 12px;
}

.section-title {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.section-urgent::before {
    background: var(--accent-coral);
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
}

.section-soon::before {
    background: var(--accent-yellow);
    box-shadow: 0 0 8px rgba(255, 217, 61, 0.5);
}

.section-fresh::before {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(107, 203, 119, 0.5);
}

.section-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===========================================
   Food Items
   =========================================== */
.food-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.food-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    animation: slideIn 0.4s ease forwards;
    opacity: 0;
}

.food-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(8px) scale(1.02);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.food-item:active {
    transform: translateX(4px) scale(0.98);
}

/* Swipe hint animation on urgent items */
.food-item.urgent {
    animation: slideIn 0.4s ease forwards, pulse 2s ease-in-out 1s;
}

.food-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.food-item.urgent::before {
    background: var(--accent-coral);
}

.food-item.soon::before {
    background: var(--accent-yellow);
}

.food-item.fresh::before {
    background: var(--accent-green);
}

.food-emoji {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.food-item:hover .food-emoji {
    transform: scale(1.15) rotate(-5deg);
    animation: bounce 0.6s ease;
}

.food-info {
    flex: 1;
    min-width: 0;
}

.food-name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-quantity {
    display: inline-block;
    background: var(--accent-coral);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

.food-expiry {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.food-expiry.urgent {
    color: var(--accent-coral);
}

.food-expiry.soon {
    color: var(--accent-yellow);
}

.food-days {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 50px;
    text-align: right;
}

.food-days.urgent {
    color: var(--accent-coral);
}

.food-days.soon {
    color: var(--accent-yellow);
}

.food-days.fresh {
    color: var(--accent-green);
}

.days-label {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.625rem;
    font-weight: 400;
    color: var(--text-secondary);
    display: block;
}

/* ===========================================
   Empty State
   =========================================== */
.empty-state {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0;
    animation: fadeIn 0.6s ease;
}

.empty-state-icon {
    margin-bottom: 8px;
    color: var(--text-muted);
}

.empty-state-icon svg {
    width: 48px;
    height: 48px;
}

.empty-state-title {
    font-family: 'Fraunces', serif;
    font-size: 1.125rem;
    margin-bottom: 6px;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Animated arrow pointing to add button */
.empty-state-arrow {
    position: fixed;
    bottom: 90px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    animation: bounce 1.5s ease-in-out infinite;
    color: var(--accent-coral);
    pointer-events: none;
}

.empty-state-arrow svg {
    width: 22px;
    height: 22px;
}

/* ===========================================
   Bottom Navigation
   =========================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 20px 28px;
    display: flex;
    justify-content: center;
    gap: 40px;
}

.nav-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: color 0.2s;
    padding: 8px;
}

.nav-btn.active {
    color: var(--accent-coral);
}

.nav-btn svg {
    width: 24px;
    height: 24px;
}

.add-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-coral), #ff8e53);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.4);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    position: relative;
    overflow: hidden;
}

.add-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.add-btn:hover {
    transform: scale(1.15) rotate(90deg);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.6);
}

.add-btn:hover::before {
    opacity: 1;
}

.add-btn:active {
    transform: scale(0.95) rotate(90deg);
}

/* Ripple effect for add button */
.add-btn .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    animation: ripple 0.6s ease-out;
    pointer-events: none;
}

/* ===========================================
   Modals
   =========================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    overflow: hidden;
    overscroll-behavior: contain;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    border-radius: var(--radius) var(--radius) 0 0;
    width: calc(100% - 40px);
    max-width: 480px;
    max-height: 90vh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px 20px 40px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
    touch-action: pan-y;
    margin: 0 auto;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 2px;
    margin: 0 auto 20px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-dark);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.modal-close svg {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.modal-close:hover {
    background: var(--accent-coral);
}

.modal-close:hover svg {
    color: white;
}

.modal-close:active {
    transform: scale(0.95);
}

.modal-title {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 24px;
}

/* ===========================================
   Forms
   =========================================== */
.form-group {
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    background: var(--bg-dark);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-coral);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* ===========================================
   Date Input with Icon
   =========================================== */
.date-input-wrapper {
    position: relative;
    margin-top: 12px;
    width: 100%;
    box-sizing: border-box;
}

.date-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

input[type="date"].date-input {
    display: block;
    width: 100%;
    max-width: 100%;
    background: var(--bg-dark);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    padding: 14px 16px 14px 44px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="date"].date-input:focus {
    outline: none;
    border-color: var(--accent-coral);
}

/* Hide the default date text when empty and show placeholder */
.date-input:not(:focus):invalid,
.date-input[value=""]:not(:focus) {
    color: transparent;
}

.date-placeholder {
    position: absolute;
    left: 44px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    font-size: 1rem;
    transition: opacity 0.2s;
}

.date-input:focus ~ .date-placeholder,
.date-input.has-value ~ .date-placeholder {
    opacity: 0;
}

/* Style the date input for better mobile appearance */
.date-input::-webkit-calendar-picker-indicator {
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* ===========================================
   Emoji Picker
   =========================================== */
.emoji-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.emoji-btn {
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
    background: var(--bg-dark);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.emoji-btn:hover {
    background: var(--bg-card-hover);
    transform: scale(1.15);
}

.emoji-btn:active {
    transform: scale(0.95);
}

.emoji-btn.selected {
    border-color: var(--accent-coral);
    background: rgba(255, 107, 107, 0.1);
    transform: scale(1.1);
    animation: popIn 0.3s ease;
}

.emoji-btn-custom {
    font-size: 1.25rem;
    color: var(--accent-coral);
    font-weight: 600;
}

.custom-emoji-input {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.custom-emoji-input .form-input {
    flex: 1;
    text-align: center;
    font-size: 1.5rem;
}

.custom-emoji-confirm {
    padding: 12px 16px;
    background: var(--accent-coral);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}

.custom-emoji-confirm:hover {
    background: #ff5252;
}

/* ===========================================
   Quick Expiry Buttons
   =========================================== */
.quick-expiry {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.quick-btn {
    padding: 10px 16px;
    background: var(--bg-dark);
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.quick-btn:hover {
    background: var(--bg-card-hover);
}

.quick-btn.selected {
    border-color: var(--accent-coral);
    background: rgba(255, 107, 107, 0.1);
}

/* ===========================================
   Buttons
   =========================================== */
/* Save buttons container */
.save-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

.submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent-coral), #ff8e53);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: inherit;
    margin-top: 0;
    position: relative;
    overflow: hidden;
}

.submit-btn.secondary {
    background: transparent;
    border: 2px solid var(--accent-coral);
    color: var(--accent-coral);
    padding: 14px;
}

.submit-btn.secondary:hover {
    background: rgba(255, 107, 107, 0.1);
    box-shadow: none;
}

.submit-btn.secondary:disabled {
    border-color: var(--text-muted);
    color: var(--text-muted);
}

.submit-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;
}

.submit-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.5);
}

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

.submit-btn:active {
    transform: translateY(0) scale(0.98);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-btn:disabled::before {
    display: none;
}

/* Loading state */
.submit-btn.loading {
    pointer-events: none;
    color: transparent;
}

.submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.delete-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.delete-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.delete-btn.confirm {
    background: var(--accent-coral);
    color: white;
}

.delete-btn.cancel {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.delete-btn:hover {
    transform: translateY(-2px);
}

/* ===========================================
   Settings
   =========================================== */
.settings-section {
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-info h4 {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 2px;
}

.settings-item-info p {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.toggle {
    position: relative;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--accent-coral);
}

.toggle input:checked + .toggle-slider:before {
    background: white;
    transform: translateX(22px);
}

.notification-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    margin-top: 12px;
}

.notification-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.notification-status-dot.enabled {
    background: var(--accent-green);
}

.notification-status-dot.disabled {
    background: var(--accent-coral);
}

.notification-status-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ===========================================
   Animations
   =========================================== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    70% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 107, 107, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 107, 107, 0.8), 0 0 30px rgba(255, 107, 107, 0.4);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ===========================================
   Gamification - Streak & Achievements
   =========================================== */
.streak-banner {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 217, 61, 0.2);
    position: relative;
    overflow: hidden;
}

.streak-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 217, 61, 0.1), transparent);
    animation: shimmer 3s infinite;
}

.streak-fire {
    animation: float 2s ease-in-out infinite;
    color: var(--accent-yellow);
}

.streak-fire svg {
    width: 32px;
    height: 32px;
}

.streak-info {
    flex: 1;
}

.streak-count {
    font-family: 'Fraunces', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-yellow);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.streak-count span {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.streak-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.streak-progress {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.streak-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg-dark);
    transition: all 0.3s;
}

.streak-dot.filled {
    background: var(--accent-yellow);
    box-shadow: 0 0 8px rgba(255, 217, 61, 0.5);
}

.streak-dot.today {
    animation: glow 1.5s ease-in-out infinite;
}

/* Achievement Badge */
.achievement-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    z-index: 250;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 2px solid var(--accent-yellow);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.achievement-popup.show {
    transform: translate(-50%, -50%) scale(1);
}

.achievement-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: bounce 0.8s ease infinite;
}

.achievement-icon-svg {
    color: var(--accent-yellow);
}

.achievement-icon-svg svg {
    width: 64px;
    height: 64px;
}

.achievement-title {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-yellow);
    margin-bottom: 8px;
}

.achievement-desc {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 20px;
}

.achievement-close {
    padding: 12px 32px;
    background: linear-gradient(135deg, var(--accent-yellow), #ffb347);
    border: none;
    border-radius: var(--radius-sm);
    color: #1a1a2e;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.2s;
}

.achievement-close:hover {
    transform: scale(1.05);
}

/* Confetti */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 300;
    overflow: hidden;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    animation: confettiFall 3s linear forwards;
}

/* Level Progress Bar */
.level-bar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-bottom: 10px;
}

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

.level-title {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.level-badge {
    background: linear-gradient(135deg, var(--accent-coral), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.level-xp {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.level-progress-track {
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    overflow: hidden;
}

.level-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-coral), var(--accent-yellow));
    border-radius: 3px;
    transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
}

.level-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

/* ===========================================
   Toast
   =========================================== */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px) scale(0.8);
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    color: var(--text-primary);
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 200;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
}

.toast.success {
    border-color: rgba(107, 203, 119, 0.3);
}

.toast.success::before {
    content: '✓';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--accent-green);
    border-radius: 50%;
    font-size: 0.75rem;
}

/* ===========================================
   Views
   =========================================== */
.view {
    display: none;
}

.view.active {
    display: block;
    flex: 1 1 auto;
}

/* ===========================================
   Recipe Styles
   =========================================== */
.recipe-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.recipe-card:hover {
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

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

.recipe-title {
    font-family: 'Fraunces', serif;
    font-size: 1.125rem;
    flex: 1;
}

.recipe-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-dark);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    margin-left: 8px;
}

.recipe-match {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.recipe-match-item {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.recipe-match-item.have {
    background: rgba(107, 203, 119, 0.15);
    color: var(--accent-green);
}

.recipe-match-item.missing {
    background: rgba(255, 107, 107, 0.15);
    color: var(--accent-coral);
}

.recipe-meta {
    display: flex;
    gap: 12px;
    margin-bottom: 8px;
}

.recipe-meta-item {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.recipe-tag {
    display: inline-block;
    background: rgba(255, 107, 107, 0.1);
    color: var(--accent-coral);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
}

.recipe-tag.expiring {
    background: rgba(255, 217, 61, 0.15);
    color: var(--accent-yellow);
}

/* Recipe detail modal */
.recipe-detail-header {
    text-align: center;
    margin-bottom: 24px;
}

.recipe-detail-title {
    font-family: 'Fraunces', serif;
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.recipe-detail-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.recipe-section {
    margin-bottom: 24px;
}

.recipe-section-title {
    font-family: 'Fraunces', serif;
    font-size: 1.125rem;
    margin-bottom: 12px;
    color: var(--accent-coral);
}

.recipe-ingredients-list {
    list-style: none;
}

.recipe-ingredients-list li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9375rem;
}

.recipe-ingredients-list li:last-child {
    border-bottom: none;
}

.ingredient-check {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.ingredient-check.have {
    background: rgba(107, 203, 119, 0.2);
    color: var(--accent-green);
}

.ingredient-check.missing {
    background: rgba(255, 107, 107, 0.2);
    color: var(--accent-coral);
}

.recipe-steps {
    counter-reset: step;
}

.recipe-step {
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 14px;
}

.recipe-step:last-child {
    border-bottom: none;
}

.recipe-step-number {
    width: 28px;
    height: 28px;
    background: var(--accent-coral);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    flex-shrink: 0;
}

.recipe-step-text {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.recipe-tips {
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin-top: 16px;
}

.recipe-tips-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-yellow);
}

.recipe-tips-title::before {
    content: '';
    width: 16px;
    height: 16px;
    background: var(--accent-yellow);
    border-radius: 50%;
    display: inline-block;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a1a2e' stroke-width='2'%3E%3Cpath d='M9 18h6M10 22h4M12 2v1M12 7l.01 0M4.2 4.2l.7.7M19.8 4.2l-.7.7M21 12h-1M4 12H3M12 17a5 5 0 0 0 0-10 5 5 0 0 0 0 10z'/%3E%3C/svg%3E");
    background-size: 12px 12px;
    background-position: center;
    background-repeat: no-repeat;
}

.recipe-tips-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.no-recipes {
    text-align: center;
    padding: 40px 20px;
}

.no-recipes-icon {
    margin-bottom: 12px;
    color: var(--text-muted);
}

.no-recipes-icon svg {
    width: 48px;
    height: 48px;
}

.no-recipes-title {
    font-family: 'Fraunces', serif;
    font-size: 1.125rem;
    margin-bottom: 8px;
}

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

/* ===========================================
   Scanner Styles
   =========================================== */
.barcode-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.scan-btn {
    flex: 1;
    padding: 14px 12px;
    background: var(--bg-dark);
    border: 2px dashed var(--accent-coral);
    border-radius: var(--radius-sm);
    color: var(--accent-coral);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.scan-btn-secondary {
    border-style: solid;
    border-color: var(--text-muted);
    color: var(--text-secondary);
}

.scan-btn-secondary:hover {
    border-color: var(--accent-coral);
    color: var(--accent-coral);
}

.scan-btn.preferred {
    border-color: var(--accent-coral);
    background: rgba(255, 107, 107, 0.1);
}

.scan-btn:hover {
    background: rgba(255, 107, 107, 0.1);
}

.scan-btn:active {
    transform: scale(0.98);
}

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

.scan-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.scanner-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 200;
    display: none;
    flex-direction: column;
}

.scanner-overlay.active {
    display: flex;
}

.scanner-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 10;
}

.scanner-title {
    color: white;
    font-size: 1rem;
    font-weight: 600;
}

.scanner-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
}

.scanner-video-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Ensure html5-qrcode video elements are properly sized */
.scanner-video-container video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-guide {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 150px;
    border: 3px solid var(--accent-coral);
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

.scanner-guide::before,
.scanner-guide::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: var(--accent-coral);
    border-style: solid;
}

.scanner-guide::before {
    top: -3px;
    left: -3px;
    border-width: 3px 0 0 3px;
    border-radius: 12px 0 0 0;
}

.scanner-guide::after {
    top: -3px;
    right: -3px;
    border-width: 3px 3px 0 0;
    border-radius: 0 12px 0 0;
}

.scanner-corners::before,
.scanner-corners::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: var(--accent-coral);
    border-style: solid;
}

.scanner-corners::before {
    bottom: -3px;
    left: -3px;
    border-width: 0 0 3px 3px;
    border-radius: 0 0 0 12px;
}

.scanner-corners::after {
    bottom: -3px;
    right: -3px;
    border-width: 0 3px 3px 0;
    border-radius: 0 0 12px 0;
}

.scanner-line {
    position: absolute;
    top: 0;
    left: 10px;
    right: 10px;
    height: 2px;
    background: var(--accent-coral);
    animation: scanLine 2s ease-in-out infinite;
}

@keyframes scanLine {
    0%, 100% {
        top: 10px;
    }
    50% {
        top: calc(100% - 10px);
    }
}

.scanner-footer {
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    text-align: center;
}

.scanner-status {
    color: white;
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.scanner-manual-btn {
    background: var(--bg-card);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    font-family: inherit;
}

.product-found {
    background: var(--bg-dark);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 16px;
    display: none;
}

.product-found.show {
    display: block;
}

.product-found-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.product-found-badge {
    background: var(--accent-green);
    color: white;
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.product-found-name {
    font-weight: 600;
    font-size: 0.9375rem;
}

.product-found-details {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* ===========================================
   Onboarding Overlay
   =========================================== */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 250;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s ease;
}

.onboarding-overlay.active {
    opacity: 1;
    visibility: visible;
}

.onboarding-slide {
    text-align: center;
    padding: 40px 30px;
    max-width: 360px;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.5s ease;
}

.onboarding-slide.active {
    transform: translateY(0);
    opacity: 1;
}

.onboarding-icon {
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
    color: var(--accent-coral);
}

.onboarding-icon svg {
    width: 64px;
    height: 64px;
}

.onboarding-title {
    font-family: 'Fraunces', serif;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--accent-coral), var(--accent-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.onboarding-text {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

.onboarding-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 32px;
}

.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s;
}

.onboarding-dot.active {
    background: var(--accent-coral);
    width: 24px;
    border-radius: 4px;
}

.onboarding-btn {
    padding: 16px 48px;
    background: linear-gradient(135deg, var(--accent-coral), #ff8e53);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.onboarding-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.5);
}

.onboarding-skip {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.875rem;
    cursor: pointer;
    padding: 8px 16px;
    font-family: inherit;
}

.onboarding-skip:hover {
    color: var(--text-primary);
}

/* ===========================================
   Welcome Back Message
   =========================================== */
.welcome-message {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-card-hover) 100%);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.5s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.welcome-emoji {
    font-size: 2rem;
}

.welcome-text {
    flex: 1;
}

.welcome-greeting {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.welcome-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.welcome-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

/* ===========================================
   Responsive - Desktop Enhancements
   (Base styles are mobile-first, these enhance for larger screens)
   =========================================== */

/* Small phones (320px and below) - tighten spacing */
@media (max-width: 320px) {
    .app {
        padding: 0 12px 100px;
    }

    .stats-bar {
        gap: 6px;
    }

    .stat-card {
        padding: 10px 6px;
    }

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

    .bottom-nav {
        gap: 24px;
        padding: 10px 16px 24px;
    }

    .add-btn {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }

    .nav-btn {
        font-size: 0.6875rem;
    }

    .nav-btn svg {
        width: 20px;
        height: 20px;
    }

    .emoji-picker {
        gap: 4px;
    }

    .emoji-btn {
        width: 38px;
        height: 38px;
        font-size: 1.125rem;
    }

    .quick-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
}

/* Standard mobile (380px and below) */
@media (max-width: 380px) {
    .app {
        padding: 0 16px 100px;
    }

    .logo {
        font-size: 1.5rem;
    }

    .stats-bar {
        gap: 8px;
    }

    .stat-card {
        padding: 12px 8px;
    }

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

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

    .food-item {
        padding: 14px 12px;
        gap: 10px;
    }

    .food-emoji {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .food-name {
        font-size: 0.9375rem;
    }

    .food-days {
        font-size: 1.125rem;
        min-width: 45px;
    }

    .emoji-picker {
        gap: 6px;
    }

    .emoji-btn {
        width: 42px;
        height: 42px;
        font-size: 1.25rem;
    }

    .quick-expiry {
        gap: 6px;
    }

    .quick-btn {
        padding: 8px 12px;
        font-size: 0.8125rem;
    }

    .notification-banner {
        padding: 14px;
    }

    .notification-banner-text h3 {
        font-size: 0.875rem;
    }

    .notification-banner-text p {
        font-size: 0.75rem;
    }

    .recipe-card {
        padding: 16px;
    }

    .recipe-title {
        font-size: 1rem;
    }

    .recipe-match-item {
        font-size: 0.6875rem;
        padding: 3px 6px;
    }

    .level-bar {
        padding: 10px 14px;
    }

    .streak-banner {
        padding: 12px;
        gap: 12px;
    }

    .streak-fire svg {
        width: 32px;
        height: 32px;
    }

    .streak-count {
        font-size: 1.25rem;
    }
}

/* Larger phones and tablets */
@media (min-width: 481px) {
    .app {
        padding: 0 24px 100px;
    }

    .food-item:hover {
        transform: translateX(8px) scale(1.02);
    }

    .add-btn:hover {
        transform: scale(1.15) rotate(90deg);
    }

    .submit-btn:hover {
        transform: translateY(-3px) scale(1.02);
    }

    .modal {
        border-radius: var(--radius) var(--radius) var(--radius) var(--radius);
        margin: 20px;
        max-height: calc(100vh - 40px);
    }
}

/* ===========================================
   Touch Improvements
   =========================================== */
@media (hover: none) and (pointer: coarse) {
    .food-item:hover {
        transform: none;
        background: var(--bg-card);
    }

    .food-item:active {
        background: var(--bg-card-hover);
        transform: scale(0.98);
    }

    .recipe-card:hover {
        transform: none;
        background: var(--bg-card);
    }

    .recipe-card:active {
        background: var(--bg-card-hover);
    }

    .emoji-btn:hover {
        background: var(--bg-dark);
    }

    .emoji-btn:active {
        background: var(--bg-card-hover);
    }

    .quick-btn:hover {
        background: var(--bg-dark);
    }

    .quick-btn:active {
        background: var(--bg-card-hover);
    }

    .submit-btn:hover {
        transform: none;
        box-shadow: none;
    }

    .submit-btn:active {
        transform: scale(0.98);
    }

    .add-btn:hover {
        transform: none;
    }

    .add-btn:active {
        transform: scale(0.95);
    }

    .delete-btn:hover {
        transform: none;
    }

    .delete-btn:active {
        transform: scale(0.98);
    }
}

/* ===========================================
   Safe Area for Notched Phones
   =========================================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .app {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }

    .modal {
        padding-bottom: calc(40px + env(safe-area-inset-bottom));
    }
}

/* ===========================================
   Prevent Text Selection on Interactive Elements
   =========================================== */
.nav-btn,
.add-btn,
.emoji-btn,
.quick-btn,
.submit-btn,
.delete-btn,
.food-item,
.recipe-card,
.notification-banner-btn,
.settings-btn,
.toggle {
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ===========================================
   Smooth Scrolling
   =========================================== */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.modal {
    -webkit-overflow-scrolling: touch;
}

/* ===========================================
   Landscape Mode Adjustments
   =========================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .modal {
        max-height: 100vh;
        border-radius: 0;
    }

    .stats-bar {
        margin: 8px 0 16px;
    }

    .section-header {
        margin: 16px 0 8px;
    }

    header {
        padding: 16px 0 8px;
    }
}

/* ===========================================
   Input Zoom Prevention on iOS
   =========================================== */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    select,
    .form-input {
        font-size: 16px;
    }
}
