/* === MODERN HERO ADDITIONS === */

.modern-hero {
    padding: 1.5rem 2rem 5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: visible;
    /* Changed from hidden so search dropdown can escape the container */
    background: radial-gradient(circle at top right, rgba(224, 122, 95, 0.08), transparent 50%),
        radial-gradient(circle at bottom left, rgba(129, 178, 154, 0.08), transparent 50%);
    border-radius: var(--radius);
    margin-bottom: 2rem;
    color: var(--color-text);
}

.hero-badge {
    display: inline-block;
    padding: 0.5rem 1.2rem;
    background: rgba(129, 178, 154, 0.15);
    color: var(--color-secondary-dark);
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
}

.modern-hero h1 {
    font-family: var(--font-display);
    font-size: 3.5rem;
    line-height: 1.2;
    max-width: 900px;
    margin-bottom: 1.5rem;
    color: var(--color-text);
    font-weight: 800;
    border: none;
}

.modern-hero h1 span {
    color: var(--color-primary);
}

.modern-hero h1 span.accent {
    color: var(--color-secondary-dark);
}

.modern-hero p {
    font-size: 1.15rem;
    color: var(--color-text-light);
    max-width: 650px;
    margin-bottom: 3.5rem;
}

/* Große Suchleiste */
.search-container {
    width: 100%;
    max-width: 750px;
    position: relative;
    display: flex;
}

.search-container input {
    width: 100%;
    padding: 1.2rem 2rem 1.2rem 3.5rem;
    font-size: 1.1rem;
    border: 2px solid transparent;
    border-radius: 99px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
    font-family: inherit;
    transition: all var(--transition);
    background: #fff;
    color: var(--color-text);
}

.search-container input::placeholder {
    color: var(--color-text-muted);
}

.search-container input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 12px 40px rgba(224, 122, 95, 0.15);
    transform: translateY(-2px);
}

.search-container .search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 1.2rem;
    opacity: 1;
}

.search-container .search-btn {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.8rem 1.8rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition);
}

.search-container .search-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-50%) scale(1.02);
}

@media (max-width: 768px) {
    .modern-hero h1 {
        font-size: 2.5rem;
    }

    .modern-hero {
        padding: 3rem 1.5rem;
    }

    .search-container input {
        padding: 1rem 1.2rem 1rem 3rem;
        font-size: 1rem;
    }

    .search-container .search-btn {
        display: none;
    }

    .header-submit-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }

    /* Reduce spacing between header and hero on mobile */
    .main-content {
        padding-top: 1rem !important;
    }

    .hero-section {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    .hero-container {
        padding-top: 0.5rem !important;
    }
}

/* === INLINE HEADER NAV OVERRIDES === */

/* Fix mobile toggle button layout */
@media (max-width: 768px) {
    .site-header {
        position: relative;
    }

    .site-header .header-inner {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    /* Make the dropdown menu full width below */
    .main-nav {
        order: 3;
        width: 100%;
        margin-top: 1rem;
        background: transparent !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        padding-top: 0.5rem;
        display: none;
        /* Ensure hidden initially on mobile */
    }

    .main-nav.active {
        display: block !important;
        /* Force visible when active */
    }

    .nav-inner {
        flex-direction: column;
    }
}

/* Desktop layout inline right */
@media (min-width: 769px) {
    .site-header .header-inner {
        justify-content: flex-start;
        align-items: center;
        gap: 2rem;
    }

    .main-nav {
        background: transparent !important;
        border-top: none !important;
        margin-left: auto;
        /* Push to the right side */
    }

    .nav-inner {
        justify-content: flex-end;
    }

    /* Prevent hidden dropdowns from causing horizontal scrollbars */
    .nav-group:nth-last-child(-n+3) .nav-dropdown {
        left: auto;
        right: 0;
    }
}

/* =========================================
   V4 Modern Redesign Additions
   ========================================= */
:root {
    --bg-main: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-accent: #fff7ed;

    --text-primary: #1e293b;
    --text-secondary: #64748b;

    --primary-color: #0f172a;
    --primary-hover: #334155;
    --accent-red: #9f1239;
    --accent-red-hover: #e11d48;

    --border-color: #e2e8f0;

    --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);
    --shadow-card: 0 20px 25px -5px rgb(0 0 0 / 0.05), 0 8px 10px -6px rgb(0 0 0 / 0.01);

    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 32px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base Body Update for Font */
body {
    color: var(--text-primary);
    background-color: var(--bg-main);
}

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

/* =========================================
   Hero Section
   ========================================= */
.hero-section {
    padding: 60px 0;
    overflow: visible;
}

.hero-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
    color: var(--primary-color);
}

