:root {
    --bg-primary: #ffffff;
    --bg-secondary: white;
    --bg-tertiary: rgba(255, 255, 255, 0.95);
    --bg-landing: #ffffff;
    --text-primary: #37352f;
    --text-secondary: #787774;
    --text-tertiary: #9b9a97;
    --border-color: #e9e9e7;
    --shadow: rgba(15, 15, 15, 0.1);
    --shadow-strong: rgba(15, 15, 15, 0.2);
    --accent-color: #10b981;
    --accent-hover: #059669;
    --error-color: #e74c3c;
    --error-hover: #c0392b;
}

[data-theme="dark"] {
    --bg-primary: #191919;
    --bg-secondary: #2e2e2e;
    --bg-tertiary: rgba(46, 46, 46, 0.95);
    --bg-landing: #191919;
    --text-primary: #ffffff;
    --text-secondary: #b4b4b4;
    --text-tertiary: #8e8e8e;
    --border-color: #3d3d3d;
    --shadow: rgba(0, 0, 0, 0.4);
    --shadow-strong: rgba(0, 0, 0, 0.6);
    --accent-color: #34d399;
    --accent-hover: #10b981;
    --error-color: #ff6b6b;
    --error-hover: #ee5a5a;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-landing);
    min-height: 100vh;
    color: var(--text-primary);
    transition: background 0.3s ease, color 0.3s ease;
    line-height: 1.6;
}

.view {
    min-height: 100vh;
}

/* Landing Page Styles */
.landing-nav {
    position: sticky;
    top: 0;
    background: var(--bg-landing);
    border-bottom: 1px solid var(--border-color);
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .landing-nav {
    background: rgba(25, 25, 25, 0.8);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-nav-link {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-nav-link:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-nav-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-nav-primary:hover {
    background: var(--accent-hover);
}

.btn-dark-mode-nav {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-dark-mode-nav:hover {
    background: var(--bg-tertiary);
}

.language-switcher {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
    min-width: 70px;
}

.language-switcher:hover {
    border-color: var(--accent-color);
}

.landing-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 24px;
}

.hero-section {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 120px;
}

.hero-title {
    font-size: 56px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.5;
}

.hero-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-hero-primary {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px var(--shadow);
}

.btn-hero-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow-strong);
}

.btn-hero-secondary {
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 14px 32px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-hero-secondary:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-1px);
}

.hero-note {
    font-size: 14px;
    color: var(--text-tertiary);
    margin: 0;
}

.features-section {
    margin-top: 120px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
    max-width: 1000px;
    margin: 0 auto;
}

.feature-card {
    padding: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-card:hover {
    box-shadow: 0 8px 24px var(--shadow);
    transform: translateY(-4px);
    border-color: var(--accent-color);
}

.feature-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 8px;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.feature-card p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* Auth Modal */
.auth-modal-content {
    max-width: 400px;
    width: 90%;
}

.auth-modal-content h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 24px;
    text-align: center;
    color: var(--text-primary);
}

/* Meals view should have neutral background */
#meals-view {
    background: var(--bg-primary);
    min-height: 100vh;
}

[data-theme="dark"] #meals-view {
    background: var(--bg-primary);
}

.hidden {
    display: none !important;
}

/* Auth View */
#auth-view {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 20px 60px var(--shadow-strong);
    width: 100%;
    max-width: 400px;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

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

