/* ================================
   CRITICAL CSS - Above the Fold
   ================================ */

/* CSS Variables - Force background color for all browsers */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #2E7D32;
    --accent-color: #FF8C00;
    --text-color: #2d3748;
    --bg-color: #FAFAFA;
    --white: #ffffff;
    --shadow-light: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-medium: 0 8px 25px rgba(76,175,80,0.15);
    --shadow-heavy: 0 10px 40px rgba(0,0,0,0.08);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: #FAFAFA !important;
    background-color: #FAFAFA !important;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    /* Performance optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-display: swap;
}

/* Force background for all browsers including Vivaldi */
html {
    background: #FAFAFA !important;
    background-color: #FAFAFA !important;
    overflow-x: hidden;
}

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

/* CLS Prevention for Images - Aggressive approach */
/* EXCLUDE article content images from global styles */
img:not(article .article-content-text img) {
    max-width: 100%;
    height: auto;
    display: block;
    /* Force aspect ratio to prevent layout shift */
    aspect-ratio: 16/9;
    object-fit: cover;
    background-color: #f5f5f5;
}

/* Override for images with explicit dimensions */
img[width][height]:not(article .article-content-text img) {
    aspect-ratio: attr(width) / attr(height);
}

/* Prevent layout shift during image loading */
img:not([src]):not(article .article-content-text img) {
    visibility: hidden;
}

/* Reserve space for images immediately */
img[loading="lazy"]:not(article .article-content-text img) {
    min-height: 200px;
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

img[loading="lazy"].loaded:not(article .article-content-text img) {
    min-height: auto;
    background: none;
    animation: none;
}

/* Shimmer effect for loading images */
@keyframes shimmer {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ================================
   HEADER & NAVIGATION (Critical)
   ================================ */

.diet-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    box-shadow: 0 2px 20px rgba(76, 175, 80, 0.1);
    border-bottom: 1px solid rgba(76, 175, 80, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
}

.diet-nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    overflow: visible;
}

.diet-logo {
    flex-shrink: 0;
}

.diet-logo img {
    height: 120px !important;
    width: auto !important;
    max-width: 200px !important;
    display: block !important;
    transition: var(--transition);
    aspect-ratio: auto !important;
    object-fit: contain !important;
}

.diet-nav-menu {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0;
}

.diet-menu-list {
    display: flex;
    align-items: center;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
    overflow: hidden;
}

.diet-menu-item {
    flex-shrink: 0;
}

.diet-menu-link {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    border-radius: 12px;
    transition: var(--transition);
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(76, 175, 80, 0.2);
    margin: 0 2px;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
}

.diet-menu-link:hover {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), #66BB6A);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
    border-color: var(--primary-color);
}

/* ================================
   NAVBAR SEARCH (Critical)
   ================================ */

.navbar-search-input {
    padding: 8px 12px;
    border-radius: 20px;
    border: 2px solid rgba(76, 175, 80, 0.2);
    font-size: 13px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.1);
    transition: var(--transition);
    min-width: 140px;
    max-width: 160px;
    outline: none;
}

.navbar-search-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.1);
}

.navbar-search-btn {
    padding: 8px 16px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #66BB6A 100%);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    white-space: nowrap;
}

.navbar-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
}

/* ================================
   MOBILE MENU TOGGLE (Critical)
   ================================ */

.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.mobile-menu-toggle span {
    width: 24px;
    height: 3px;
    background: #374151;
    margin: 2px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* ================================
   PAGE BANNER (Critical)
   ================================ */

.diet-page-banner {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(76, 175, 80, 0.1);
    padding: 2.5rem 0;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.diet-page-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.05) 0%, rgba(33, 150, 243, 0.05) 100%);
    z-index: -1;
}

.diet-page-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color) 0%, #2196F3 50%, var(--accent-color) 100%);
    opacity: 0.6;
}

.diet-banner-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    position: relative;
    z-index: 1;
}

.diet-banner-title {
    text-align: center;
    font-size: 2.2rem;
    color: var(--text-color);
    margin: 0;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text-color) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ================================
   MOBILE RESPONSIVE (Critical)
   ================================ */

/* Desktop navbar - ensure visibility */
@media (min-width: 769px) {
    .diet-nav-menu {
        display: flex !important;
    }
    
    .mobile-menu-toggle {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .diet-nav-container {
        padding: 12px 16px;
    }
    
    .diet-nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
        margin-left: 0;
        z-index: 1001;
    }
    
    .diet-nav-menu.active {
        display: block;
    }
    
    .diet-menu-list {
        flex-direction: column;
        gap: 8px;
        padding: 20px;
        background: transparent;
        border: none;
    }
    
    .diet-menu-link {
        width: 100%;
        text-align: center;
        padding: 16px 20px;
        margin: 0;
        border-radius: 8px;
    }
    
    .diet-logo img {
        height: 90px;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .diet-page-banner {
        padding: 2rem 0;
    }
    
    .diet-banner-container {
        padding: 0 1rem;
    }
    
    .diet-banner-title {
        font-size: 1.6rem;
        letter-spacing: -0.3px;
    }
}

/* ================================
   IMAGE OPTIMIZATION (WebP Support)
   ================================ */

/* Logo optimization - Use diyetlistemcom.png */
.diet-logo img {
    /* Remove background images that cause 410 errors */
    background: none !important;
    object-fit: contain !important;
    width: 200px !important;
    height: 118px !important;
    max-width: 200px !important;
    max-height: 118px !important;
    /* CLS Prevention */
    contain: layout style;
    transform: translateZ(0);
    aspect-ratio: auto !important;
    display: block !important;
}

/* Remove WebP support (causes 410 errors) */
/* Commented out to prevent 410 errors
@supports (background-image: url('data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=')) {
    .diet-logo img {
        background-image: url('/favicon.ico');
    }
}
*/

/* ================================
   FONT LOADING OPTIMIZATION
   ================================ */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Inter Regular'), local('Inter-Regular');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: local('Poppins SemiBold'), local('Poppins-SemiBold');
}
