/*
Theme Name: GeneratePress Child
Version: 20.0.0
Description: Ultimate Consolidated Stylesheet: Responsive Grid, High-Conversion CTAs, Stacked Price Rows, Dark Sidebar, and No Side-Scroll.
*/

/* =========================================================================
   1. FONTS & DESIGN VARIABLER
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800&family=Montserrat:wght@400;500;700&display=swap');

:root {
    --brand-primary: #34495e;
    --brand-secondary: #2c3e50;
    --brand-accent: #e67e22;      /* Orange */
    --brand-action: #3498db;      /* Blå */
    --brand-success: #27ae60;     /* Grøn */
    --text-main: #2d3748;
    --text-light: #7a8896;
    --radius: 12px;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 30px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

/* =========================================================================
   2. GLOBAL SCROLL RESET (Sikrer lodret scroll uden side-slinger)
   ========================================================================= */
html, body {
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #fcfcfc;
    color: var(--text-main);
    line-height: 1.6;
}

/* =========================================================================
   3. HEADER & GLYPH MENU (GeneratePress mørk stil)
   ========================================================================= */
.site-header, .main-navigation, .main-navigation ul ul {
    background-color: var(--brand-primary) !important;
}

.main-title a, .main-navigation .main-nav ul li a {
    color: #ffffff !important;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
}

/* Orange Menu CTA Knap */
#menu-item-30468 a {
    background-color: var(--brand-accent) !important;
    color: #fff !important;
    border-radius: 6px;
    padding: 10px 20px !important;
    transition: var(--transition);
}

#menu-item-30468 a:hover {
    background-color: #d35400 !important;
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .site-header { padding: 5px 0 !important; }
    .main-title { font-size: 18px !important; }
    .inside-header { padding: 0 10px !important; }
}

/* =========================================================================
   4. RÆKKEFØLGE PÅ ARKIVSIDER (Tvinger søg øverst og produkter nederst)
   ========================================================================= */
.ape-container {
    display: flex !important;
    flex-direction: column !important;
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.ape-archive-header { order: 1; width: 100%; margin-bottom: 20px; }
.ape-filter-bar { 
    order: 2; 
    width: 100%; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 15px; 
    background: #f9f9f9; 
    padding: 20px; 
    border-radius: var(--radius); 
    border: 1px solid #eee; 
    margin-bottom: 40px !important;
    box-sizing: border-box;
}
#ape-results-wrapper { order: 3; width: 100%; }

.ape-filter-item { flex: 1; min-width: 250px; }
.ape-filter-item label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; margin-bottom: 5px; color: var(--text-light); }
.ape-filter-item input, .ape-filter-item select { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 16px; background: #fff; }

/* =========================================================================
   5. PRODUCT GRID & TITLER I FULD HØJDE (Vigtigt: Ingen mase-effekt)
   ========================================================================= */
.ape-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    gap: 20px;
    width: 100%;
}

.ape-card {
    background: #ffffff;
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    flex-direction: column;
    text-align: center;
    transition: var(--transition);
    height: 100%;
    box-sizing: border-box;
}

.ape-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: var(--brand-action); }

.ape-img-container { height: 140px; display: flex; align-items: center; justify-content: center; margin-bottom: 15px; }
.ape-img-container img { max-height: 100%; max-width: 100%; object-fit: contain; }

.ape-title {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #333;
    line-height: 1.4;
    height: auto !important; /* Vokser til fuld højde */
    min-height: 3.5em; /* Holder symmetri på korte titler */
    margin-bottom: 15px;
    overflow: visible !important;
    display: block !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
}

.ape-price { 
    color: var(--brand-success); 
    font-weight: 800; 
    font-size: 1.25rem; 
    margin-top: auto; /* Putter pris og knap i bunden så rækken flugter */
    margin-bottom: 15px; 
}

/* =========================================================================
   6. KNAPPER & CTA DESIGN (Premium pop-out-effekt)
   ========================================================================= */