.auth-container h1 {
    text-align: center;
    margin-bottom: 0;
    font-size: 2.5em;
    color: var(--accent-color);
    flex: 1;
    transition: color 0.3s ease;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.auth-form input {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s, background 0.3s, color 0.3s;
}

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

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

.auth-form button {
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.auth-form button:hover {
    background: var(--accent-hover);
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    text-align: center;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.auth-divider span {
    padding: 0 15px;
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-guest {
    width: 100%;
    padding: 12px;
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.btn-guest:hover {
    background: var(--accent-color);
    color: white;
}

.temp-account-banner {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #333;
    padding: 12px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow);
    position: relative;
}

[data-theme="dark"] .temp-account-banner {
    background: linear-gradient(135deg, #ffa500 0%, #ff8c00 100%);
    color: #fff;
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.banner-content a {
    color: var(--accent-color);
    text-decoration: underline;
    font-weight: 600;
}

[data-theme="dark"] .banner-content a {
    color: #fff;
    text-decoration: underline;
}

.btn-dismiss {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-dismiss:hover {
    opacity: 0.7;
}

.error-message {
    color: var(--error-color);
    font-size: 14px;
    text-align: center;
    min-height: 20px;
}

/* Meals View */
#meals-view header {
    background: var(--bg-secondary);
    padding: 20px 40px;
    box-shadow: 0 2px 10px var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.3s ease, box-shadow 0.3s ease;
    gap: 15px;
}

header h1 {
    color: var(--accent-color);
    font-size: 1.8em;
    transition: color 0.3s ease;
    margin: 0;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

/* Simple Hamburger Menu Button */
.burger-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    flex-shrink: 0;
    position: relative;
}

.burger-menu-btn span {
    width: 100%;
    height: 3px;
    background: var(--text-primary);
    border-radius: 3px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.burger-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.burger-menu-btn.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.burger-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu Overlay - Centered Full Screen */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-secondary);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* Mobile Menu - Centered */
.mobile-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow-strong);
    z-index: 1000;
    padding: 0;
    opacity: 0;
    scale: 0.9;
    transition: opacity 0.3s ease, scale 0.3s ease;
}

.mobile-menu-overlay.active .mobile-menu {
    opacity: 1;
    scale: 1;
}

.mobile-menu-content {
    padding: 40px 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
}

.mobile-menu-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-menu-label {
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 500;
}

.mobile-menu-select {
    width: 100%;
    font-size: 16px;
    padding: 12px 48px 12px 16px;
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    min-height: 44px;
    transition: all 0.2s;
    font-weight: 500;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23b4b4b4' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

[data-theme="light"] .mobile-menu-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%23666' d='M8 11L3 6h10z'/%3E%3C/svg%3E");
}

.mobile-menu-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.1);
}

.mobile-menu-select:hover {
    border-color: var(--accent-color);
    background-color: var(--bg-secondary);
}

.mobile-menu-item .mobile-menu-select.language-switcher {
    min-width: 100%;
    width: 100%;
    height: auto;
    margin: 0;
}

.mobile-menu-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 16px;
    text-align: left;
}

.mobile-menu-btn span:first-child {
    font-size: 20px;
}


.btn-dark-mode {
    background: transparent;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 40px;
}

.btn-dark-mode:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent-color);
    transform: scale(1.05);
}

.language-switcher {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-primary);
    min-width: 80px;
    height: 40px;
}

.language-switcher:hover {
    border-color: var(--accent-color);
}

.language-switcher:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.1);
}

#meals-view main {
    max-width: 1200px;
    margin: 40px auto;
    padding: 0 20px;
    background: transparent;
}

.meals-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}

.buttons-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-container {
    display: flex;
    flex: 1;
    min-width: 200px;
    position: relative;
}

#search-input {
    width: 100%;
    min-width: 200px;
    padding: 12px 40px 12px 20px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: all 0.3s;
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
    z-index: 1;
}

.search-clear:hover {
    color: var(--text-primary);
}

.search-clear.hidden {
    display: none;
}

#search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    box-shadow: 0 4px 12px var(--shadow);
}

#search-input::placeholder {
    color: var(--text-tertiary);
}

