/**
 * Storage Units – public-facing styles
 * Used by: public/partials/flexi-lagerbod-storage-units.php
 *          public/partials/flexi-lagerbod-no-units.php
 * Shortcode: [flexi_lagerbod_units] / [flexi_lagerbod_location]
 */

/* ==========================================================================
   No-units fallback (flexi-lagerbod-no-units.php)
   ========================================================================== */

.flexi-no-units-section {
    padding: 80px 0 96px;
    background: #eef3f7;
}

.flexi-no-units-inner {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.flexi-no-units-icon {
    width: 72px;
    height: 72px;
    background: #e6f3eb;
    border: 2px solid #b8dfc7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.flexi-no-units-icon svg {
    width: 36px;
    height: 36px;
}

.flexi-no-units-eyebrow {
    display: inline-block;
    color: #008849;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
}

.flexi-no-units-title {
    font-size: clamp(1.9rem, 4vw, 2.75rem);
    font-weight: 800;
    color: #171c20;
    letter-spacing: -0.045em;
    line-height: 1.05;
    margin: 0 0 1rem;
}

.flexi-no-units-text {
    font-size: 1.05rem;
    color: #4d5661;
    line-height: 1.75;
    max-width: 540px;
    margin: 0 0 2.5rem;
}

/* Other locations label */
.flexi-no-units-locations-label {
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #008849;
    margin: 0 0 1.1rem;
}

/* Location link cards */
.flexi-no-units-location-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    width: 100%;
}

.flexi-no-units-location-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    background: #ffffff;
    border: 1px solid rgba(223, 227, 232, 0.9);
    border-radius: 1.1rem;
    padding: 1.25rem 3rem 1.25rem 1.4rem;
    min-width: 200px;
    text-decoration: none !important;
    color: inherit !important;
    box-shadow: 0 8px 28px -16px rgba(23, 28, 32, 0.18);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.flexi-no-units-location-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 44px -20px rgba(23, 28, 32, 0.28);
    border-color: #008849;
    color: inherit !important;
    text-decoration: none !important;
}

.flexi-no-units-loc-name {
    font-size: 1rem;
    font-weight: 700;
    color: #171c20;
    line-height: 1.25;
}

.flexi-no-units-loc-city {
    font-size: 0.8rem;
    color: #6b7785;
    line-height: 1;
}

.flexi-no-units-loc-count {
    margin-top: 0.55rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: #008849;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.flexi-no-units-loc-price {
    font-size: 0.8rem;
    color: #4d5661;
}

.flexi-no-units-loc-arrow {
    position: absolute;
    inset: auto 1.1rem 1.25rem auto;
    font-size: 1.1rem;
    color: #008849;
    transition: transform 0.25s ease;
}

.flexi-no-units-location-card:hover .flexi-no-units-loc-arrow {
    transform: translateX(4px);
}

/* ==========================================================================
   Wrapper
   ========================================================================== */

.flexi-lagerbod-units-wrapper {
    padding: 76px 0 84px;
    background: #EDF6EF;
}

.flexi-location-showcase-wrapper {
    background: #EDF6EF;
}

.flexi-units-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.85rem;
    color: #171c20;
    text-align: left;
    letter-spacing: -0.055em;
    line-height: 0.95;
}

.flexi-units-subtitle {
    font-size: 0.95rem;
    color: #4d5661;
    text-align: left;
    margin-bottom: 1rem;
    max-width: 42rem;
    line-height: 1.65;
}

/* ==========================================================================
   Multi-location showcase (else branch)
   ========================================================================== */

.flexi-location-showcase {
    background: #ffffff;
    border-radius: 1.75rem;
    overflow: hidden;
    box-shadow: 0 30px 70px -48px rgba(23, 28, 32, 0.45);
    margin-bottom: 2rem;
}

.flexi-location-showcase > .row > .col-lg-4,
.flexi-location-showcase > .row > .col-lg-8 {
    display: flex;
    min-width: 0; /* prevent flex children from expanding beyond container */
}

/* Media panel */
.flexi-location-showcase-media {
    position: relative;
    flex: 1 1 auto;
    min-height: 420px;
    background: #dfe3e8;
    overflow: hidden;
}

.flexi-location-showcase-media::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--bg-image);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.flexi-location-showcase-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(23, 28, 32, 0.12) 0%, rgba(23, 28, 32, 0.78) 100%);
}

