/* Modern Cafe Menu CSS - Fixed Layout Version */
/* Minimalist, Clean, Natural Color Palette */

/* ===== CSS Variables ===== */
:root {
    /* Clean Professional Color Palette */
    --primary-dark: #1a1a1a;
    --primary-light: #f8f9fa;
    --accent-warm: #8a8a8a;
    --accent-cool: #9a9a9a;
    --text-dark: #2c2c2c;
    --text-light: #6b6b6b;
    --background: #ffffff;
    --card-bg: #ffffff;
    --border-light: #e5e7eb;
    --bg-light: #f8f9fa;
    
    /* Spacing - Reduced for better layout */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    --font-serif: 'Georgia', 'Noto Serif KR', serif;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Ad Colors */
    --ad-bg: #f8f9fa;
    --ad-border: #dee2e6;
    --ad-text: #6c757d;
}

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

/* ===== Base ===== */
html {
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--background);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
}

/* ===== Remove All Internal Scroll Bars ===== */
.sidebar, aside, nav, .card, .category-section, .search-section {
    overflow-y: visible !important;
    max-height: none !important;
    position: relative !important;
    top: auto !important;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 400;
    line-height: 1.3;
    color: var(--primary-dark);
    margin-bottom: var(--spacing-sm);
}

h1 {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.25rem, 2.5vw, 1.875rem);
    margin-top: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
}

h3 {
    font-size: clamp(1.125rem, 2vw, 1.5rem);
    margin-top: var(--spacing-md);
}

h4 {
    font-size: 1.125rem;
    font-family: var(--font-sans);
    font-weight: 600;
    margin-top: var(--spacing-sm);
}

p {
    margin-bottom: var(--spacing-md);
    color: var(--text-light);
}

a {
    color: var(--accent-cool);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--accent-warm);
}

/* ===== Header - Compact & Fixed ===== */
header {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.95);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 400;
    letter-spacing: 0.05em;
    color: var(--primary-dark);
}

/* ===== Navigation - Compact ===== */
nav ul {
    display: flex;
    list-style: none;
    gap: var(--spacing-md);
    margin: 0;
}

nav a {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 400;
    padding: var(--spacing-xs) var(--spacing-sm);
    position: relative;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--accent-warm);
    transition: width 0.3s ease;
}

nav a:hover::after,
nav a.active::after {
    width: 80%;
}

/* ===== Layout - Optimized Grid ===== */
.layout-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-lg);
    box-sizing: border-box;
}

.content-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: var(--spacing-lg);
    align-items: start;
    box-sizing: border-box;
}

/* ===== Sidebar - Compact ===== */
.sidebar {
    position: relative;
    top: auto;
    max-height: none;
    overflow-y: visible;
}

.sidebar-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--spacing-md);
}

.sidebar h2 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    font-family: var(--font-sans);
}

.sidebar h3 {
    font-size: 0.875rem;
    color: var(--primary-dark);
    margin-top: var(--spacing-md);
    margin-bottom: var(--spacing-xs);
    font-family: var(--font-sans);
}

.sidebar ul {
    list-style: none;
    margin: 0;
}

.sidebar li {
    margin-bottom: 0.125rem;
}

.sidebar a {
    display: block;
    padding: 0.375rem var(--spacing-sm);
    color: var(--text-light);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.sidebar a:hover {
    background-color: var(--primary-light);
    color: var(--primary-dark);
    transform: translateX(2px);
}

/* ===== Main Content ===== */
.main-content {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* ===== Hero Section - Compact ===== */
.hero-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: var(--spacing-lg);
    text-align: center;
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-md);
    position: relative;
    overflow: hidden;
}

.hero-section h1 {
    margin-bottom: var(--spacing-xs);
}

.hero-section p {
    margin-bottom: var(--spacing-md);
}

/* ===== Stats Grid - Compact ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0;
}

.stat-card {
    text-align: center;
    padding: var(--spacing-md);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 300;
    color: var(--accent-warm);
    display: block;
    line-height: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* ===== Search Section - Compact ===== */