/* Landing page responsive */
@media (max-width: 768px) {
    .nav-container {
        position: relative;
    }
    
    .landing-burger {
        display: flex;
    }
    
    .nav-actions {
        display: none;
    }
    
    .hero-title {
        font-size: 42px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .landing-main {
        padding: 60px 20px;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    header {
        padding: 12px 15px;
        flex-wrap: nowrap;
        gap: 12px;
        position: relative;
    }
    
    header h1 {
        font-size: 1.3em;
        margin: 0;
        flex: 1;
        min-width: 0;
    }
    
    .burger-menu-btn {
        display: flex;
    }
    
    .user-info {
        display: none;
    }
    
    .mobile-menu-overlay {
        display: block;
    }
    
    .mobile-menu {
        display: block;
    }
    
    .btn-dark-mode {
        min-width: 38px;
        height: 34px;
        padding: 6px 8px;
        font-size: 16px;
        flex-shrink: 0;
    }
    
    .btn-secondary {
        padding: 6px 12px;
        font-size: 12px;
        white-space: nowrap;
    }
    
    .meals-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }
    
    .search-container {
        width: 100%;
        order: 2;
    }
    
    .buttons-row {
        order: 1;
        width: 100%;
        display: flex;
        gap: 10px;
    }
    
    .buttons-row .btn-sort,
    .buttons-row .btn-primary {
        flex: 1;
        width: auto;
    }
    
    .auth-container {
        padding: 30px 20px;
    }
    
    .auth-header {
        margin-bottom: 20px;
    }
    
    .auth-container h1 {
        font-size: 2em;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    header {
        padding: 12px 15px;
    }
    
    header h1 {
        font-size: 1.2em;
    }
    
    .user-info {
        gap: 6px;
    }
    
    .btn-secondary {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .nav-container {
        padding: 12px 16px;
    }
    
    .nav-actions {
        gap: 8px;
    }
    
    .btn-nav-link,
    .btn-nav-primary {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .landing-main {
        padding: 40px 16px;
    }
}

.btn-primary {
    padding: 12px 24px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    height: auto;
    line-height: 1.5;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--shadow);
}

.btn-secondary {
    padding: 8px 16px;
    background: transparent;
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: var(--accent-color);
    color: white;
}

.btn-sort {
    padding: 12px 24px;
    background: var(--bg-secondary);
    color: var(--accent-color);
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s, color 0.3s;
    min-width: 60px;
    height: auto;
    line-height: 1.5;
}

.btn-sort:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

.meals-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.meals-list .empty-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.meals-list .empty-message p {
    margin: 10px 0;
}

.meals-list .empty-message a {
    color: var(--accent-color);
    text-decoration: underline;
    cursor: pointer;
}

.meals-list .empty-message strong {
    font-size: 1.2em;
    color: var(--text-primary);
}

.empty-state {
    text-align: center;
    padding: 80px 20px;
    max-width: 500px;
    margin: 0 auto;
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
    width: 100%;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 16px;
    text-align: center;
    width: 100%;
}

.empty-state-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    width: 100%;
}

.empty-state-note {
    font-size: 14px;
    color: var(--text-tertiary);
    margin-top: 20px;
    text-align: center;
    width: 100%;
}

.empty-state-note a {
    color: var(--accent-color);
    text-decoration: underline;
}

.photo-upload-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.photo-upload-buttons input[type="file"] {
    flex: 1;
    min-width: 200px;
}

.meal-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .meal-card {
    background: var(--bg-secondary);
    box-shadow: 0 4px 15px var(--shadow);
    border: 1px solid var(--border-color);
}

.meal-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px var(--shadow-strong);
}

.meal-card.menu-active {
    z-index: 100;
}

.meal-card-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    position: relative;
    background: var(--bg-tertiary);
}

.meal-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.meal-card:hover .meal-card-image img {
    transform: scale(1.05);
}

.meal-card-image-placeholder {
    width: 100%;
    height: 140px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--border-color) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    position: relative;
}

.placeholder-icon {
    font-size: 48px;
    opacity: 0.4;
}

.meal-menu-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
}

.meal-card-content {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.meal-card h3 {
    color: var(--text-primary);
    margin: 0;
    font-size: 1.05em;
    font-weight: 600;
    transition: color 0.3s ease;
    line-height: 1.2;
}

.meal-card-description {
    color: var(--text-secondary);
    font-size: 0.85em;
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.meal-menu {
    position: relative;
}

.meal-menu-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .meal-menu-btn {
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-primary);
}

.meal-menu-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

[data-theme="dark"] .meal-menu-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}

