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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #e74c3c;
    --accent-color: #f39c12;
    --background-primary: #ffffff;
    --background-secondary: #f8f9fa;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --text-light: #95a5a6;
    --border-color: #e9ecef;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.15);
    --shadow-heavy: 0 8px 30px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-x: hidden;
    font-weight: 400;
}

/* Base text styling for consistency */
p, li, span, div, label, input, textarea, button {
    font-family: inherit;
    font-size: 16px;
    line-height: 1.6;
}

/* Headings with consistent hierarchy */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    color: var(--text-primary);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* Initial loading state */
.initial-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-content .loading-animation {
    margin-bottom: 1rem;
}

.loading-content .cooking-pot {
    font-size: 4rem;
    animation: bounce 1.5s infinite;
}

.loading-content p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Beta Banner */
.beta-banner {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 0.75rem 2rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 101;
}

.beta-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.beta-icon {
    font-size: 1.1rem;
    animation: pulse 2s infinite;
}

.beta-text {
    opacity: 0.95;
}

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

@media (max-width: 768px) {
    .beta-banner {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .beta-content {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1rem;
    min-height: 60px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.2rem;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.logo:hover {
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.logo-text {
    font-family: inherit;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--background-secondary);
    color: var(--text-primary);
}

/* Landing Page */
.landing-main {
    flex: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
    align-items: center;
    min-height: 80vh;
}

.hero-content {
    color: white;
}

.hero-title {
    font-family: inherit;
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.highlight {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.hero-subtitle {
    font-size: 1.125rem;
    line-height: 1.6;
    opacity: 0.9;
    margin-bottom: 3rem;
    max-width: 500px;
}

.search-container {
    max-width: 500px;
}

.search-box {
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#recipePrompt {
    flex: 1;
    border: none;
    padding: 1.5rem;
    font-size: 16px;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

#recipePrompt::placeholder {
    color: var(--text-light);
    font-size: 16px;
    line-height: 1.4;
}

.generate-btn {
    background: linear-gradient(135deg, var(--secondary-color), #c0392b);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    align-self: flex-end;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
}

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

.generate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.loading {
    margin-top: 2rem;
    text-align: center;
    color: white;
}

.loading-animation {
    position: relative;
    margin-bottom: 1rem;
}

.cooking-pot {
    font-size: 3rem;
    animation: bounce 2s infinite;
}

.steam {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: steam-rise 1.5s infinite ease-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes steam-rise {
    0% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(1.5); }
}

.hero-images {
    display: flex;
    justify-content: center;
    align-items: center;
}

.image-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: 400px;
}

.grid-img {
    border-radius: var(--border-radius);
    object-fit: cover;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
}

.img-1 {
    grid-column: 1 / -1;
    height: 200px;
}

.img-2, .img-3 {
    height: 150px;
}

.grid-img:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.features {
    background: white;
    padding: 4rem 2rem;
}

.features-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 3rem;
}

.feature {
    text-align: center;
    padding: 2rem;
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feature h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    font-weight: 600;
}

.feature p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.error-toast {
    position: fixed;
    top: 100px;
    right: 2rem;
    background: var(--secondary-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Recipe Page */
.recipe-main {
    flex: 1;
    background: var(--background-secondary);
}

.recipe-hero {
    background: white;
    padding: 3rem 2rem;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

.recipe-category {
    margin-bottom: 1rem;
}

.category-badge {
    background: var(--accent-color);
    color: white;
    padding: 0.3rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.recipe-title {
    font-family: inherit;
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.recipe-story {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 600px;
}

.main-recipe-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
}

.recipe-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
    display: grid;
    gap: 3rem;
}

.recipe-narrative {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.narrative-section h2 {
    font-family: inherit;
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.origin-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.cooking-tips h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.tips-list {
    display: grid;
    gap: 1rem;
}

.tip-item {
    background: var(--background-secondary);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
}

.recipe-gallery {
    background: white;
    padding: 3rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
}

.recipe-gallery h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: center;
}

.recipe-refinement {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 3rem;
    border-radius: var(--border-radius);
    color: white;
    text-align: center;
}

.refinement-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.refinement-header p {
    opacity: 0.9;
    margin-bottom: 2rem;
    font-size: 16px;
}

.refinement-input-group {
    max-width: 600px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.15);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

#refinementPrompt {
    flex: 1;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    outline: none;
}

#refinementPrompt::placeholder {
    color: var(--text-light);
}

.refine-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
    white-space: nowrap;
    backdrop-filter: blur(10px);
}

.refine-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.refine-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

#refinementLoading {
    margin-top: 2rem;
    color: white;
}

#refinementLoading .loading-animation {
    margin-bottom: 1rem;
}

.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.process-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.process-image:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-medium);
}

.recipe-summary {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    overflow: hidden;
}

.ai-disclaimer {
    background: #fff9e6;
    border: 1px solid #f4d03f;
    padding: 1.5rem 2rem;
    margin-bottom: 0;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.disclaimer-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.disclaimer-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #7d5a00;
}

.disclaimer-text strong {
    color: #5d4300;
    font-weight: 600;
}

.summary-header {
    background: var(--background-secondary);
    padding: 2rem 3rem;
    border-bottom: 1px solid var(--border-color);
}

.summary-header h2 {
    font-family: inherit;
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

.recipe-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 2rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.meta-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
}

.meta-label {
    font-size: 14px;
    color: var(--text-light);
    display: block;
}

.meta-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
}

