/* ===========================
   FreeFunGalaxy – Global Theme
   Palette driven by emerald leaf + gold + warm red + plum
   =========================== */

/* CSS Variables – keep exhaustive for future features */
:root {
    --ffg-primary-900: #0C2A22;
    --ffg-primary-800: #0F3A2E;
    --ffg-primary-700: #11553F;
    --ffg-primary-600: #0E8A59;
    --ffg-primary-500: #0FB06C; /* main emerald */
    --ffg-primary-300: #6BD69A;
    --ffg-gold-700: #D29A18;
    --ffg-gold-600: #E8B12F;
    --ffg-gold-500: #F5C242; /* CTA gradient base */
    --ffg-gold-300: #FFD878;
    --ffg-red-500: #D4473B; /* logo ring accent */
    --ffg-plum-600: #6F2DBD; /* mascot shell */
    --ffg-magenta-500: #B12F8B;
    --ffg-ink-900: #0C1116; /* app shell / modals backdrop */
    --ffg-ink-700: #1A2430;
    --ffg-ink-600: #223040;
    --ffg-ink-500: #2A3644;
    --ffg-cloud-000: #FFFFFF;
    --ffg-cloud-100: #F5F7F8;
    --ffg-cloud-200: #EEF2F5;
    --ffg-cloud-300: #E5EAEF;
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --shadow-soft: 0 6px 18px rgba(0,0,0,.08);
    --shadow-elev: 0 14px 40px rgba(0,0,0,.18);
}

/* Base */
* {
    box-sizing: border-box
}

html, body {
    height: 100%
}

body {
    margin: 0;
    font-family: system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
    background: var(--ffg-cloud-100);
    color: var(--ffg-ink-700);
    line-height: 1.55;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 20px
}

img {
    max-width: 100%;
    display: block
}

/* Links & Buttons */
a {
    color: var(--ffg-primary-600);
    text-decoration: none
}

    a:hover {
        color: var(--ffg-primary-500)
    }

.cta-button, .cta {
    display: inline-block;
    border: none;
    border-radius: 999px;
    padding: 14px 34px;
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: #111;
    background: linear-gradient(90deg,var(--ffg-gold-700),var(--ffg-gold-500));
    box-shadow: 0 6px 20px rgba(245,194,66,.35);
    transition: transform .15s ease, box-shadow .2s ease, filter .2s ease;
    cursor: pointer;
}

    .cta-button:hover, .cta:hover {
        transform: translateY(-2px);
        filter: saturate(1.08);
        box-shadow: 0 10px 28px rgba(245,194,66,.45)
    }

    .cta-button.secondary {
        color: var(--ffg-cloud-000);
        background: linear-gradient(90deg,var(--ffg-plum-600),var(--ffg-magenta-500));
        box-shadow: 0 10px 28px rgba(111,45,189,.35);
    }

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: saturate(140%) blur(8px);
    background: color-mix(in srgb, var(--ffg-cloud-000) 78%, transparent);
    border-bottom: 1px solid var(--ffg-cloud-300);
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px
}

    .brand img {
        height: 40px;
        width: auto
    }

    .brand .site-name {
        font-weight: 900;
        font-size: 1.25rem;
        color: var(--ffg-primary-700)
    }

.nav-links {
    display: flex;
    align-items: center;
    gap: 18px
}

    .nav-links a {
        font-weight: 700;
        color: var(--ffg-ink-700);
        padding: 8px 10px;
        border-radius: 10px
    }

        .nav-links a:hover {
            background: var(--ffg-cloud-200)
        }

.nav-cta {
    margin-left: 6px
}