.meal-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow);
    min-width: 120px;
    z-index: 1000;
    margin-top: 5px;
    overflow: hidden;
    transition: background 0.3s ease;
}

.meal-menu-dropdown button {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s;
}

.meal-menu-dropdown button:hover {
    background: var(--bg-tertiary);
}

.meal-menu-dropdown button.delete-option {
    color: var(--error-color);
}

.meal-menu-dropdown button.delete-option:hover {
    background: rgba(255, 107, 107, 0.1);
    color: var(--error-hover);
}

.detail-content {
    margin: 20px 0;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    color: var(--accent-color);
    margin-bottom: 8px;
    font-size: 1em;
    font-weight: 600;
    transition: color 0.3s ease;
}

.detail-section p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
    transition: color 0.3s ease;
}

.formatted-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

.formatted-description p {
    margin-bottom: 12px;
}

.formatted-description p:last-child {
    margin-bottom: 0;
}

.formatted-description h1,
.formatted-description h2,
.formatted-description h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 12px;
}

.formatted-description h1 {
    font-size: 1.5em;
}

.formatted-description h2 {
    font-size: 1.3em;
}

.formatted-description h3 {
    font-size: 1.1em;
}

.formatted-description ul,
.formatted-description ol {
    margin: 12px 0;
    padding-left: 24px;
    color: var(--text-secondary);
}

.formatted-description li {
    margin-bottom: 6px;
}

.formatted-description strong {
    color: var(--text-primary);
    font-weight: 600;
}

.formatted-description em {
    font-style: italic;
}

.formatted-description a {
    color: var(--accent-color);
    text-decoration: none;
}

.formatted-description a:hover {
    text-decoration: underline;
}

.detail-url {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.95em;
    transition: color 0.3s;
}

.detail-url:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.detail-url.no-url,
.no-url {
    color: var(--text-tertiary);
    font-style: italic;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 15, 15, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

[data-theme="dark"] .modal {
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 32px;
    width: 90%;
    max-width: 500px;
    position: relative;
    transition: background 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow-strong);
    max-height: 90vh;
    overflow-y: auto;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: color 0.3s;
}

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

#modal-title {
    margin-bottom: 20px;
    color: var(--text-primary);
    font-size: 1.5em;
    transition: color 0.3s ease;
}

#meal-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#meal-form label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

#meal-form input[type="text"],
#meal-form input[type="url"],
#meal-form textarea {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: border-color 0.3s, background 0.3s, color 0.3s;
}

#meal-form input:focus,
#meal-form textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

#meal-form input::placeholder,
#meal-form textarea::placeholder {
    color: var(--text-tertiary);
}

#meal-form textarea {
    min-height: 100px;
    resize: vertical;
}

/* Quill Editor Styling */
#quill-editor {
    min-height: 200px;
    margin-bottom: 15px;
}

#quill-editor .ql-container {
    font-family: inherit;
    font-size: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
}

#quill-editor .ql-editor {
    min-height: 200px;
    padding: 12px 16px;
}

#quill-editor .ql-editor.ql-blank::before {
    color: var(--text-tertiary);
    font-style: italic;
}

#quill-editor .ql-toolbar {
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 8px;
}

#quill-editor .ql-toolbar .ql-stroke {
    stroke: var(--text-primary);
}

#quill-editor .ql-toolbar .ql-fill {
    fill: var(--text-primary);
}

#quill-editor .ql-toolbar button:hover,
#quill-editor .ql-toolbar button:focus,
#quill-editor .ql-toolbar button.ql-active {
    color: var(--accent-color);
}

#quill-editor .ql-toolbar button:hover .ql-stroke,
#quill-editor .ql-toolbar button:focus .ql-stroke,
#quill-editor .ql-toolbar button.ql-active .ql-stroke {
    stroke: var(--accent-color);
}