.hero-content h1 span {
    color: var(--accent-red);
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 40px;
    max-width: 90%;
}

.hero-search {
    display: flex;
    align-items: center;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 8px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    max-width: 500px;
    position: relative;
    z-index: 50;
}

.hero-search:focus-within {
    border-color: var(--accent-red);
    box-shadow: 0 0 0 3px rgba(159, 18, 57, 0.1);
}

.hero-search i {
    padding: 0 16px;
    color: var(--text-secondary);
}

.hero-search input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

.hero-search .search-btn {
    background-color: var(--accent-red);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 40px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.hero-search .search-btn:hover {
    background-color: var(--accent-red-hover);
}

.hero-image-wrapper {
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    aspect-ratio: 4/5;
}

.hero-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.hero-image-wrapper:hover .hero-image {
    transform: scale(1.05);
}

/* =========================================
   Categories Area
   ========================================= */
.categories-section {
    padding: 40px 0 80px;
    background-color: var(--bg-secondary);
}

.section-header {
    margin-bottom: 40px;
    text-align: center;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color) !important;
    border-bottom: none !important;
    margin: 0 !important;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
}

.category-card {
    background-color: var(--bg-accent);
    border-radius: var(--radius-lg);
    text-align: left;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    border: none !important;
    overflow: hidden;
    padding: 0;
    gap: 0;
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-card);
    background-color: var(--bg-main);
}

.category-card::before {
    display: none !important;
}

.card-image-wrapper {
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

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

.card-content-wrapper {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 12px;
}

.card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.cat-icon-small {
    font-size: 1.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    background-color: rgba(159, 18, 57, 0.1);
    color: var(--accent-red);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.category-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    margin: 0;
}

.category-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
    flex-grow: 1;
}

.btn-read-more {
    display: block;
    width: 100%;
    background-color: #8B2C39;
    color: white;
    text-align: center;
    padding: 12px 0;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 10px;
    transition: background-color 0.2s;
}

.btn-read-more:hover {
    background-color: #6C222C;
}

@media (max-width: 900px) {
    .category-grid {
        grid-template-columns: 1fr 1fr;
    }

    @media (max-width: 500px) {
        .category-grid {
            grid-template-columns: 1fr;
        }
    }

    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content p {
        max-width: 100%;
        margin: 0 auto 32px;
    }

    .hero-search {
        margin: 0 auto;
    }
}

/* =========================================
   Dark Mode Overrides
   ========================================= */
.dark-mode {
    --bg-main: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-accent: #334155;

    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;

    --primary-color: #f8fafc;
    --border-color: #334155;

    --color-bg: #0f172a;
    --color-text: #f8fafc;
    --color-bg-warm: #1e293b;
    --color-bg-card: #1e293b;
    --color-border-light: #334155;
    --color-text-light: #cbd5e1;
    --color-text-muted: #94a3b8;
}

.dark-mode .search-container input,
.dark-mode .hero-search {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dark-mode .search-container input:focus,
.dark-mode .hero-search:focus-within {
    background-color: var(--bg-accent);
}

.dark-mode .site-header {
    background: #000;
}

/* Ensure the logo is still visible / looks good in dark mode */
.dark-mode .hero-content h1,
.dark-mode .hero-content h1 span.accent {
    color: var(--text-primary);
}

.dark-mode .section-header h2 {
    color: var(--text-primary) !important;
}

.dark-mode .category-card h3 {
    color: var(--text-primary) !important;
}

.dark-mode .cat-icon {
    color: #e2e8f0;
}

.dark-mode .badge {
    background-color: rgba(225, 29, 72, 0.2);
    color: #fda4af;
}

/* =========================================
   Search Dropdown Overrides
   ========================================= */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    margin-top: 4px;
    overflow: hidden;
    z-index: 200;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
}

.search-dropdown-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

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

.search-dropdown-item:hover {
    background: var(--bg-accent);
    color: var(--text-primary);
}

.search-dropdown-item span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* =========================================
   Mobile Responsiveness (V4 Additions)
   ========================================= */