/* Mobile menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--ffg-ink-700)
}

@media (max-width: 992px) {
    .nav-links {
        display: none
    }

    .menu-toggle {
        display: block
    }
}

.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: none;
    background: linear-gradient(180deg,var(--ffg-ink-900), var(--ffg-ink-700));
    color: #fff;
}

    .mobile-menu.open {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 24px;
        padding: 40px
    }

    .mobile-menu a {
        color: #fff;
        font-size: 1.5rem;
        font-weight: 800
    }

.mobile-close {
    position: absolute;
    top: 24px;
    right: 24px;
    font-size: 36px;
    color: #fff;
    text-decoration: none
}

/* Hero / Section helpers (reused by webparts) */
section {
    padding: 56px 0
}

.section-dark {
    background: var(--ffg-ink-900);
    color: #fff
}

.section-leaf {
    background: linear-gradient(180deg,var(--ffg-primary-900),var(--ffg-primary-700));
    color: #fff
}

.section-cloud {
    background: var(--ffg-cloud-000)
}

.section-title {
    font-weight: 900;
    font-size: 2.4rem;
    margin: 0 0 10px
}

.section-sub {
    opacity: .86;
    max-width: 740px;
    margin: 0 auto 28px
}

/* Card-ish surfaces */
.surface {
    background: #fff;
    border: 1px solid var(--ffg-cloud-300);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft)
}

    .surface.dark {
        background: var(--ffg-ink-700);
        border-color: #1f2a36;
        color: #fff
    }

/* Game cards (used by webparts) */
.game-card-image, .game-card-video {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: var(--radius-sm);
    transition: transform .2s ease
}

    .game-card-image:hover, .game-card-video:hover {
        transform: scale(1.04)
    }

.game-card-rating {
    color: var(--ffg-gold-500)
}

/* Reviews / badges */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--ffg-cloud-300);
    background: var(--ffg-cloud-000)
}

    .badge-pill i {
        color: var(--ffg-gold-600)
    }

/* Footer (footer.php uses these) */
.site-footer {
    background: var(--ffg-ink-900);
    color: #b7c2cf;
    padding: 44px 20px;
    margin-top: 40px;
    text-align: center
}

    .site-footer .footer-logo {
        max-height: 50px;
        display:block;
        margin: 0 auto 12px; /* center + small spacing */
    }

    /* If the logo is wrapped in a link or brand container */
    .site-footer .footer-brand,
    .site-footer a.footer-logo {
        display: flex;
        max-height: 50px;
        justify-content: center;
        align-items: center;
        width: 100%;
        margin: 0 auto 12px;
    }

/* Defensive: if a row puts items left/right, stack and center on small screens */
@media (max-width: 991.98px) {
    .site-footer .footer-row,
    .site-footer .footer-top {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px 24px;
    justify-content: center;
    margin: 12px 0
}

    .footer-links a {
        color: #fff;
        font-weight: 700
    }

        .footer-links a:hover {
            color: var(--ffg-gold-500)
        }

.responsible-gaming-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
    margin: 8px 0
}

    .responsible-gaming-logos img {
        max-height: 36px;
        filter: grayscale(100%);
        opacity: .8;
        transition: all .2s
    }

        .responsible-gaming-logos img:hover {
            filter: none;
            opacity: 1
        }

.footer-disclaimer-full {
    max-width: 980px;
    margin: 14px auto 0
}

    .footer-disclaimer-full p {
        font-size: .85rem;
        line-height: 1.5;
        color: #9fb1c3
    }

/* Cookie banner */
#cookie-popup {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(12,17,22,.98);
    color: #fff;
    padding: 18px;
    z-index: 1200;
    display: none;
    text-align: center
}

    #cookie-popup a {
        color: #fff;
        text-decoration: underline
    }

#cookie-accept-btn {
    margin-left: 10px
}

/* Age gate modal (footer.php renders) */
.age-modal-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.86);
    backdrop-filter: blur(6px);
    z-index: 1400
}

.age-modal-content {
    width: min(520px,92%);
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow-elev);
    display: flex; /* NEW */
    flex-direction: column; /* NEW */
    align-items: center; /* NEW */
}

