/* --- Global Variables for consistent design --- */
:root {
    --primary: #2c3e50;      /* Dark blue-grey for the navigation bar - Dunkles Blau-Grau */
    --accent: #27ae60;       /* Fresh green for active sidebar items - Frisches Grün */
    --highlight: #f39c12;    /* Warm orange for active states and accents - Warmes Orange */
    --brand-orange: #e67e22; /* Primary brand color for the logo - Markenfarbe Orange */
    --bg-body: #f4f7f6;      /* Light background for the page body - Heller Hintergrund */
    --bg-card: #ffffff;      /* Pure white for content containers - Weißer Hintergrund */
    --text-main: #333333;    /* Main text color - Haupttextfarbe */
    --text-muted: #7f8c8d;   /* Muted grey for secondary information - Dezente Textfarbe */
    --border: #e0e0e0;       /* Standard border color - Standard Rahmenfarbe */
}

/* --- Global Reset for Box Sizing --- */
/* Important: Ensures padding/border doesn't increase element width */
*, *::before, *::after {
    box-sizing: border-box;
}

/* --- Basic Styles --- */
body {
    background-color: var(--bg-body);
    font-family: 'Inter', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
    overflow-x: hidden; /* Safety net against horizontal scroll */
    width: 100%;
}

/* --- Main Layout Container (Grid) --- */
#container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg-card);
    display: grid;
    /* Define layout grid areas */
    grid-template-areas: 
        "header header" 
        "topnav topnav" 
        "leftnav content" 
        "footer footer";
    grid-template-columns: 240px 1fr; /* Fixed sidebar width, flexible content */
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
}

/* --- Header Section: Optimized for logo visibility and ad placement --- */
.topbox {
    grid-area: header;
    background: #ffffff;
    padding: 10px 0;
    min-height: 100px; /* Prevents header collapse while loading ads */
    display: flex;
    align-items: center;
    width: 100%;
    /* Important for Grid items on mobile to prevent overflow */
    min-width: 0; 
}