.flexi-location-showcase-copy {
    position: absolute;
    inset: auto 1.5rem 1.5rem 1.5rem;
    z-index: 1;
    color: #ffffff;
}

.flexi-location-showcase-badge {
    display: inline-flex;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: #008849;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.flexi-location-showcase-copy h3 {
    margin: 0 0 0.4rem;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #ffffff;
}

.flexi-location-showcase-copy p {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.82);
}

.flexi-location-showcase-meta {
    margin-top: 1rem;
}

.flexi-location-showcase-meta span {
    display: inline-flex;
    align-items: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(10px);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Content panel */
.flexi-location-showcase-content {
    padding: 2rem;
    flex: 1 1 auto;
    min-width: 0; /* required in flex context to allow shrinking */
    overflow: hidden;
}

.flexi-location-showcase-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.flexi-location-showcase-heading .flexi-card-cta-btn,
.flexi-location-showcase-footer .flexi-card-cta-btn {
    background: #008849;
    border-color: #008849;
    color: #ffffff;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.75rem 1.25rem;
    min-height: 0;
    backdrop-filter: none;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.25s ease, border-color 0.25s ease;
    max-width: 100%;
}

.flexi-location-showcase-heading .flexi-card-cta-btn:hover,
.flexi-location-showcase-footer .flexi-card-cta-btn:hover {
    background: #006f3b;
    border-color: #006f3b;
    color: #ffffff;
}

.flexi-location-showcase-title {
    margin: 0 0 0.45rem;
    font-size: 1.8rem;
    font-weight: 800;
    color: #171c20;
    letter-spacing: -0.04em;
}

.flexi-location-showcase-text {
    margin: 0;
    color: #5f5e5e;
    line-height: 1.7;
    font-size: 0.96rem;
    max-width: 46rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Size sample cards inside showcase */
.flexi-location-size-sample {
    height: 100%;
    padding: 1.35rem;
    border: 1px solid rgba(0, 136, 73, 0.2);
    border-radius: 1.2rem;
    background: linear-gradient(180deg, #f3faf5 0%, #ffffff 100%);
    box-shadow: 0 18px 40px -34px rgba(23, 28, 32, 0.35);
}

.flexi-location-size-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.flexi-location-size-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #171c20;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.flexi-location-size-volume {
    color: #8d7164;
    font-size: 0.78rem;
    font-weight: 700;
}

.flexi-location-size-sample h4 {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: #171c20;
    letter-spacing: -0.03em;
}

.flexi-location-size-sample p {
    margin: 0 0 1.25rem;
    color: #5f5e5e;
    font-size: 0.92rem;
}

.flexi-location-size-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.flexi-location-size-price-row strong {
    color: #008849;
    font-size: 1rem;
    font-weight: 800;
}

.flexi-location-size-original-price {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: #9b9b9b;
    text-decoration: line-through;
    margin-bottom: 0.1rem;
}

.flexi-location-showcase-footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.flexi-location-showcase-note {
    margin: 0;
    color: #8d7164;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ==========================================================================
   Single-location catalog (if branch)
   ========================================================================== */

.flexi-single-location {
    margin-bottom: 0;
}

.flexi-single-location--catalog {
    margin-bottom: 2rem;
}

.flexi-single-location-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem 1.2rem;
    margin-bottom: 2.35rem;
}

.flexi-single-location-meta span {
    color: #7a848d;
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* Size cards */
.flexi-single-location--catalog .row > [class*="col"] {
    display: flex;
    flex-direction: column;
}

.flexi-single-size-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto 1fr auto auto;
    grid-template-areas:
        "area   badges"
        "desc   desc"
        "price  price"
        "cta    cta";
    height: 100%;
    min-height: 0;
    padding: 1.15rem 1.15rem 1.2rem;
    gap: 0.1rem 1rem;
    align-items: start;
    border: 1px solid #e6edf3;
    border-radius: 1.25rem;
    background: #ffffff;
    box-shadow: 0 18px 42px -34px rgba(23, 28, 32, 0.18);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.flexi-single-size-card:hover {
    transform: translateY(-2px);
    border-color: #d1dbe4;
    box-shadow: 0 22px 44px -34px rgba(23, 28, 32, 0.24);
}

.flexi-single-size-card-top {
    display: contents;
}

.flexi-single-size-icon {
    display: none;
}

.flexi-single-size-icon svg {
    width: 1.2rem;
    height: 1.2rem;
}

.flexi-single-size-badges {
    grid-area: badges;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.3rem;
    align-self: start;
}

.flexi-single-size-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.52rem;
    border-radius: 999px;
    background: #eef3f6;
    color: #4f5861;
    font-size: 0.56rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    white-space: nowrap;
}

.flexi-single-size-badge--highlight {
    background: #008849;
    color: #ffffff;
}

/* ==========================================================================
   Discount banner (single location)
   ========================================================================== */

.flexi-single-discount-banner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.35rem 1.75rem;
    border-radius: 1.25rem;
    background: linear-gradient(135deg, #008849 0%, #006f3b 100%);
    color: #ffffff;
    box-shadow: 0 18px 40px -20px rgba(0, 136, 73, 0.35);
    overflow: hidden;
}

.flexi-sdb-pct {
    flex-shrink: 0;
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 1;
    text-align: center;
    min-width: 4.5rem;
    padding-right: 1.5rem;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.flexi-sdb-copy {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    overflow: hidden;
}

.flexi-sdb-copy strong {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    overflow-wrap: break-word;
    word-break: break-word;
}

.flexi-sdb-copy span {
    font-size: 0.88rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Strikethrough original price on size cards */
.flexi-single-size-original-price {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: #9b9b9b;
    text-decoration: line-through;
    margin-bottom: 0.15rem;
    letter-spacing: 0;
}

.flexi-single-size-discount-label {
    display: inline-flex;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: #e6f3eb;
    color: #006f3b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.flexi-single-size-price--discounted .flexi-single-size-price span {
    margin-top: 0.15rem;
}

.flexi-single-size-badge--warning {
    background: #f7eadf;
    color: #b85d2c;
}

.flexi-single-size-card h3 {
    grid-area: area;
    margin: 0 0 0.2rem;
    color: #171c20;
    font-size: 2.0rem;
    font-weight: 800;
    letter-spacing: -0.06em;
    line-height: 1;
    white-space: nowrap;
    min-width: 0;
}

.flexi-single-size-volume {
    display: block;
    margin-top: 0.25rem;
    color: #66717b;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0;
}

.flexi-single-size-card p {
    grid-area: desc;
    margin: 0.5rem 0 0.85rem;
    color: #606a74;
    font-size: 0.84rem;
    line-height: 1.58;
    min-width: 0;
}

.flexi-single-size-price {
    grid-area: price;
    margin-top: 0.55rem;
    margin-bottom: 0.95rem;
    color: #171c20;
}

.flexi-single-size-price span {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.flexi-single-size-price strong {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.06em;
    line-height: 1;
}

.flexi-single-size-price small {
    margin-left: 0.18rem;
    color: #7e8790;
    font-size: 0.78rem;
    font-weight: 700;
}

.flexi-single-size-cta {
    grid-area: cta;
    width: 100%;
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.1rem;
    background: linear-gradient(135deg, #008849 0%, #006f3b 100%);
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.flexi-single-size-cta:hover {
    transform: translateY(-1px);
    background: #006f3b;
    box-shadow: 0 16px 24px -18px rgba(0, 136, 73, 0.55);
}

/* ==========================================================================
   Select button (shared)
   ========================================================================== */

.flexi-btn-select {
    background: #008849;
    color: white;
    border: none;
    padding: 0.8rem 1.1rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.1em;
    text-align: center;
    display: inline-block;
    line-height: 1;
    text-transform: uppercase;
}

.flexi-btn-select:hover {
    background: #008849;
}

.flexi-single-size-cta.is-loading,
.flexi-btn-select.is-loading {
    opacity: 0.8;
    cursor: wait;
}

/* ==========================================================================
   Prevent horizontal overflow (root cause of cut-off content on mobile)
   ========================================================================== */

.flexi-lagerbod-units-wrapper,
.flexi-location-showcase-wrapper {
    overflow-x: hidden;
}

.flexi-location-showcase-text,
.flexi-location-showcase-copy p,
.flexi-location-showcase-copy h3 {
    overflow-wrap: break-word;
    word-break: break-word;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .flexi-units-title {
        font-size: 2.2rem;
    }

    .flexi-units-subtitle {
        max-width: 100%;
    }

    .flexi-single-location-meta {
        margin-bottom: 1.6rem;
    }

    .flexi-location-showcase-heading {
        flex-direction: column;
    }

    .flexi-location-showcase-content {
        padding: 1.5rem;
        overflow: hidden;
    }

    /* CTA-knapp: tillat tekstbryting og full bredde på mobil */
    .flexi-location-showcase-heading .flexi-card-cta-btn,
    .flexi-location-showcase-footer .flexi-card-cta-btn {
        white-space: normal;
        word-break: break-word;
        text-align: center;
        width: 100%;
        flex-shrink: 1;
    }

    .flexi-location-showcase-media {
        min-height: 360px;
    }

    .flexi-location-size-price-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .flexi-location-size-price-row .flexi-btn-select {
        width: 100%;
        text-align: center;
        padding: 0.75rem 1rem;
    }

    /* Mobile: compact layout for size cards */
    .flexi-single-size-card {
        grid-template-areas:
            "area   badges"
            "desc   desc"
            "price  price"
            "cta    cta";
        height: auto;
        padding: 1.1rem 1.15rem 1.15rem;
        gap: 0.1rem 0.9rem;
    }

    .flexi-single-size-card h3 {
        font-size: 1.85rem;
        margin: 0;
    }

    .flexi-single-size-card p {
        margin: 0.2rem 0 0.3rem;
        font-size: 0.78rem;
    }

    .flexi-single-size-price {
        margin-top: 0.2rem;
        margin-bottom: 0;
    }

    .flexi-single-size-price strong {
        font-size: 1.8rem;
    }

    .flexi-single-size-cta {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.78rem;
    }
}

/* ==========================================================================
   Small phones (< 576px) – single-column, tighter spacing
   ========================================================================== */

@media (max-width: 575px) {
    /* Wrapper */
    .flexi-lagerbod-units-wrapper {
        padding: 44px 0 52px;
    }

    /* Headings */
    .flexi-units-title {
        font-size: 1.75rem;
    }

    /* Showcase card */
    .flexi-location-showcase {
        border-radius: 1.1rem;
    }

    .flexi-location-showcase-media {
        min-height: 260px;
    }

    .flexi-location-showcase-content {
        padding: 1rem;
        overflow: hidden;
    }

    /* Row gutter kompensasjon */
    .flexi-location-showcase-content .row {
        --bs-gutter-x: 0.75rem;
    }

    .flexi-location-showcase-title {
        font-size: 1.35rem;
        letter-spacing: -0.03em;
    }

    .flexi-location-showcase-text {
        font-size: 0.875rem;
        max-width: 100%;
    }

    /* Volume number – shrink so it fits */
    .flexi-location-size-volume {
        font-size: 0.68rem;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .flexi-location-size-topline {
        gap: 0.4rem;
        flex-wrap: nowrap;
    }

    .flexi-location-size-sample {
        padding: 1rem;
    }

    .flexi-location-size-sample h4 {
        font-size: 1.3rem;
    }

    .flexi-location-size-sample p {
        font-size: 0.84rem;
        margin-bottom: 0.85rem;
    }

    /* Footer CTA button – full width */
    .flexi-location-showcase-footer .flexi-card-cta-btn {
        width: 100%;
        text-align: center;
    }

    /* Discount banner – stack vertically */
    .flexi-single-discount-banner {
        flex-direction: column;
        gap: 0.6rem;
        text-align: center;
        padding: 1rem 1.1rem;
    }

    .flexi-sdb-pct {
        padding-right: 0;
        border-right: none;
        padding-bottom: 0.65rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.3);
        min-width: 0;
        font-size: 2rem;
    }

    /* Size cards – tighter on small phones */
    .flexi-single-size-card {
        padding: 0.9rem 1rem 1rem;
    }

    .flexi-single-size-card h3 {
        font-size: 1.5rem;
    }

    .flexi-single-size-price strong {
        font-size: 1.5rem;
    }

    .flexi-single-size-cta {
        font-size: 0.75rem;
        padding: 0.7rem 0.9rem;
    }

    /* Image copy */
    .flexi-location-showcase-copy h3 {
        font-size: 1.4rem;
    }

    .flexi-location-showcase-meta span {
        font-size: 0.7rem;
        padding: 0.35rem 0.65rem;
    }
}