#quill-editor .ql-toolbar button:hover .ql-fill,
#quill-editor .ql-toolbar button:focus .ql-fill,
#quill-editor .ql-toolbar button.ql-active .ql-fill {
    fill: var(--accent-color);
}

#quill-editor .ql-toolbar .ql-picker-label {
    color: var(--text-primary);
}

#quill-editor .ql-toolbar .ql-picker-options {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

#quill-editor .ql-toolbar .ql-picker-item {
    color: var(--text-primary);
}

#quill-editor .ql-toolbar .ql-picker-item:hover {
    color: var(--accent-color);
    background: var(--bg-tertiary);
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.modal-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
    position: relative;
}

.modal-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.modal-tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.tab-content {
    display: none;
    flex-direction: column;
    gap: 15px;
}

.tab-content.active {
    display: flex;
}

.tab-content.hidden {
    display: none;
}

/* Import Section */
.import-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.import-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.btn-import-photo {
    width: 100%;
    padding: 12px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-import-photo:hover {
    background: var(--accent-hover);
}

.import-processing {
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Photos Section */
.photos-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.photos-description {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

.photos-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-height: 100px;
}

.photo-item {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-tertiary);
    padding: 10px;
}

.photo-item img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    border-radius: 4px;
}

.photo-item.primary {
    border-color: var(--accent-color);
}

.photo-item-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

.photo-item-label {
    padding: 6px 12px;
    background: var(--accent-color);
    color: white;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.btn-add-photo {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-add-photo:hover {
    border-color: var(--accent-color);
    background: var(--bg-tertiary);
}

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

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-actions .btn-primary {
    background: var(--accent-color);
    color: white;
}

.modal-actions .btn-primary:hover {
    background: var(--accent-hover);
}

.modal-actions .btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.modal-actions .btn-secondary:hover {
    background: var(--text-tertiary);
}

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

.btn-delete-confirm:hover {
    background: var(--error-hover);
}

#delete-confirm-modal .modal-content {
    max-width: 400px;
}

#delete-confirm-modal p {
    color: var(--text-secondary);
    margin: 20px 0;
    line-height: 1.6;
    transition: color 0.3s ease;
}

/* Photo upload styles */
.photo-upload-section {
    margin: 15px 0;
}

.photo-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    transition: color 0.3s ease;
}

#meal-photo {
    width: 100%;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s, background 0.3s, color 0.3s;
}

#meal-photo:focus {
    outline: none;
    border-color: var(--accent-color);
}

.photo-preview {
    margin-top: 10px;
    max-height: 200px;
    overflow: hidden;
    border-radius: 8px;
}

.photo-preview img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

.preview-image {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    border-radius: 8px;
}

.btn-remove-photo {
    margin-top: 10px;
    padding: 6px 12px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-remove-photo:hover {
    background: var(--error-hover);
}

/* Meal card photo */
.meal-photo {
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    margin-bottom: 15px;
}

.meal-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}


/* Detail modal photo */
.detail-photo-link {
    display: inline-block;
    cursor: pointer;
    transition: opacity 0.2s;
}

.detail-photo-link:hover {
    opacity: 0.9;
}

.detail-photo-image {
    width: 100%;
    max-width: 500px;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    margin-top: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.detail-photo-link:hover .detail-photo-image {
    transform: scale(1.02);
}

/* Android PWA specific fixes */
@supports (-webkit-touch-callout: none) {
    /* iOS/Android specific styles */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Android safe area support */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* Fix for Android Chrome address bar */
html {
    height: -webkit-fill-available;
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* Ensure proper rendering on Android */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Fix for Android text rendering */
button, a, input, textarea {
    -webkit-appearance: none;
    -webkit-tap-highlight-color: transparent;
}

/* Improve touch targets on Android */
@media (max-width: 768px) {
    button, .btn, a {
        min-height: 44px;
        min-width: 44px;
    }
}

