/* ============================================
   COMPETITION BOX STYLING - COMPLETELY FRESH CLASS NAMES
   No conflicts with styles-new.css - uses unique class names
   ============================================ */

/* ============================================
   GRID CONTAINER
   ============================================ */
.comp-box-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 per row on mobile */
    gap: 0.75rem;
    max-width: 1400px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* ============================================
   COMPETITION BOX
   ============================================ */
.comp-box {
    background: #ffffff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    min-height: 320px;
    box-sizing: border-box;
}

/* Skeleton: same dimensions as loaded .comp-box – no overrides, inherits .comp-box min-height at all breakpoints so height and position match */
.comp-box.skeleton-shimmer {
    height: auto !important;
    /* min-height: inherit from .comp-box (320px base, 340px/380px at breakpoints in this file and styles-new) */
}
.comp-box.skeleton-shimmer .comp-box-image {
    flex-shrink: 0 !important;
    aspect-ratio: 5 / 3;
    /* height/min-height: same as .comp-box-image (aspect-ratio drives height) */
}
.comp-box.skeleton-shimmer .comp-box-top {
    flex-shrink: 0 !important;
}
.comp-box.skeleton-shimmer .comp-box-bottom {
    flex-grow: 1 !important;
    flex-shrink: 0 !important;
    /* min-height: same as .comp-box-bottom (100px from base) */
}

/* Jackpot: card is wrapped in an anchor; anchor must fill .comp-box and be a flex container
   so .comp-box-bottom gets flex-grow and spacing matches daily free games exactly */
.comp-box-card-link {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    text-decoration: none;
    color: inherit;
}

/* ============================================
   COMPETITION IMAGE
   MUST FILL COMPLETELY - NO GAPS
   ============================================ */
.comp-box-image {
    width: 100%;
    /* Maintain 5:3 aspect ratio (matches image dimensions 300×180px) */
    aspect-ratio: 5 / 3;
    position: relative;
    overflow: hidden;
    padding: 0;
    margin: 0;
    line-height: 0;
    font-size: 0;
    flex-shrink: 0;
    display: block;
    border-bottom: none; /* Ensure no border - seamless connection with top border below */
    border-top: none;
}