.ape-btn, .ape-main-cta, .ape-table-btn {
    display: block;
    text-align: center;
    text-decoration: none !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    border-radius: 8px;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

/* Blå Handlingsknap (Grid) */
.ape-btn { background: var(--brand-action); color: #fff !important; padding: 10px; font-size: 0.8rem; }
.ape-btn:hover { background: #2980b9; transform: translateY(-2px); }

/* Stor Grøn CTA (Køb/Se Tilbud) */
.ape-main-cta { 
    background: linear-gradient(180deg, #2ec771, #27ae60) !important; 
    color: #fff !important; 
    padding: 15px 25px; 
    font-size: 1.1rem; 
    flex-grow: 1; 
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
}
.ape-main-cta:hover { filter: brightness(1.1); transform: translateY(-2px); box-shadow: var(--shadow-hover); }

/* =========================================================================
   7. INDIVIDUEL PRODUKTSIDE (Billede til venstre, Info til højre)
   ========================================================================= */
.ape-single-container .ape-product-top { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 40px; 
}

.ape-product-image, .ape-product-info { 
    flex: 1 1 350px; 
    max-width: 100%; 
}

/* Stor Pris Styling i Best Price Box */
.ape-main-price {
    font-family: 'Poppins', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    color: var(--brand-success);
    line-height: 1;
    display: inline-block;
}

.ape-best-price-box {
    background: #fff;
    border: 2px solid #eee;
    border-left: 6px solid var(--brand-success);
    padding: 30px;
    border-radius: var(--radius);
    margin-bottom: 35px;
    box-shadow: var(--shadow);
}

/* =========================================================================
   8. PRISSAMMENLIGNING TABEL (Flotte stablede rækker på desktop & mobil)
   ========================================================================= */
.ape-comparison-section {
    margin: 50px 0;
    background: #fff;
    padding: 25px;
    border-radius: 15px;
    border: 1px solid #eee;
}

.ape-price-table { 
    display: block !important; 
    width: 100% !important; 
    border-collapse: collapse;
}

.ape-price-table thead { 
    display: none !important; /* Skjuler gammeldags tabelhoveder */
}

.ape-price-table tbody { 
    display: flex !important; 
    flex-direction: column !important; 
    gap: 12px !important; 
    width: 100% !important;
}

/* Gør hver række til en lækker bar/bjælke */
.ape-price-table tr { 
    display: flex !important; 
    align-items: center !important; 
    justify-content: space-between !important; 
    background: #ffffff !important; 
    border: 1px solid #eee !important; 
    padding: 15px 25px !important; 
    border-radius: 10px !important;
    transition: var(--transition) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02) !important;
    box-sizing: border-box !important;
}

.ape-price-table tr:hover {
    border-color: var(--brand-action) !important;
    transform: translateX(5px) !important;
}

.ape-price-table td {
    display: block !important;
    padding: 0 !important;
    border: none !important;
}

.ape-retailer-name { font-size: 1.1rem; font-weight: 700; color: var(--brand-primary); }
.ape-stock-status { color: var(--brand-success); font-size: 0.8rem; font-weight: 600; }
.ape-table-price { font-size: 1.3rem; font-weight: 800; color: var(--text-main); }
.ape-table-action { text-align: right; }

.ape-table-btn {
    background: var(--brand-primary) !important;
    color: #fff !important;
    padding: 10px 20px;
    font-size: 0.85rem !important;
    min-width: 120px;
}

/* =========================================================================
   9. SIDEBAR WIDGETS (Mørke gradients & tving hvide links)
   ========================================================================= */
.sidebar .widget {
    background: linear-gradient(145deg, #2c3e50, #34495e) !important;
    color: #ffffff !important;
    padding: 25px !important;
    border-radius: var(--radius) !important;
    border: 1px solid #4a6278 !important;
    margin-bottom: 25px !important;
    box-shadow: 0 8px 25px rgba(0,0,0,.2) !important;
}

.sidebar .widget a, .sidebar .widget li a {
    color: #ffffff !important; /* Hvide links */
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: block;
    padding: 8px 0;
    transition: var(--transition);
}

.sidebar .widget a:hover { color: var(--brand-accent) !important; padding-left: 5px; }
.sidebar .widget .widget-title { color: #fff !important; border-bottom: 3px solid var(--brand-accent); padding-bottom: 10px; }

/* =========================================================================
   10. ULTIMATIVE MOBIL & RESPONSIVE BREAKPOINTS (Tvinger 2 kolonner på mobil)
   ========================================================================= */

@media (max-width: 1024px) {
    .ape-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important; gap: 15px !important; }
}

@media (max-width: 768px) {
    /* Mobil Grid - Altid 2 kolonner og intet side-slinger */
    #ape-results-wrapper, .ape-grid, .brand-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .ape-container { padding: 0 10px !important; margin-top: 20px !important; }
    .ape-card { padding: 10px !important; }
    .ape-img-container { height: 110px !important; }
    .ape-title { font-size: .8rem !important; }
    .ape-price { font-size: 1rem !important; }
    .ape-filter-item { min-width: 100% !important; }
    
    /* Gør H1 mindre på mobil */
    h1 { font-size: 1.7rem !important; }
    
    /* Blogindlæg/GeneratePress blog bliver 1 kolonne */
    .blog #main, .archive #main { grid-template-columns: 1fr !important; }
    
    /* Menu knap fylder hele bredden */
    #menu-item-30468 a { margin: 10px 0 !important; display: block; text-align: center; }

    /* Single page mobil stacking */
    .ape-main-price { font-size: 2.2rem; }
    .ape-best-price-box { padding: 20px; text-align: center; }
    .ape-price-row { flex-direction: column; }
    .ape-main-cta { width: 100%; }

    /* Tvinger prissammenligning til fuld bredde og lodret stak */
    .ape-price-table tr { 
        flex-direction: column !important; 
        text-align: center !important; 
        gap: 12px !important;
        padding: 15px !important;
    }
    .ape-table-action { text-align: center !important; width: 100% !important; }
    .ape-table-btn { width: 100% !important; }
}

/* Ekstra fix til meget små skærme */
@media (max-width: 380px) {
    #ape-results-wrapper, .ape-grid, .brand-grid { gap: 8px !important; }
    .ape-card { padding: 8px !important; }
    .ape-img-container { height: 95px !important; }
}

/* Pagination */
.ape-pagination { margin-top: 40px; text-align: center; width: 100%; }
.ape-pagination .page-numbers { 
    padding: 8px 14px; margin: 3px; background: #fff; border: 1px solid #ddd; border-radius: 5px; 
    text-decoration: none; font-weight: 700; color: var(--brand-primary); 
}
.ape-pagination .current { background: var(--brand-accent) !important; color: #fff !important; }

/* Placeholder i Sidebar Widget */
.ape-deal-widget-no-image {
    width: 60px;
    height: 60px;
    background: #f0f0f0;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 7px; /* Meget lille tekst til sidebaren */
    color: #999;
    padding: 2px;
    text-transform: uppercase;
    font-weight: 700;
    line-height: 1.1;
    border: 1px dashed #ccc;
    box-sizing: border-box;
}

/* --- PLACEHOLDER FOR MANGLENDE BILLEDER --- */
.ape-no-image {
    background-color: #f8f9fa;
    color: #a0aec0;
    width: 100%;
    height: 100%;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 8px;
    border: 1px dashed #cbd5e0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Gør teksten større på produktsiden */
.ape-product-image .ape-no-image {
    min-height: 350px;
    font-size: 1.1rem;
}

/* Tvinger billed-linket i sidebaren til at have en fast størrelse */
.ape-deal-widget-image-link {
    display: block !important;
    width: 60px !important;
    height: 60px !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
}

/* Gør selve placeholderen synlig */
.ape-deal-widget-no-image {
    display: flex !important;
    width: 60px !important;
    height: 60px !important;
    background-color: #e2e8f0 !important; /* Lys grå der ses tydeligt mod mørk blå */
    border: 1px dashed #94a3b8 !important;
    border-radius: 4px !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

/* Styler teksten inde i placeholderen */
.ape-deal-widget-no-image span {
    font-size: 7px !important;
    line-height: 1 !important;
    color: #475569 !important;
    text-transform: uppercase !important;
    font-weight: 800 !important;
    text-align: center !important;
    padding: 2px !important;
    display: block !important;
}

/* Sikrer at billeder i sidebaren også holder sig til 60x60 */
.ape-deal-widget-image-link img {
    width: 60px !important;
    height: 60px !important;
    object-fit: cover !important;
    display: block !important;
}