/* --- Gava.no Produktannonse Styling for 433.no --- */
/* Versjon 6 - Bruker Flexbox for desktop og mobil grid, justert bilder */

/* * Denne filen skal IKKE inkluderes i style.css.
 * Den skal lastes inn separat via functions.php (wp_enqueue_style) 
 * kun på de sidene der annonsen vises (f.eks. is_single()).
 */

/* * Vi fjerner 'body, html' regelen siden denne filen lastes 
 * inn på en eksisterende side og vi ikke skal overskrive
 * sidens globale fonter eller marginer.
 */

/* Hovedcontainer - Størrelse satt av 433.no, men vi bruker den for layout */
.gava-ad-container {
    width: 100%;
    height: 100%; /* Fyller plassen gitt av 433.no */
    background-color: #f8f8f8; /* Lys bakgrund */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #eee; /* Tynn ramme */
    border-radius: 12px; /* MYKERE KANTER: Avrundet container */
    
    /* Bruker systemfont som fallback for Satoshi */
    font-family: 'Satoshi', sans-serif; 
}

/* Lenke som dekker hele annonsen for et hoved-klikkpunkt */
.gava-ad-main-link {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
    box-sizing: border-box;
}

/* Header-seksjon (Logo + tagline) */
.gava-ad-header {
    background-color: #0702a9; /* Gava-blå */
    padding: 8px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Logo til venstre, tagline til høyre */
    box-sizing: border-box;
    /* Avrundede hjørner kun øverst */
    border-radius: 11px 11px 0 0; 
    flex-shrink: 0; /* Hindrer headeren i å krympe */
}

.gava-ad-logo {
    height: 40px; /* Liten logo */
    width: auto;
}

.gava-ad-tagline {
    color: white;
    font-size: 13px;
    font-weight: 500; /* Medium vekt */
    white-space: nowrap; /* Unngå at tagline bryter */
}

/* Container for produktene - Bruker Flexbox */
.gava-ad-product-grid {
    display: flex; 
    flex-wrap: wrap; 
    justify-content: space-between; 
    padding: 10px; 
    flex-grow: 1; 
    box-sizing: border-box;
    overflow: hidden; 
}

/* Individuelt produktkort - Justert for Flexbox */
.gava-ad-product-card {
    background-color: white;
    border-radius: 10px; /* MYKERE KANTER: Avrundede produktkort */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06); /* Subtil skygge */
    transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
    flex-basis: calc(25% - 8px); /* 4 kolonner, juster gap manuelt */
    max-width: calc(25% - 8px); 
    box-sizing: border-box; 
    margin-bottom: 10px; /* Simulerer 'gap' vertikalt */
}
.gava-ad-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
}

/* Lenke rundt hvert produkt (viktig for affiliate) */
.gava-ad-product-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Produktbilde */
.gava-ad-product-image {
    width: 100%;
    aspect-ratio: 4 / 3; /* ENDRET: Litt mindre dominant bilde */
    overflow: hidden;
    background-color: #fff; /* Placeholder farge */
    border-bottom: 1px solid #f0f0f0; /* Tynn linje under bildet */
}

.gava-ad-product-image img {
    width: 100%;
    margin-top:7px;
    height: 90%;
    object-fit: contain; /* ENDRET: Viser hele bildet */
    display: block;
}

/* Innhold under bildet */
.gava-ad-product-content {
    padding: 10px 12px; 
    display: flex;
    flex-direction: column;
    flex-grow: 1; 
    justify-content: space-between; 
}

/* Butikknavn (lite) */
.gava-ad-store-name {
    font-size: 11px;
    color: #555; 
    margin-bottom: 5px;
    display: block; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600; /* FONT-WEIGHT: Butikknavn */
}

/* Produkttittel */
.gava-ad-product-title {
    font-size: 14px; 
    font-weight: 500; /* FONT-WEIGHT: Produkttittel */
    color: #111;
    line-height: 1.35;
    margin: 0 0 6px 0; 
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 38px; 
}

/* Pris */
.gava-ad-product-price {
    font-size: 15px; 
    font-weight: 500; /* FONT-WEIGHT: Pris */
    color: #000; 
    margin-top: auto; 
    text-align: left; 
}

/* --- Footer Knapp --- */
.gava-ad-footer {
    padding: 10px; /* Samme padding som product-grid */
    background-color: #f8f8f8; /* Samme som hovedbakgrunn */
    text-align: center;
    flex-shrink: 0; /* Hindrer at knappen krymper for mye */
    border-top: 1px solid #eee; /* Linje over knappen */
     /* Avrundede hjørner kun nederst */
    border-radius: 0 0 11px 11px;
}

.gava-ad-footer-button {
    display: inline-block;
    background-color: #0702a9; /* Gava-blå (fra din kode) */
    color: white;
    padding: 10px 25px; /* Litt mindre padding enn før */
    border-radius: 50px; /* Runde kanter */
    text-decoration: none;
    font-weight: 600; /* Tykkere tekst */
    font-size: 14px;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.gava-ad-footer-button:hover {
    background-color: #05018a; /* Litt mørkere blå ved hover */
    transform: scale(1.03); /* Liten zoom-effekt */
}


/* --- Media Query for mobil (ENDRET TIL FLEXBOX) --- */
@media (max-width: 600px) {
    .gava-ad-container {
        border-radius: 10px; 
    }
    .gava-ad-header {
        padding: 6px 12px; 
        border-radius: 9px 9px 0 0; 
    }
    .gava-ad-logo {
        height: 38px;
        padding: 4px;
    }
    .gava-ad-tagline {
        font-size: 15px;
        padding:5px;
    }

    /* Bruker Flexbox også for mobil */
    .gava-ad-product-grid {
        display: flex; /* ENDRET */
        flex-wrap: wrap; /* ENDRET */
        justify-content: space-between; /* ENDRET */
        padding: 8px; /* ENDRET */
        /* Fjerner grid-spesifikke regler */
        /* grid-template-columns: repeat(2, 1fr); */
        /* gap: 8px; */ 
    }

    .gava-ad-product-card {
        border-radius: 8px; 
        /* ENDRET: Setter bredde med calc() for mobil */
        flex-basis: calc(50% - 4px); /* 2 kolonner, juster gap manuelt (8px / 2) */
        max-width: calc(50% - 4px);
        margin-bottom: 8px; /* Simulerer gap vertikalt */
    }

    .gava-ad-product-content {
        padding: 8px 10px;
    }

     .gava-ad-store-name {
        font-size: 10px;
        margin-bottom: 4px;
        /* font-weight: 600; Beholdes fra desktop */
    }
    
    .gava-ad-product-title {
        font-size: 12px; 
        line-height: 1.3;
        min-height: 31px; 
        margin-bottom: 5px;
        /* font-weight: 500; Beholdes fra desktop */
    }

    .gava-ad-product-price {
        font-size: 13px;
        /* font-weight: 600; Beholdes fra desktop */
    }
    
    .gava-ad-footer {
        padding: 8px; /* Litt mindre padding */
        border-radius: 0 0 9px 9px; /* Matcher container */
    }

    .gava-ad-footer-button {
        padding: 9px 20px;
        font-size: 13px;
    }
}