@media (max-width: 768px) {

    /* Hero Section */
    .hero-container {
        grid-template-columns: 1fr;
        gap: 30px;
        text-align: center;
        padding-top: 100px;
        /* Account for fixed header */
        padding-bottom: 40px;
    }

    .hero-content h1 {
        font-size: 2.2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-search {
        flex-direction: column;
        border-radius: var(--radius-lg);
        padding: 15px;
        gap: 15px;
    }

    .hero-search input {
        width: 100%;
        text-align: center;
    }

    .hero-search .search-btn {
        width: 100%;
    }

    .hero-image-wrapper {
        aspect-ratio: 1/1;
        /* Square on mobile for better fit */
        display: none;
        /* Hide hero image on mobile to save space, or keep it square. Let's keep it square. */
        display: block;
    }

    /* Category Grid */
    .categories-section {
        padding: 40px 0;
    }

    .category-grid {
        grid-template-columns: 1fr;
        /* Single column on mobile */
        gap: 20px;
        padding: 0 15px;
    }

    .card-image-wrapper {
        height: 200px;
        /* Slightly taller image on mobile */
    }

    .section-header h2 {
        font-size: 1.8rem;
    }
}

/* ============================================================
   TOOL PAGE OPTIMIZATION (2-COLUMN DESKTOP)
   ============================================================ */

.tool-layout-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

@media (min-width: 1024px) {
    .tool-grid {
        display: grid;
        grid-template-columns: 1fr 400px;
        gap: 2.5rem;
        align-items: start;
        margin-top: 2rem;
    }

    .tool-results-wrapper {
        position: sticky;
        top: 100px;
    }

    /* Shared utility for the new layout */
    .tool-card-box {
        background: var(--color-bg-card);
        border-radius: 16px;
        padding: 2rem;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
        border: 1px solid var(--color-border-light);
    }

    /* Reset the fixed 600px width on the main container for these pages */
    .calc-container.wide {
        max-width: 1200px !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
    }
}

/* ============================================================
   CATEGORY HERO OPTIMIZATION (RESPONSIVE)
   ============================================================ */

.category-hero {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    background: #000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.category-hero-img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    opacity: 0.7;
    display: block;
    border-radius: 16px;
}

.category-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.2) 100%);
    border-radius: 16px;
}

.category-hero h1 {
    color: #ffffff;
    margin-bottom: 0.8rem;
    font-size: 2.22rem;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
    border: none;
    padding-bottom: 0;
    line-height: 1.2;
}

.category-hero p {
    color: #f8f9fa;
    font-size: 1.15rem;
    max-width: 800px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    margin: 0;
    line-height: 1.5;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .category-hero {
        margin-bottom: 1.5rem;
    }

    .category-hero-img {
        height: 240px;
        /* Slightly shorter on mobile */
    }

    .category-hero-overlay {
        padding: 1.25rem;
    }

    .category-hero h1 {
        font-size: 1.7rem !important;
        /* Force reduction on mobile */
        margin-bottom: 0.5rem;
    }

    .category-hero p {
        font-size: 1rem !important;
        /* Force reduction on mobile */
        line-height: 1.4;
        max-width: 100%;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        /* Prevent massive text blocks on tiny screens */
    }
}

@media (max-width: 480px) {
    .category-hero-img {
        height: 220px;
    }

    .category-hero h1 {
        font-size: 1.5rem !important;
    }

    .category-hero p {
        font-size: 0.95rem !important;
    }
}

/* =========================================
   Category Search Bar (Hero Overlay)
   ========================================= */
.category-hero-search {
    margin-top: 1.2rem;
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 100;
}

.category-hero-search .hero-search {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    position: relative;
}

.category-hero-search .hero-search input {
    color: #fff;
}

.category-hero-search .hero-search input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.category-search-dropdown-portal {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 400px;
    overflow-y: auto;
}

.category-search-dropdown-portal .search-dropdown-item {
    display: block;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: var(--transition);
}

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

.category-search-dropdown-portal .search-dropdown-item:hover {
    background: var(--bg-accent);
}

.category-search-dropdown-portal .search-dropdown-empty {
    padding: 12px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
}

@media (max-width: 768px) {
    .category-hero-search {
        max-width: 100%;
        margin-top: 0.8rem;
    }

    .category-hero-search .hero-search {
        flex-direction: row;
        padding: 4px;
        border-radius: 40px;
    }

    .category-hero-search .hero-search input {
        font-size: 0.8rem;
        padding: 5px 8px;
    }

    .category-hero-search .hero-search .search-btn {
        padding: 4px 10px;
        font-size: 0.7rem;
        white-space: nowrap;
        border-radius: 30px;
        width: 50%;
    }
}