* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    margin: 0;
    background-color: #fff8f0;
    color: #333;
    transition: background-color 0.3s, color 0.3s;
}

body.dark-mode {
    background-color: #1a1a2e;
    color: #e0e0e0;
}

header {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    position: relative;
}

header h1 {
    margin: 0 0 0.5rem;
    font-size: 2rem;
}

header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

body.dark-mode header {
    background: linear-gradient(135deg, #16213e, #0f3460);
}

main {
    max-width: 700px;
    margin: 0 auto;
    padding: 1.5rem;
}

.filters {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 1.05rem;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-btn {
    background-color: #fff;
    color: #333;
    border: 2px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #ff6b35;
    background-color: #fff3ec;
}

.filter-btn.active {
    background-color: #ff6b35;
    color: white;
    border-color: #ff6b35;
}

body.dark-mode .filter-btn {
    background-color: #16213e;
    color: #e0e0e0;
    border-color: #0f3460;
}

body.dark-mode .filter-btn:hover {
    border-color: #e94560;
    background-color: #1a1a3e;
}

body.dark-mode .filter-btn.active {
    background-color: #e94560;
    color: white;
    border-color: #e94560;
}

#recommend-button {
    display: block;
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 1.5rem;
}

#recommend-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

body.dark-mode #recommend-button {
    background: linear-gradient(135deg, #e94560, #c23152);
}

body.dark-mode #recommend-button:hover {
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
}

#result {
    min-height: 50px;
}

.menu-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.5s ease;
}

body.dark-mode .menu-card {
    background-color: #16213e;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.menu-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.menu-card h2 {
    margin: 0 0 0.3rem;
    font-size: 1.6rem;
}

.menu-card .menu-desc {
    color: #777;
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

body.dark-mode .menu-card .menu-desc {
    color: #aaa;
}

.menu-card .menu-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.menu-card .tag {
    background-color: #fff3ec;
    color: #ff6b35;
    padding: 0.25rem 0.7rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

body.dark-mode .menu-card .tag {
    background-color: #1a1a3e;
    color: #e94560;
}

.menu-card .retry-btn {
    background: none;
    border: 2px solid #ff6b35;
    color: #ff6b35;
    padding: 0.5rem 1.2rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s;
}

.menu-card .retry-btn:hover {
    background-color: #ff6b35;
    color: white;
}

body.dark-mode .menu-card .retry-btn {
    border-color: #e94560;
    color: #e94560;
}

body.dark-mode .menu-card .retry-btn:hover {
    background-color: #e94560;
    color: white;
}

.loading {
    text-align: center;
    padding: 2rem;
    font-size: 1.2rem;
}

.loading .spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #ddd;
    border-top-color: #ff6b35;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 0.5rem;
}

body.dark-mode .loading .spinner {
    border-color: #0f3460;
    border-top-color: #e94560;
}

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

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

.header-controls {
    position: absolute;
    right: 1rem;
    top: 1rem;
    display: flex;
    gap: 0.5rem;
}

#theme-toggle,
#lang-toggle {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.3s;
}

#theme-toggle:hover,
#lang-toggle:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

@media (max-width: 500px) {
    header h1 { font-size: 1.5rem; }
    header { padding-top: 3.5rem; }
}