.age-modal-logo {
    display: block; /* ensure it's a block we can auto-margin */
    margin: 0 auto 12px; /* NEW: centers the img */
    height: 54px;
    margin-bottom: 10px;
    text-align: center;
}

.age-modal-title {
    font-size: 1.85rem;
    font-weight: 900;
    margin: 6px 0 4px
}

.age-modal-subtitle {
    opacity: .8;
    margin-bottom: 14px
}

.age-modal-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 18px;
    text-align: left
}

    .age-modal-list li {
        display: flex;
        gap: 8px;
        align-items: center;
        margin: 8px 0
    }

    .age-modal-list i {
        color: var(--ffg-primary-500)
    }

.age-modal-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center
}

.age-modal-exit {
    background: #e9eef2;
    color: #334555
}

/* Game modal (footer.php renders) */
.game-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1500
}

.game-modal-content {
    width: 90%;
    max-width: 1200px;
    height: 90%;
    display: flex;
    flex-direction: column;
    background: #000;
    border: 1px solid #2b2b2b;
    border-radius: 12px;
    overflow: hidden
}

.game-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #10161c;
    padding: 10px 14px
}

.game-modal-title {
    color: #fff;
    font-weight: 800
}

.game-modal-close {
    font-size: 28px;
    color: #cdd6df;
    text-decoration: none
}

.game-modal-body {
    flex: 1;
    background: #0b0f14
}

    .game-modal-body iframe {
        width: 100%;
        height: 100%;
        border: 0
    }

/* Utility */
.text-center {
    text-align: center
}

.mt-0 {
    margin-top: 0
}

.mb-0 {
    margin-bottom: 0
}

.mt-24 {
    margin-top: 24px
}

.mb-24 {
    margin-bottom: 24px
}

.rounded-lg {
    border-radius: var(--radius-lg)
}


/* === Games Collection: simple_row_scroll (corrected selectors) === */
.games-collection-wrapper.layout-simple_row_scroll .game-row-simple {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(180px, 1fr);
    gap: 16px;
    overflow-x: auto;
    padding: 8px 2px 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.games-collection-wrapper.layout-simple_row_scroll .game-row-item {
    scroll-snap-align: start;
}

.games-collection-wrapper.layout-simple_row_scroll .game-card-simple {
    display: block;
    background: #fff;
    border: 1px solid var(--ffg-cloud-300);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-soft);
    transition: transform .15s ease;
}

    .games-collection-wrapper.layout-simple_row_scroll .game-card-simple:hover {
        transform: translateY(-2px);
    }

.games-collection-wrapper.layout-simple_row_scroll .game-card-image {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

@media (min-width: 768px) {
    .games-collection-wrapper.layout-simple_row_scroll .game-row-simple {
        grid-auto-columns: 220px;
        gap: 18px;
    }
}



/* Icon Features – make titles & supporting text visible and balanced */
.webpart-icon_features,
.webpart-icon-features { /* handle both kebab & underscore naming */
    --feature-gap: 18px;
}

    .webpart-icon_features .feature-item,
    .webpart-icon-features .feature-item {
        text-align: center;
        padding: 18px;
        background: #fff;
        border: 1px solid var(--ffg-cloud-300);
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-soft);
        height: 100%;
    }

        .webpart-icon_features .feature-item .feature-icon,
        .webpart-icon-features .feature-item .feature-icon {
            font-size: 32px;
            margin-bottom: 10px;
            color: var(--ffg-ink-700);
        }

        .webpart-icon_features .feature-item h4,
        .webpart-icon-features .feature-item h4 {
            margin: 8px 0 6px;
            font-weight: 800;
            color: var(--ffg-ink-700);
        }

        .webpart-icon_features .feature-item p,
        .webpart-icon-features .feature-item p {
            margin: 0;
            font-size: 0.98rem;
            line-height: 1.45;
            color: var(--ffg-ink-600);
            opacity: 0.95;
        }