.comp-box-image img {
    /* Fill container completely - container now matches image aspect ratio */
    width: 100%;
    height: 100%;
    object-fit: cover; /* Fill container, no cropping since aspect ratios match */
    object-position: center center;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* ============================================
   TOP BORDER
   Logo left, Timer right
   ============================================ */
.comp-box-top {
    background: #ffffff;
    border-bottom: 1px solid #f0f0f0;
    border-top: none; /* Ensure no border-top - seamless connection with image above */
    padding: 0.5rem 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 40px;
    flex-shrink: 0;
}

.comp-box-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.comp-box-logo img {
    max-width: 60px;
    max-height: 32px;
    min-width: 44px;
    min-height: 28px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 4px; /* Light rounded corners like live version */
}

.comp-box-logo .logo-wrapper {
    display: contents;
}

.comp-box-timer {
    color: #00cc5a;
    font-size: 0.75rem;
    font-weight: 700; /* Bold */
    white-space: nowrap;
}

/* Expired competitions - timer red (JS sets "Expired" vs "Round Expired" below 400px) */
.expired-competition .comp-box-timer {
    color: rgb(204, 8, 0) !important;
}

/* ============================================
   BOTTOM BORDER
   Blurb centered (halfway up section), gap, then button at bottom.
   Same logic for jackpot-competitions and daily-free-games – do not override per-page.
   ============================================ */
.comp-box-bottom {
    background: #ffffff;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
    min-height: 100px;
}

/* Blurb sits in middle of bottom section; gap below so button stays at bottom. Width constraints match template.php (narrower, not full width). */
.comp-box-blurb {
    text-align: center;
    font-size: 0.75rem;
    line-height: 1.4;
    color: #20242e;
    margin-bottom: 0.75rem; /* Gap between blurb and See Game Page button – same as daily */
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700; /* Bold */
    max-width: 100%;
    padding-left: 0.9375rem;
    padding-right: 0.9375rem;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.comp-box-button {
    background: #00cc5a;
    color: #000;
    text-decoration: none;
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700; /* Bold */
    display: block;
    transition: background 0.2s;
    flex-shrink: 0;
    margin-top: auto; /* Keep button at bottom of box (same as daily free games) */
}

.comp-box-button:hover {
    background: #00b850;
}

/* ============================================
   MOBILE: Maintain 5:3 aspect ratio - no cropping
   ============================================ */
@media (max-width: 499px) {
    .comp-box-image {
        aspect-ratio: 5 / 3; /* Maintain image aspect ratio */
    }
    
    .comp-box-image img {
        object-fit: cover; /* Fill container - no cropping since ratios match */
        object-position: center center;
    }
}

/* ============================================
   TABLET: 450px - 599px
   Still 2 per row, scale up elements PROPORTIONALLY
   ============================================ */
@media (min-width: 450px) and (max-width: 599px) {
    .comp-box-grid {
        gap: 0.75rem;
    }
    
    .comp-box {
        min-height: 340px;
    }
    
    .comp-box-image {
        aspect-ratio: 5 / 3; /* Maintain 5:3 ratio - no cropping */
    }
    
    .comp-box-image img {
        object-fit: cover; /* Fill container - ratios match so no crop */
        object-position: center center;
    }
    
    .comp-box-top {
        min-height: 44px;
    }
    
    .comp-box-logo img {
        max-width: 68px;
        max-height: 36px;
        border-radius: 4px; /* Light rounded corners */
    }
    
    .comp-box-timer {
        font-size: 0.85rem; /* Scaled up more */
        font-weight: 700; /* Bold */
    }
    
    .comp-box-bottom {
        padding: 0.9rem;
        min-height: 115px;
    }
    
    .comp-box-blurb {
        font-size: 0.85rem; /* Scaled up more */
        line-height: 1.5;
        font-weight: 700; /* Bold */
    }
    
    .comp-box-button {
        font-size: 0.85rem; /* Scaled up more */
        padding: 0.6rem 1.15rem;
        font-weight: 700; /* Bold */
    }
}

/* ============================================
   LARGE TABLET: 600px - 767px
   Boxes expand, elements MUST scale proportionally - AGGRESSIVE SCALING
   ============================================ */
@media (min-width: 600px) and (max-width: 767px) {
    .comp-box-grid {
        gap: 1rem;
    }
    
    .comp-box {
        min-height: 380px;
    }
    
    .comp-box-image {
        aspect-ratio: 5 / 3; /* Maintain 5:3 ratio - no cropping */
    }
    
    .comp-box-image img {
        object-fit: cover; /* Fill container - ratios match so no crop */
        object-position: center center;
    }
    
    .comp-box-top {
        padding: 0.5rem 1rem; /* Scaled up more */
        min-height: 48px; /* Scaled up more */
    }
    
    .comp-box-logo img {
        max-width: 75px; /* Scaled up more */
        max-height: 40px; /* Scaled up more */
        border-radius: 4px; /* Light rounded corners */
    }
    
    .comp-box-timer {
        font-size: 1rem; /* Scaled up significantly */
        font-weight: 700; /* Bold */
    }
    
    .comp-box-bottom {
        padding: 1.1rem; /* Scaled up more */
        min-height: 130px; /* Scaled up more */
    }
    
    .comp-box-blurb {
        font-size: 1rem; /* Scaled up significantly - was too small */
        line-height: 1.5;
        font-weight: 700; /* Bold */
    }
    
    .comp-box-button {
        font-size: 1rem; /* Scaled up significantly - was too small */
        padding: 0.7rem 1.4rem; /* Scaled up more */
        font-weight: 700; /* Bold */
    }
}

/* ============================================
   DESKTOP: 768px+
   3 per row, scale to full size
   ============================================ */
@media (min-width: 768px) {
    .comp-box-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 per row */
        gap: 1rem;
        padding: 0rem 1.5rem;
    }
    
    .comp-box {
        min-height: 360px;
        border-radius: 12px; /* Increased corner rounding on desktop */
    }
    
    .comp-box-image {
        aspect-ratio: 5 / 3; /* Maintain 5:3 ratio - no cropping */
    }
    
    .comp-box-image img {
        object-fit: cover; /* Fill container - ratios match so no crop */
        object-position: center center;
    }
    
    .comp-box-top {
        min-height: 50px;
    }
    
    .comp-box-logo img {
        max-width: 70px;
        max-height: 38px;
        border-radius: 4px; /* Light rounded corners */
    }
    
    .comp-box-timer {
        font-size: 1rem; /* Bigger - fully scaled */
        font-weight: 700; /* Bold */
    }
    
    .comp-box-bottom {
        padding: 1.25rem; /* Increased padding */
        min-height: 150px; /* Increased length */
    }
    
    .comp-box-blurb {
        font-size: 1rem; /* Bigger - fully scaled */
        line-height: 1.5;
        font-weight: 700; /* Bold */
    }
    
    .comp-box-button {
        font-size: 1rem; /* Bigger - fully scaled */
        font-weight: 700; /* Bold */
    }
}

/* ============================================
   TABLET: 768px - 1023px
   Match grid-row-wrapper scaling - 3 per row with fixed width calculation
   Narrower boxes that scale naturally (like test-competitions)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    .comp-box-grid {
        grid-template-columns: repeat(3, 1fr); /* Use 1fr for natural scaling */
        justify-content: center;
        gap: 1rem; /* Natural gap */
    }
    
    .comp-box {
        max-width: 300px; /* Constrain width so boxes don't expand full width */
        margin: 0 auto; /* Center boxes */
    }
    /* Match 1024+ bottom + button so 768–1023 doesn’t look like a one-off “tall” CTA */
    .comp-box-bottom {
        padding: 1.25rem !important;
        min-height: 160px !important;
    }
    .comp-box-button {
        font-size: 1rem !important;
        /* Lock to base .comp-box-button padding — not 0.65rem 1.35rem desktop CTA */
        padding: 0.5rem 1rem !important;
        white-space: nowrap !important;
    }
}