.recipe-details {
    padding: 3rem;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 3rem;
}

.ingredients-section h3,
.steps-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

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

.ingredients-list li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    padding-left: 2rem;
}

.ingredients-list li:before {
    content: "•";
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
    position: absolute;
    left: 0;
}

.steps-list {
    counter-reset: step-counter;
    list-style: none;
}

.steps-list li {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    padding-left: 4rem;
    counter-increment: step-counter;
    line-height: 1.6;
}

.steps-list li:before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 1.5rem;
    background: var(--accent-color);
    color: white;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

.recipe-actions {
    padding: 2rem 3rem;
    background: var(--background-secondary);
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}

.action-btn.primary {
    background: var(--secondary-color);
    color: white;
}

.action-btn.primary:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

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

.action-btn.secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }
    
    .recipe-hero {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .recipe-details {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0.75rem 1rem;
        min-height: 50px;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 0.5rem;
        overflow: hidden;
    }
    
    .logo {
        justify-self: start;
        overflow: hidden;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .nav-actions {
        justify-self: end;
        display: flex;
        align-items: center;
        position: relative;
        z-index: 9997;
    }
    
    .hero {
        padding: 2rem 1rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .recipe-hero {
        padding: 2rem 1rem;
    }
    
    .recipe-title {
        font-size: 2rem;
    }
    
    .recipe-content {
        padding: 0 1rem 2rem;
    }
    
    .recipe-narrative,
    .recipe-gallery {
        padding: 2rem 1.5rem;
    }
    
    .recipe-details {
        padding: 2rem 1.5rem;
    }
    
    .recipe-actions {
        padding: 1.5rem;
        flex-direction: column;
    }
    
    .image-gallery {
        grid-template-columns: 1fr;
    }
    
    .recipe-meta {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .recipe-refinement {
        padding: 2rem 1.5rem;
    }
    
    .refinement-input-group {
        flex-direction: column;
        gap: 1rem;
    }
    
    #refinementPrompt {
        width: 100%;
    }
    
    .refine-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Authentication Styles */

/* Navbar Authentication */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 9997;
}

.auth-buttons {
    display: flex;
    gap: 0.75rem;
}

.user-menu {
    position: relative;
}

.user-email {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.user-email::after {
    content: '▼';
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.user-email:hover {
    background: var(--background-secondary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    min-width: 160px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition);
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    color: var(--text-primary);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-color);
}

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

.dropdown-item:hover {
    background: var(--background-secondary);
    color: var(--secondary-color);
}

.dropdown-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.dropdown-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.auth-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.login-btn {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.login-btn:hover {
    background: var(--background-secondary);
}

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

.register-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.logout-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
}

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

.recipes-btn {
    background: var(--accent-color);
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.recipes-btn:hover {
    background: #e67e22;
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

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

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

.modal-header h2 {
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

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

/* Auth Form Styles */
.auth-form-container {
    padding: 2rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 16px;
}

.form-group input {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition: var(--transition);
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-group small {
    color: var(--text-light);
    font-size: 14px;
}

.auth-submit-btn {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 0.875rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.5rem;
}

.auth-submit-btn:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

.auth-submit-btn:disabled {
    background: var(--text-light);
    cursor: not-allowed;
    transform: none;
}

.auth-toggle {
    padding: 1rem 2rem 2rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.auth-toggle p {
    color: var(--text-secondary);
    font-size: 16px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
    font-size: inherit;
}

.link-btn:hover {
    color: #c0392b;
}

.auth-error {
    margin: 1rem 2rem;
    padding: 0.75rem;
    background: #ffe6e6;
    border: 1px solid #ffb3b3;
    border-radius: 6px;
    color: #d32f2f;
    font-size: 14px;
    text-align: center;
}

.waitlist-info {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    text-align: center;
    margin: 0.5rem 0;
}

.waitlist-info p {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
}

/* Mobile responsiveness for auth */
@media (max-width: 768px) {
    .nav-actions {
        gap: 0.5rem;
        min-width: auto;
        max-width: none;
        position: relative;
        z-index: 9997;
    }
    
    .auth-buttons {
        gap: 0.5rem;
        flex-wrap: nowrap;
    }
    
    .auth-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    
    .user-menu {
        position: relative;
        z-index: 9998;
    }
    
    .user-menu:not(.hidden) {
        display: block !important;
    }
    
    .user-menu:not(.hidden) .user-email {
        display: block !important;
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
        min-width: 100px;
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        background: var(--background-secondary);
        border-radius: 4px;
        border: 1px solid var(--border-color);
    }
    
    .user-dropdown {
        position: absolute;
        top: calc(100% + 0.25rem);
        right: 0;
        min-width: 150px;
        font-size: 0.85rem;
        z-index: 9999;
        background: white;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        box-shadow: var(--shadow-medium);
    }
    
    .dropdown-item {
        padding: 0.7rem 1rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header {
        padding: 1rem 1.5rem 0.5rem;
    }
}

/* Extra small mobile devices (iPhone-sized) */
@media (max-width: 480px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
    }
    
    .page {
        overflow: visible !important;
    }
    
    .nav-container {
        overflow: visible !important;
        position: relative;
        z-index: 1000;
    }
    
    .nav-actions {
        position: relative !important;
        z-index: 9997 !important;
        overflow: visible !important;
    }
    
    .user-menu:not(.hidden) {
        position: relative !important;
        z-index: 9998 !important;
        overflow: visible !important;
        display: block !important;
    }
    
    .user-menu:not(.hidden) .user-dropdown {
        position: fixed !important;
        top: 70px !important;
        right: 1rem !important;
        left: auto !important;
        width: 160px !important;
        z-index: 999999 !important;
        background: white !important;
        border: 2px solid var(--primary-color) !important;
        border-radius: 8px !important;
        box-shadow: 0 8px 32px rgba(0,0,0,0.3) !important;
        max-height: 200px !important;
        overflow: visible !important;
    }
    
    .user-menu:not(.hidden) .user-dropdown.show {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }
    
    .auth-form-container {
        padding: 1.5rem;
    }
    
    .auth-toggle {
        padding: 1rem 1.5rem 1.5rem;
    }
}

/* Footer Styles */
.site-footer {
    margin-top: auto;
    background: var(--background-secondary);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    color: var(--text-secondary);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

.footer-content p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.footer-content a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.footer-content a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Ensure pages have proper layout for footer */
.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.landing-main,
.recipe-main {
    flex: 1;
}

/* For pages without .page wrapper */
body:not(.page) {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body:not(.page) .recipes-container {
    flex: 1;
}

/* Recipe Page Category Styling */
.recipe-category-info {
    margin-top: 1rem;
    font-size: 0.9rem;
}

.category-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.category-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* Recipes Page Styles */
.recipes-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    flex: 1;
}

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

.recipes-title {
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
}

.back-button {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: var(--transition);
}

.back-button:hover {
    background: #5a6268;
    color: white;
    text-decoration: none;
}

.recipes-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    table-layout: fixed;
}

.recipes-table th,
.recipes-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    word-wrap: break-word;
}

/* Fixed column widths */
.recipes-table th:nth-child(1),
.recipes-table td:nth-child(1) {
    width: 80px;
    text-align: center;
}

.recipes-table th:nth-child(2),
.recipes-table td:nth-child(2) {
    width: auto;
    min-width: 250px;
}

.recipes-table th:nth-child(3),
.recipes-table td:nth-child(3) {
    width: 130px;
    white-space: nowrap;
}

.recipes-table th:nth-child(4),
.recipes-table td:nth-child(4) {
    width: 140px;
    text-align: center;
}

.recipes-table th:nth-child(5),
.recipes-table td:nth-child(5) {
    width: 180px;
    white-space: nowrap;
}

.recipes-table th {
    background: var(--background-secondary);
    font-weight: 600;
    color: var(--text-primary);
}

.recipes-table tbody tr:hover {
    background: var(--background-secondary);
}

.recipe-name {
    font-weight: 600;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: none;
}

.recipe-name:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

.recipe-image {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #f0f0f0;
}

.refinement-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--primary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.refinement-badge:hover {
    background: var(--secondary-color);
}

.refinement-badge.zero {
    background: #6c757d;
    cursor: default;
}

.refinement-badge.zero:hover {
    background: #6c757d;
}

.recipe-category {
    background: #e9ecef;
    color: #495057;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
}

.recipe-date {
    color: var(--text-secondary);
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 50px;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    padding: 50px;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-bottom: 10px;
}

.error-state {
    text-align: center;
    padding: 50px;
    color: #dc3545;
}

/* Modal Styles for Recipes Page - Use more specific selector to avoid conflicts */
.recipes-container .modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
}

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

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.refinements-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.refinements-table th,
.refinements-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    word-wrap: break-word;
}

.refinements-table th {
    background: var(--background-secondary);
    font-weight: 600;
}

/* Refinements table column widths - 3 column layout */
.refinements-table th:nth-child(1),
.refinements-table td:nth-child(1) {
    width: auto;
    min-width: 200px;
}

.refinements-table th:nth-child(2),
.refinements-table td:nth-child(2) {
    width: 300px;
}

.refinements-table th:nth-child(3),
.refinements-table td:nth-child(3) {
    width: 160px;
    white-space: nowrap;
}

.refinement-prompt {
    max-width: 300px;
    font-style: italic;
    color: var(--text-secondary);
}

.original-indicator {
    background: #28a745;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 30px;
}

.pagination button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.pagination button:hover:not(:disabled) {
    background: var(--secondary-color);
}

.pagination button:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Mobile responsive footer */
@media (max-width: 768px) {
    .site-footer {
        padding: 1.5rem 0;
    }
    
    .footer-content {
        padding: 0 1rem;
    }
    
    .footer-content p {
        font-size: 0.85rem;
    }

    .recipes-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .recipes-title {
        font-size: 1.5rem;
    }

    /* Hide table on mobile and show card layout */
    .recipes-table {
        display: none;
    }

    /* Mobile card layout */
    .mobile-recipes-grid {
        display: block;
        gap: 1rem;
    }

    .mobile-recipe-card {
        background: white;
        border-radius: var(--border-radius);
        padding: 1rem;
        box-shadow: var(--shadow-light);
        border: 1px solid var(--border-color);
        margin-bottom: 1rem;
    }

    .mobile-recipe-header {
        display: flex;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .mobile-recipe-image {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        object-fit: cover;
        background: #f0f0f0;
        flex-shrink: 0;
    }

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

    .mobile-recipe-name {
        font-weight: 600;
        color: var(--primary-color);
        text-decoration: none;
        font-size: 16px;
        line-height: 1.3;
        display: block;
        margin-bottom: 0.5rem;
    }

    .mobile-recipe-name:hover {
        text-decoration: underline;
        color: var(--secondary-color);
    }

    .mobile-recipe-description {
        font-size: 14px;
        color: var(--text-secondary);
        line-height: 1.4;
    }

    .mobile-recipe-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        align-items: center;
    }

    .mobile-recipe-category {
        background: #e9ecef;
        color: #495057;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    .mobile-refinement-badge {
        display: inline-flex;
        align-items: center;
        background: var(--primary-color);
        color: white;
        padding: 4px 8px;
        border-radius: 12px;
        font-size: 12px;
        cursor: pointer;
        border: none;
        white-space: nowrap;
    }

    .mobile-refinement-badge:hover {
        background: var(--secondary-color);
    }

    .mobile-refinement-badge.zero {
        background: #6c757d;
        cursor: default;
    }

    .mobile-recipe-date {
        color: var(--text-secondary);
        font-size: 12px;
        margin-left: auto;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    /* Mobile refinements table styling */
    .refinements-table {
        display: none;
    }

    .mobile-refinements-grid {
        display: block;
    }

    .mobile-refinement-card {
        background: var(--background-secondary);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 1rem;
        border-left: 4px solid var(--primary-color);
    }

    .mobile-refinement-card.original {
        border-left-color: #28a745;
        background: #f8fff9;
    }

    .mobile-refinement-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.75rem;
    }

    .mobile-refinement-version {
        font-weight: 600;
        color: var(--primary-color);
        font-size: 14px;
    }

    .mobile-refinement-date {
        font-size: 12px;
        color: var(--text-secondary);
    }

    .mobile-refinement-name {
        font-weight: 600;
        color: var(--primary-color);
        text-decoration: none;
        margin-bottom: 0.5rem;
        display: block;
    }

    .mobile-refinement-name:hover {
        text-decoration: underline;
        color: var(--secondary-color);
    }

    .mobile-refinement-prompt {
        font-style: italic;
        color: var(--text-secondary);
        font-size: 14px;
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }

    .mobile-refinement-actions {
        text-align: center;
    }

    .mobile-refinement-view-btn {
        background: var(--primary-color);
        color: white;
        text-decoration: none;
        padding: 0.5rem 1rem;
        border-radius: 6px;
        font-size: 14px;
        display: inline-block;
        transition: var(--transition);
    }

    .mobile-refinement-view-btn:hover {
        background: var(--secondary-color);
        color: white;
        text-decoration: none;
    }
}

/* Desktop table layout */
@media (min-width: 769px) {
    .mobile-recipes-grid {
        display: none;
    }

    .mobile-refinements-grid {
        display: none;
    }
}