.header-container {
    max-width: 1200px; /* Matches the calendar grid width for visual alignment */
    width: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: space-between; /* Logo on the left, Ads on the right */
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Logo protection to prevent cutting off or shrinking */
.logo-section {
    flex: 0 0 auto; /* Ensures the logo never loses its defined width */
    min-width: 250px; /* Reserves space for the brand name */
    z-index: 10;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    text-decoration: none;
    gap: 12px;
}

.logo-pin {
    width: 16px;
    height: 16px;
    background: var(--brand-orange);
    border-radius: 50% 50% 50% 0; /* Creates pin shape */
    transform: rotate(-45deg);
    display: inline-block;
}

.logo-text {
    font-size: 32px;
    font-weight: 300;
    color: var(--brand-orange);
    letter-spacing: -1px;
    line-height: 1;
    /* Important: Keeps logo text on one line and prevents cropping */
    white-space: nowrap; 
}

.logo-text b {
    font-weight: 800;
    color: var(--primary);
}

.logo-suffix {
    color: #bdc3c7;
    font-size: 20px;
    font-weight: 300;
}

/* --- AdSense Section with strict height and width limits --- */
.ads-section {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-end;
    max-height: 90px;
    overflow: hidden; /* Clips any ad that exceeds the allowed height/width */
}

.ad-container-mobile-limit {
    max-width: 728px;
    width: 100%;
    max-height: 90px;
    overflow: hidden;
}

/* --- Dark Navigation Bar: Restored classic look with modern details --- */
.main-nav { 
    grid-area: topnav; 
    background: var(--primary); 
    border-bottom: 3px solid var(--highlight); /* Elegant orange accent line */
    position: sticky;
    top: 0;
    z-index: 1000;
    /* CRITICAL FIX: Allows the container to shrink below content width so scrollbar appears */
    min-width: 0; 
    width: 100%;
}

.main-nav ul { 
    list-style: none; 
    display: flex; 
    max-width: 1200px;
    margin: 0 auto; 
    padding: 0 10px; 
}

.main-nav a { 
    color: #ffffff; 
    text-decoration: none; 
    padding: 16px 20px; 
    display: block; 
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s ease;
}

.main-nav a:hover {
    background: rgba(255,255,255,0.1);
}

.main-nav a.active { 
    background: var(--highlight); 
    color: #ffffff;
}

/* --- Sidebar Navigation --- */
.left-nav { 
    grid-area: leftnav; 
    padding: 25px 20px; 
    background: #fafafa; 
    border-right: 1px solid var(--border); 
}

.left-nav h3 {
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    padding-bottom: 5px;
}

.left-nav a { 
    display: block; 
    padding: 10px 15px; 
    text-decoration: none; 
    color: var(--text-main); 
    background-color: #ffffff; 
    border: 1px solid var(--border); 
    border-radius: 4px; 
    margin-bottom: 6px; 
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.left-nav a:hover { 
    background: #f1f5f9; 
    border-color: var(--primary);
}

.left-nav a.active-item { 
    background: var(--accent); 
    color: #ffffff; 
    border-color: var(--accent);
    font-weight: 600;
}

/* --- Main Content Area --- */
.content-area { 
    grid-area: content; 
    padding: 40px; 
    /* Prevent content overflow on small screens */
    min-width: 0; 
}

/* --- New Styles for Year Navigation and SEO Text --- */
.year-navigation {
    display: flex;
    justify-content: flex-end; /* Changed from center to flex-end (right aligned) */
    flex-wrap: wrap; 
    gap: 10px;
    margin-bottom: 25px;
    padding: 10px 0; /* Removed horizontal padding to align with text edge */
    background: transparent; /* Removed background for cleaner look */
    border-bottom: none; /* Removed border */
}

.year-navigation a {
    text-decoration: none;
    color: var(--text-main);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: 'Inter', monospace; 
    transition: all 0.2s ease;
}

.year-navigation a:hover {
    background-color: var(--primary);
    color: #ffffff;
}

.year-navigation a.active-year {
    font-weight: bold;
    color: var(--brand-orange);
    border-bottom: 2px solid var(--brand-orange);
}

.year-navigation span.separator {
    color: #d1d5db;
    align-self: center;
    font-size: 0.8rem;
}

.seo-intro-text {
    margin-bottom: 30px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-main);
    max-width: 800px;
}

.seo-intro-text strong {
    color: var(--primary);
}

/* --- Footer --- */
.footer { 
    grid-area: footer; 
    padding: 25px; 
    text-align: center; 
    border-top: 1px solid var(--border); 
    background: #f8fafc;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footer a {
    color: var(--primary);
    text-decoration: none;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 1024px) {
    #container { 
        grid-template-areas: 
            "header" 
            "topnav" 
            "content" 
            "leftnav" 
            "footer"; 
        grid-template-columns: 100%; /* Force single column */
        width: 100%;
        overflow-x: hidden;
    }
    
    .header-container {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .logo-section {
        min-width: 100%;
        display: flex;
        justify-content: center;
    }

    .ads-section {
        justify-content: center;
        width: 100%;
        max-height: 60px; /* Tight vertical limit for mobile screens */
    }

    .ad-container-mobile-limit {
        max-height: 60px;
        max-width: 100%; /* Changed from 100vw to 100% to respect scrollbars */
    }

    /* Horizontal scroll for the navigation bar on mobile devices */
    .main-nav ul {
        width: 100%;
        overflow-x: auto; /* Enables swipe scrolling */
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0;
        /* Ensure scrolling area doesn't exceed screen width */
        max-width: 100vw; 
    }
    
    .main-nav li {
        flex: 0 0 auto; /* Prevents items from squishing */
    }
    
    .main-nav ul::-webkit-scrollbar {
        display: none; /* Keeps the look clean without scrollbar */
    }

    .content-area {
        padding: 20px;
    }

    .left-nav { 
        border-right: none; 
        border-top: 1px solid var(--border); 
    }
    
    /* Center year navigation on mobile for better usability */
    .year-navigation {
        justify-content: center;
    }
}