/* =========================
   FIX: Reviews avatar targeting
   ========================= */

/* 0) Ensure the overall row is a simple media layout */
.webpart-reviews_collection .review-card-initials,
.webpart-reviews-collection .review-card-initials,
.webpart-reviews_collection .review-item,
.webpart-reviews-collection .review-item,
.webpart-reviews_collection .review,
.webpart-reviews-collection .review {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

    /* 1) Reset ANY children under the container (undo the green ovals) */
    .webpart-reviews_collection .review-card-initials > *,
    .webpart-reviews-collection .review-card-initials > * {
        background: none !important;
        border: 0 !important;
        width: auto !important;
        height: auto !important;
        flex: initial !important;
        border-radius: 0 !important;
        display: block !important;
        color: inherit !important;
        margin: 0 !important;
        line-height: inherit !important;
    }

    /* 2) Apply the avatar style ONLY to the FIRST child (the initial letter) */
    .webpart-reviews_collection .review-card-initials > :first-child,
    .webpart-reviews-collection .review-card-initials > :first-child {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 40px !important;
        height: 40px !important;
        flex: 0 0 40px !important;
        border-radius: 50% !important;
        background: var(--ffg-primary-500) !important;
        color: #fff !important;
        font-weight: 800 !important;
        letter-spacing: .4px !important;
        border: 2px solid #fff !important;
        text-transform: uppercase !important;
        line-height: 1 !important;
        margin-right: 10px !important;
    }

/* 3) The text/content column sits to the right and flows normally */
.webpart-reviews_collection .review-content,
.webpart-reviews-collection .review-content,
.webpart-reviews_collection .review-body,
.webpart-reviews-collection .review-body {
    flex: 1 1 auto;
    min-width: 0;
}

/* 4) Tidy typography + stars */
.webpart-reviews_collection h4,
.webpart-reviews-collection h4 {
    margin: 0 0 4px;
    font-weight: 800;
}

.webpart-reviews_collection p,
.webpart-reviews-collection p {
    margin: 0 0 8px;
}

.webpart-reviews_collection .stars,
.webpart-reviews-collection .stars {
    display: inline-block;
    margin-top: 6px;
}

.webpart-reviews_collection .fa-star,
.webpart-reviews-collection .fa-star {
    color: var(--ffg-gold-500);
    line-height: 1;
}

    .webpart-reviews_collection .fa-star + .fa-star,
    .webpart-reviews-collection .fa-star + .fa-star {
        margin-left: 2px;
    }

/* 5) Small screens */
@media (max-width:575.98px) {
    .webpart-reviews_collection .review-card-initials > :first-child,
    .webpart-reviews-collection .review-card-initials > :first-child {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
}

/* ===== LOBBY PAGE ===== */
.webpart-lobby {
    padding: 56px 0;
}

    .webpart-lobby .lobby-header {
        text-align: center;
        margin-bottom: 24px;
    }

    .webpart-lobby .lobby-title {
        font-weight: 900;
        margin: 0 0 6px;
    }

    .webpart-lobby .lobby-sub {
        opacity: .9;
        margin: 0 auto 18px;
        max-width: 760px
    }

    /* Search */
    .webpart-lobby .lobby-search {
        display: flex;
        align-items: center;
        gap: 10px;
        max-width: 340px;
        background: #fff;
        border: 1px solid var(--ffg-cloud-300);
        border-radius: 12px;
        padding: 8px 10px;
        margin: 0 auto 24px;
    }

        .webpart-lobby .lobby-search i {
            font-size: 18px;
            color: #222
        }

        .webpart-lobby .lobby-search input {
            border: 0;
            outline: 0;
            background: transparent;
            flex: 1 1 auto;
            font-size: 16px;
            color: #111;
        }

    /* Grid */
    .webpart-lobby .game-grid {
        display: grid;
        gap: 22px;
    }

@media (min-width: 576px) {
    .webpart-lobby .game-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .webpart-lobby .game-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .webpart-lobby .game-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Card */
.webpart-lobby .game-card {
    background: #0A1C17;
    border: 1px solid rgba(255,255,255,.06);
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .2s ease;
}

    .webpart-lobby .game-card:hover {
        transform: translateY(-3px);
        box-shadow: var(--shadow-elev)
    }

.webpart-lobby .game-thumb {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    display: block;
}

.webpart-lobby .game-info {
    padding: 12px 12px 14px;
    color: #fff;
}

.webpart-lobby .game-title {
    font-weight: 900;
    font-size: 1.05rem;
    margin: 0 0 6px;
    line-height: 1.25;
}

.webpart-lobby .game-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .92rem;
    opacity: .9;
}

    .webpart-lobby .game-meta span {
        display: inline-flex;
        align-items: center;
        gap: 6px
    }

.webpart-lobby .game-rating i {
    color: var(--ffg-gold-500)
}

/* Ensure videos never appear in the lobby even if present */
.webpart-lobby video {
    display: none !important;
}


/* === Center the 'simple_row_scroll' strip when it doesn't overflow === */
.games-collection-wrapper.layout-simple_row_scroll .game-row-simple {
    display: flex; /* was grid */
    align-items: stretch;
    justify-content: center; /* <— centers when items fit */
    gap: 16px;
    overflow-x: auto; /* still scrolls if it needs to */
    padding: 8px 2px 10px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

/* Each card keeps a reasonable minimum width */
.games-collection-wrapper.layout-simple_row_scroll .game-row-item {
    flex: 0 0 180px; /* min card width */
    scroll-snap-align: start;
}

@media (min-width:768px) {
    .games-collection-wrapper.layout-simple_row_scroll .game-row-item {
        flex-basis: 220px;
    }

    .games-collection-wrapper.layout-simple_row_scroll .game-row-simple {
        gap: 18px;
    }
}

/* Optional: hide visible horizontal scrollbar while preserving scroll */
.games-collection-wrapper.layout-simple_row_scroll .game-row-simple {
    scrollbar-width: none;
}

    .games-collection-wrapper.layout-simple_row_scroll .game-row-simple::-webkit-scrollbar {
        display: none;
    }

/* ==== Remove white gap above footer ==== */

/* 1) Footer shouldn’t push itself down */
.site-footer {
    margin-top: 0 !important;
    border-top: 0 !important; /* kill any accidental top border */
}

/* 2) The last section on the page shouldn’t add extra space */
main > section:last-of-type,
.page-content > section:last-of-type,
body > section:last-of-type {
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* 3) If a spacer/hr exists above footer, hide it defensively */
.footer-spacer,
.footer-separator,
.footer-divider,
.site-footer::before {
    display: none !important;
    height: 0 !important;
    border: 0 !important;
    content: none !important; /* handles pseudo-element case */
}

/* 4) Ensure containers don’t add bottom margin that shows as white */
.container:last-child {
    margin-bottom: 0 !important;
}


/* === Comfortable spacing before footer (non-legal pages) === */
main > section:last-of-type,
.page-content > section:last-of-type,
body > section:last-of-type {
    /* gentle buffer so buttons/CTA shadows don't crash into the footer */
    padding-bottom: clamp(28px, 5vw, 72px) !important;
    margin-bottom: 0 !important;
}

/* Keep legal pages tight (they looked correct already) */
body.page-privacy main > section:last-of-type,
body.page-terms main > section:last-of-type,
body.page-responsible-gaming main > section:last-of-type {
    padding-bottom: 0 !important;
}

/* Defensive: if contact form is last, give it extra space for button shadows */
.webpart-contact_form:last-of-type {
    padding-bottom: clamp(36px, 6vw, 84px) !important;
}

/* Footer still shouldn’t add its own gap */
.site-footer {
    margin-top: 0 !important;
    border-top: 0 !important;
}