.search-section {
    background: white;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.search-section h3 {
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
}

.search-input {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

/* ===== Category Navigation - Compact ===== */
.category-nav {
    display: flex;
    justify-content: center;
    gap: var(--spacing-xs);
    margin: var(--spacing-md) 0;
    flex-wrap: wrap;
}

.category-btn {
    padding: 0.375rem var(--spacing-md);
    background: white;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    color: var(--text-dark);
    font-size: 0.875rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

/* ===== Cards - Compact Bento Box ===== */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.card {
    background-color: var(--primary-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card h4 {
    color: var(--primary-dark);
    margin-bottom: var(--spacing-xs);
    font-size: 1rem;
}

.card p {
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
}

.card ul {
    list-style: none;
    margin: 0;
}

.card li {
    padding: 0.25rem 0;
    font-size: 0.875rem;
}

/* ===== Featured Recipes Grid ===== */
.featured-recipes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.recipe-card {
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.recipe-header {
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary-light), white);
    border-bottom: 1px solid var(--border-light);
}

.recipe-header h4 {
    margin: 0;
    font-size: 1rem;
}

.recipe-body {
    padding: var(--spacing-md);
}

.recipe-body p {
    font-size: 0.875rem;
    margin-bottom: var(--spacing-sm);
}

.recipe-tag {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: var(--accent-cool);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    margin-right: 0.25rem;
}

/* ===== Feature Cards ===== */
.feature-card {
    background: linear-gradient(135deg, var(--primary-light), white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    margin-bottom: var(--spacing-md);
}

/* ===== Info Boxes ===== */
.info-box {
    background-color: var(--primary-light);
    border-left: 4px solid var(--accent-cool);
    border-radius: var(--radius-sm);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.info-box h4 {
    margin-top: 0;
    margin-bottom: var(--spacing-sm);
}

.info-box ul {
    margin: 0;
    padding-left: 1.5rem;
}

.info-box li {
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.info-box ol {
    margin: 0;
    padding-left: 1.5rem;
}

.info-box ol li {
    margin-bottom: var(--spacing-sm);
    font-size: 0.875rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background-color: var(--accent-warm);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--accent-cool);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: white;
}

/* ===== Footer ===== */
footer {
    background-color: var(--primary-dark);
    color: var(--primary-light);
    text-align: center;
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-xl);
}

footer p {
    color: var(--primary-light);
    opacity: 0.8;
    margin: 0;
}

/* ===== Section Spacing ===== */
section {
    margin-bottom: var(--spacing-lg);
}

section:last-child {
    margin-bottom: 0;
}

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: var(--spacing-sm);
        padding: var(--spacing-sm);
    }
    
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-sm);
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: relative;
        margin-bottom: var(--spacing-md);
        max-height: none;
        overflow-y: visible;
    }
    
    .bento-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

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

.fade-in {
    animation: fadeIn 0.6s ease forwards;
}

/* ===== Utilities ===== */
.text-center { text-align: center; }
.text-muted { color: var(--text-light); }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }

/* ===== Advertisement Styles - AdSense Optimized ===== */
.ad-container {
    background: var(--ad-bg);
    border: 1px solid var(--ad-border);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    /* AdSense specific optimizations */
    clear: both;
    isolation: isolate;
}

/* AdSense ad elements should have no additional styling */
.ad-container > ins[data-ad-client] {
    border: none !important;
    background: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.ad-container > script {
    display: block;
}

.ad-placeholder {
    color: var(--ad-text);
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.7;
}

/* AdSense Standard Sizes - Exact Dimensions */
.ad-banner {
    min-height: 90px;
    max-width: 728px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    /* Prevent layout shift during ad load */
    aspect-ratio: 728/90;
}

.ad-rectangle {
    min-height: 250px;
    max-width: 300px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    /* Prevent layout shift during ad load */
    aspect-ratio: 300/250;
}

.ad-large-rectangle {
    min-height: 280px;
    max-width: 336px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    aspect-ratio: 336/280;
}

.ad-square {
    min-height: 250px;
    max-width: 250px;
    width: 100%;
    aspect-ratio: 1;
    margin-left: auto;
    margin-right: auto;
}

.ad-skyscraper {
    min-height: 600px;
    max-width: 160px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.ad-mobile-banner {
    min-height: 50px;
    max-width: 320px;
    width: 100%;
}

.ad-large-mobile-banner {
    min-height: 100px;
    max-width: 320px;
    width: 100%;
}

/* Ad positioning classes */
.ad-top {
    margin: 0 auto var(--spacing-lg);
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

.ad-bottom {
    margin: var(--spacing-lg) auto 0;
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
    position: relative;
    z-index: 10;
}

.ad-sidebar {
    position: relative;
    margin: var(--spacing-md) 0;
    width: 100%;
    box-sizing: border-box;
}

.ad-inline {
    margin: var(--spacing-lg) auto;
    max-width: 100%;
    clear: both;
}

.ad-floating {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 50;  /* Lower z-index to prevent overlap issues */
    box-shadow: var(--shadow-lg);
    max-width: 300px;
    opacity: 0.95;
}

/* AdSense Mobile Optimization */
@media (max-width: 768px) {
    .ad-banner {
        max-width: 320px;
        min-height: 50px;
        aspect-ratio: 320/50;
    }
    
    .ad-rectangle,
    .ad-large-rectangle {
        max-width: 300px;
        min-height: 250px;
        aspect-ratio: 300/250;
    }
    
    .ad-square {
        max-width: 250px;
        min-height: 250px;
        aspect-ratio: 1;
    }
    
    .ad-skyscraper {
        display: none; /* Hide skyscraper on mobile */
    }
    
    .ad-floating {
        position: fixed;
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
        width: auto;
        box-shadow: var(--shadow-lg);
        z-index: 1000;
    }
}

/* Very small mobile devices */
@media (max-width: 480px) {
    .ad-banner {
        max-width: 320px;
        min-height: 50px;
    }
    
    .ad-floating {
        position: static;
        margin: var(--spacing-md) auto;
        box-shadow: none;
        left: auto;
        right: auto;
        bottom: auto;
    }
}

/* Ad loading state */
.ad-loading {
    background: linear-gradient(90deg, var(--ad-bg) 25%, #f0f0f0 50%, var(--ad-bg) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

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

/* Ad close button (for floating ads) */
.ad-close {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    cursor: pointer;
    display: none;
    z-index: 100;
    transition: background 0.2s ease;
    line-height: 1;
}

.ad-close:hover {
    background: rgba(0, 0, 0, 0.9);
}

.ad-floating .ad-close {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hide ads for ad blockers with fallback content */
.ad-fallback {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Show fallback when ad is blocked */
.ad-container:empty + .ad-fallback {
    display: block;
}

/* ===== Dark Mode (Optional) ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-dark: #f8f9fa;
        --primary-light: #1a1a1a;
        --text-dark: #e8e4de;
        --text-light: #a8a8a8;
        --background: #0f0f0f;
        --card-bg: #1a1a1a;
        --border-light: #2c2c2c;
        --ad-bg: #2a2a2a;
        --ad-border: #404040;
        --ad-text: #a8a8a8;
    }
}
