/* Modern chefchen Styles with Dark Mode Support */

:root {
    /* Light theme colors */
    --primary-color: #059669;
    --secondary-color: #1e3a8a;
    --accent-color: #dc2626;
    --success-color: #059669;
    --warning-color: #d97706;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --card-background: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --border-radius-sm: 6px;
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark theme colors - Splittchen inspired */
[data-theme="dark"] {
    --primary-color: #48bb78;
    --secondary-color: #4299e1;
    --accent-color: #f56565;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --background-color: #1a202c;
    --surface-color: #2d3748;
    --card-background: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: #4a5568;
    --border-hover: #48bb78;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}

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

html {
    scroll-behavior: smooth;
}

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

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

/* Header Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding: 24px 0;
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    font-weight: 700;
}

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

/* Brand wordmark */
.header-titles {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.brand-logo {
    border-radius: 8px;
    display: block;
    box-shadow: var(--shadow-sm);
}

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
}

.install-btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}

[hidden] {
    display: none !important;
}

/* Theme Toggle */
.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    background: var(--border-color);
    border-radius: 15px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px;
    font-size: 14px;
}

.theme-toggle:hover {
    background: var(--border-hover);
}

.theme-toggle::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: var(--transition);
    transform: translateX(0);
    box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .theme-toggle::before {
    transform: translateX(30px);
    background: var(--surface-color);
}

.theme-toggle .icon {
    width: 16px;
    height: 16px;
    z-index: 1;
}

/* Card Styles */
.card {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card h2 {
    color: var(--text-primary);
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 16px;
    background: var(--surface-color);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    accent-color: var(--primary-color);
}

/* Control Group */
.control-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 24px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    transition: var(--transition);
    min-width: 120px;
    position: relative;
    overflow: hidden;
}

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

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

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    min-width: auto;
}

/* Loading State */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-loading {
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Menu Container */
.menu-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.day-card {
    background: var(--card-background);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.day-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
}

.day-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.day-card h3 {
    color: var(--text-primary);
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.ingredient-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ingredient-list li {
    padding: 16px;
    border-radius: var(--border-radius);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.ingredient-name {
    font-weight: 500;
    color: var(--text-primary);
    text-transform: capitalize;
}

.ingredient-type {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 4px 8px;
    background: var(--border-color);
    border-radius: var(--border-radius-sm);
}

.recipe-hint {
    text-align: center;
    margin-top: 12px;
    padding: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-radius: var(--border-radius-sm);
    border: 1px dashed var(--border-color);
    opacity: 0.8;
    transition: var(--transition);
}

.day-card:hover .recipe-hint {
    opacity: 1;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Recipe Styles */
.recipe-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

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

.recipe-modal-content {
    background-color: var(--card-background);
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease-out;
}

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

.recipe-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-modal-header h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.recipe-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

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

.recipe-modal-body {
    padding: 24px;
}

.recipe-grid {
    display: grid;
    gap: 20px;
}

.recipe-card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 0; /* Remove padding to allow full-width image */
    border: 1px solid var(--border-color);
    transition: var(--transition);
    overflow: hidden; /* Ensure image doesn't overflow rounded corners */
}

.recipe-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.recipe-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.recipe-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

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

.recipe-content {
    padding: 20px; /* Move padding to content area */
}

.recipe-card h4,
.recipe-card h5 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 1.125rem;
    font-weight: 600;
}

.recipe-meta {
    display: flex;
    gap: 16px;
    margin: 12px 0;
    font-size: 0.875rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.recipe-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.recipe-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    transition: var(--transition);
}

.recipe-link:hover {
    text-decoration: underline;
}

.recipe-instructions {
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 12px 0;
    font-size: 0.9rem;
}

.recipe-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.recipe-link.youtube {
    color: var(--accent-color);
}

.recipe-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.recipe-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* Meal Recipe Styles */
.meal-recipes {
    max-height: 70vh;
    overflow-y: auto;
}

.ingredient-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.ingredient-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.ingredient-section h4 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ingredient-section .recipe-grid {
    gap: 12px;
}

.ingredient-section .recipe-card {
    padding: 16px;
}

.ingredient-section .recipe-card h5 {
    margin-bottom: 8px;
    color: var(--text-primary);
    font-size: 1rem;
}

.no-recipes {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Notifications */
.notification {
    position: fixed;
    top: 24px;
    right: 24px;
    padding: 16px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 500;
    z-index: 1001;
    max-width: 400px;
    cursor: pointer;
    animation: slideIn 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

.notification-success {
    background: var(--success-color);
}

.notification-error {
    background: var(--accent-color);
}

.notification-info {
    background: var(--primary-color);
}

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

/* Error State */
.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
    border-radius: var(--border-radius);
    padding: 16px;
    margin: 20px 0;
    text-align: center;
    font-weight: 500;
}

[data-theme="dark"] .error {
    background: #450a0a;
    color: #fecaca;
    border-color: #7f1d1d;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 16px;
    }
    
    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .header-titles {
        align-items: center;
    }

    .header h1 {
        font-size: 2rem;
    }
    
    .control-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 12px;
    }
    
    .menu-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .day-card {
        padding: 20px;
    }
    
    .recipe-modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .recipe-modal-header,
    .recipe-modal-body {
        padding: 20px;
    }
    
    .notification {
        top: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
    }

    .theme-toggle {
        order: -1;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.75rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .ingredient-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .recipe-meta {
        flex-direction: column;
        gap: 8px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

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

.hidden {
    display: none !important;
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Smooth transitions for theme switching */
*,
*::before,
*::after {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
/* Account section */
#account-card {
    margin-top: 24px;
}

.account-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.account-row .form-group {
    flex: 1 1 220px;
    margin-bottom: 0;
}

.account-link-row {
    align-items: center;
}

.account-link-row input {
    flex: 1 1 260px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--surface-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.account-subtitle {
    margin: 20px 0 8px;
    font-size: 1rem;
    color: var(--text-primary);
}

.account-list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
}

.account-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.account-list a {
    color: var(--primary-color);
    text-decoration: none;
}

.account-list a:hover {
    text-decoration: underline;
}

.account-item-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: auto;
}

.account-list li button {
    flex-shrink: 0;
}

.account-empty {
    color: var(--text-muted);
    border-bottom: none !important;
}