/* ============================================
   LARGE DESKTOP: 1024px+
   Full sized, 3 per row
   ============================================ */
@media (min-width: 1024px) {
    .comp-box-grid {
        grid-template-columns: repeat(3, 300px); /* Fixed width at desktop */
        justify-content: center;
        gap: 1rem;
        padding: 0rem 4rem;
    }
    
    .comp-box {
        min-height: 380px;
        max-width: 300px;
        border-radius: 12px; /* Increased corner rounding on desktop */
    }
    
    .comp-box-image {
        aspect-ratio: 5 / 3; /* Maintain 5:3 ratio - no cropping */
    }
    
    .comp-box-top {
        min-height: 50px;
        padding: 0.5rem 1rem;
    }
    
    .comp-box-logo img {
        max-width: 70px;
        max-height: 38px;
        border-radius: 4px; /* Light rounded corners */
    }
    
    .comp-box-timer {
        font-size: 1rem; /* Bigger - fully scaled */
        font-weight: 700; /* Bold */
    }
    
    .comp-box-bottom {
        padding: 1.25rem; /* Increased padding */
        min-height: 160px; /* Increased length */
    }
    
    .comp-box-blurb {
        font-size: 1rem; /* Bigger - fully scaled */
        font-weight: 700; /* Bold */
    }
    
    .comp-box-button {
        font-size: 1rem; /* Bigger - fully scaled */
        padding: 0.65rem 1.5rem;
        font-weight: 700; /* Bold */
    }
}
