/**
 * Betformatics Promotion Button Styles
 * Kampagne CTA card with promotional image
 *
 * Dependencies: betformatics-variables (loaded via PHP)
 *
 * @package Betformatics
 */

/* =============================================================================
   RESET - Prevent WP/Elementor style inheritance
   ============================================================================= */
.betformatics-promotion-button-wrapper,
.betformatics-promotion-button-wrapper * {
    box-sizing: border-box !important;
}

.betformatics-promotion-button-wrapper a {
    text-decoration: none !important;
}

/* =============================================================================
   WRAPPER - Card container
   Desktop: Vertical layout with large image on top
   ============================================================================= */
.betformatics-promotion-button-wrapper {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    margin: 20px 0 !important;
    background: var(--bf-white, #ffffff) !important;
    border: 1px solid var(--bf-border, #e5e7eb) !important;
    border-radius: var(--bf-radius-lg, 12px) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    box-sizing: border-box !important;
}

/* =============================================================================
   FEATURED IMAGE - Top section, prominent display for promotional images
   ============================================================================= */
.betformatics-promotion-image {
    position: relative;
    flex-shrink: 0;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Aspect ratio for promotional images (10% shorter than 1200x630 standard) */
    aspect-ratio: 1200 / 567;
    background: #f8f8f8;
}

.betformatics-promotion-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

/* =============================================================================
   FALLBACK - Compact logo display with brandcolor background
   The PHP generates: .betformatics-promotion-image > .betformatics-promotion-img-fallback > img
   ============================================================================= */

/* Parent container when fallback is used - remove aspect-ratio */
.betformatics-promotion-image:has(.betformatics-promotion-img-fallback) {
    aspect-ratio: unset !important;
    height: auto !important;
    min-height: unset !important;
    background: transparent !important;
}

/* Inner fallback div with brandcolor background - FIXED HEIGHT */
.betformatics-promotion-img-fallback {
    width: 100% !important;
    height: 120px !important;
    min-height: 120px !important;
    max-height: 120px !important;
    padding: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--bf-radius-lg) var(--bf-radius-lg) 0 0 !important;
    box-sizing: border-box !important;
}

/* When countdown overlay is present, add extra bottom padding for overlay */
.betformatics-promotion-image:has(.betformatics-promotion-countdown-overlay) .betformatics-promotion-img-fallback {
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
    padding-top: 20px !important;
    padding-bottom: 60px !important;
    align-items: flex-start !important;
}

/* Logo inside fallback - constrained size */
.betformatics-promotion-img-fallback .betformatics-promotion-img {
    width: auto !important;
    height: auto !important;
    max-width: 160px !important;
    max-height: 60px !important;
    object-fit: contain !important;
}

/* =============================================================================
   COUNTDOWN OVERLAY - Positioned at bottom of image (all screen sizes)
   ============================================================================= */
.betformatics-promotion-countdown-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.betformatics-promotion-countdown-overlay .betformatics-promotion-countdown {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.betformatics-promotion-countdown-overlay .betformatics-countdown-label {
    font-size: 11px;
    color: var(--bf-gray-700);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.betformatics-promotion-countdown-overlay .betformatics-countdown-unit {
    min-width: 40px;
    padding: 6px 8px;
    background: var(--bf-white);
    border: 1px solid var(--bf-border);
}

.betformatics-promotion-countdown-overlay .betformatics-countdown-value {
    font-size: 18px;
}

/* Mobile countdown (hidden - countdown stays in overlay on all sizes) */
.betformatics-promotion-countdown-mobile {
    display: none;
}

/* =============================================================================
   CONTENT SECTION - Below image, centered
   ============================================================================= */
.betformatics-promotion-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 20px;
    gap: 8px;
}

/* Title */
.betformatics-promotion-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--bf-text-primary);
    line-height: 1.3;
    margin: 0;
}

/* Subtitle */
.betformatics-promotion-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--bf-text-muted);
    line-height: 1.4;
    margin: 0;
}

/* Action row - Button centered */
.betformatics-promotion-action-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 4px;
}

/* Button - with !important to override WP/Elementor */
.betformatics-promotion-button-wrapper a.betformatics-promotion-button,
a.betformatics-promotion-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px 32px !important;
    background-color: var(--bf-primary) !important;
    color: var(--bf-white) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    text-align: center !important;
    border-radius: var(--bf-radius-base) !important;
    transition: background-color var(--bf-transition-base), transform var(--bf-transition-base), box-shadow var(--bf-transition-base) !important;
    cursor: pointer !important;
    box-shadow: 0 2px 4px var(--bf-primary-shadow) !important;
    white-space: nowrap !important;
    border: none !important;
}

.betformatics-promotion-button-wrapper a.betformatics-promotion-button:hover,
a.betformatics-promotion-button:hover {
    background-color: var(--bf-primary-hover) !important;
    color: var(--bf-white) !important;
    text-decoration: none !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px var(--bf-primary-shadow-hover) !important;
}

.betformatics-promotion-button-wrapper a.betformatics-promotion-button:active,
a.betformatics-promotion-button:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px var(--bf-primary-shadow) !important;
}

.betformatics-promotion-button-wrapper a.betformatics-promotion-button:visited,
a.betformatics-promotion-button:visited {
    color: var(--bf-white) !important;
}

.betformatics-promotion-button-wrapper a.betformatics-promotion-button:focus,
a.betformatics-promotion-button:focus {
    color: var(--bf-white) !important;
    outline: 2px solid var(--bf-primary) !important;
    outline-offset: 2px !important;
}

/* Countdown Timer */
.betformatics-promotion-countdown {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.betformatics-countdown-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--bf-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.betformatics-countdown-timer {
    display: flex;
    align-items: center;
    gap: 3px;
}

.betformatics-countdown-unit {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 36px;
    padding: 4px 6px;
    background: var(--bf-slate-100);
    border-radius: var(--bf-radius-sm);
}

.betformatics-countdown-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--bf-text-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.betformatics-countdown-text {
    font-size: 8px;
    font-weight: 500;
    color: var(--bf-text-muted);
    text-transform: uppercase;
    margin-top: 2px;
}

.betformatics-countdown-separator {
    font-size: 14px;
    font-weight: 700;
    color: var(--bf-gray-300);
    padding: 0 1px;
}

/* Countdown expired state */
.betformatics-countdown-expired .betformatics-countdown-label {
    color: var(--bf-error-dark);
}

/* =============================================================================
   TERMS AND CONDITIONS - Collapsible
   ============================================================================= */
.betformatics-promotion-terms {
    font-size: 11px;
    line-height: 1.5;
    color: var(--bf-text-muted);
    margin: 0;
    padding-top: 10px;
    border-top: 1px solid var(--bf-gray-100);
}

.betformatics-promotion-terms p {
    margin: 0 0 4px 0;
}

.betformatics-promotion-terms p:last-child {
    margin-bottom: 0;
}

.betformatics-promotion-terms a {
    color: var(--bf-primary);
    text-decoration: underline;
}

.betformatics-promotion-terms a:hover {
    color: var(--bf-primary-hover);
}

/* Collapsible terms styling */
.betformatics-promotion-terms.betformatics-terms-collapsible {
    position: relative !important;
    padding-right: 28px !important;
}

.betformatics-promotion-terms .betformatics-terms-preview {
    display: block;
}

.betformatics-promotion-terms .betformatics-terms-short {
    display: block;
    color: #888;
    font-size: 10px;
    line-height: 1.4;
    font-style: italic;
}

.betformatics-promotion-terms .betformatics-terms-short a {
    color: var(--bf-primary);
    text-decoration: underline;
}

.betformatics-promotion-terms .betformatics-terms-full {
    display: none;
}

.betformatics-promotion-terms.betformatics-terms-collapsible.is-expanded .betformatics-terms-short {
    display: none;
}

.betformatics-promotion-terms.betformatics-terms-collapsible.is-expanded .betformatics-terms-full {
    display: block;
    color: #888;
    font-size: 10px;
    line-height: 1.5;
    font-style: italic;
}

.betformatics-promotion-terms.betformatics-terms-collapsible.is-expanded .betformatics-terms-full p {
    margin: 0;
}

/* Toggle button */
.betformatics-promotion-terms .betformatics-terms-toggle {
    position: absolute !important;
    top: 10px !important;
    right: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 20px !important;
    height: 20px !important;
    padding: 2px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    color: #999 !important;
}

.betformatics-promotion-terms .betformatics-terms-toggle:hover,
.betformatics-promotion-terms .betformatics-terms-toggle:focus,
.betformatics-promotion-terms .betformatics-terms-toggle:active {
    color: #666;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}

.betformatics-promotion-terms .betformatics-terms-toggle .betformatics-terms-arrow-up {
    display: none;
}

.betformatics-promotion-terms .betformatics-terms-toggle .betformatics-terms-arrow-down {
    display: block;
}

.betformatics-promotion-terms.is-expanded .betformatics-terms-toggle .betformatics-terms-arrow-up {
    display: block;
}

.betformatics-promotion-terms.is-expanded .betformatics-terms-toggle .betformatics-terms-arrow-down {
    display: none;
}

/* =============================================================================
   RESPONSIVE - Tablet
   ============================================================================= */
@media (max-width: 768px) {
    .betformatics-promotion-content {
        padding: 14px 16px;
    }

    .betformatics-promotion-title {
        font-size: 16px;
    }

    .betformatics-promotion-button-wrapper a.betformatics-promotion-button,
    a.betformatics-promotion-button {
        padding: 10px 24px !important;
        font-size: 14px !important;
    }

    .betformatics-promotion-terms {
        font-size: 10px;
    }
}

/* =============================================================================
   RESPONSIVE - Mobile
   ============================================================================= */
@media (max-width: 540px) {
    .betformatics-promotion-button-wrapper {
        margin: 16px 0;
        border-radius: 10px;
    }

    /* Countdown overlay stays visible - adjust sizing for mobile */
    .betformatics-promotion-countdown-overlay {
        padding: 8px 12px;
    }

    .betformatics-promotion-countdown-overlay .betformatics-countdown-label {
        font-size: 10px;
    }

    .betformatics-promotion-countdown-overlay .betformatics-countdown-unit {
        min-width: 34px;
        padding: 4px 6px;
    }

    .betformatics-promotion-countdown-overlay .betformatics-countdown-value {
        font-size: 15px;
    }

    .betformatics-promotion-content {
        padding: 14px;
    }

    .betformatics-promotion-title {
        font-size: 15px;
    }

    .betformatics-promotion-subtitle {
        font-size: 13px;
    }

    .betformatics-promotion-action-row {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        width: 100%;
    }

    .betformatics-promotion-button-wrapper a.betformatics-promotion-button,
    a.betformatics-promotion-button {
        width: 100% !important;
        padding: 12px 24px !important;
    }

    .betformatics-promotion-terms {
        font-size: 9px;
    }

    /* Increase touch target for terms toggle on mobile (minimum 44x44px) */
    .betformatics-promotion-terms .betformatics-terms-toggle {
        width: 44px !important;
        height: 44px !important;
        right: -12px !important;
        top: -8px !important;
    }

    /* Make the entire terms preview area clickable on mobile */
    .betformatics-promotion-terms.betformatics-terms-collapsible {
        cursor: pointer;
    }

    .betformatics-promotion-terms.betformatics-terms-collapsible .betformatics-terms-preview {
        cursor: pointer;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .betformatics-promotion-button-wrapper a.betformatics-promotion-button,
    a.betformatics-promotion-button {
        transition: none !important;
    }
}

/* Page builder compatibility - FORCE FULL WIDTH */
.elementor-widget-container .betformatics-promotion-button-wrapper,
.elementor-widget-shortcode .betformatics-promotion-button-wrapper,
.elementor-shortcode .betformatics-promotion-button-wrapper,
.elementor-element .betformatics-promotion-button-wrapper,
.wp-block .betformatics-promotion-button-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
}

/* Force Elementor parent containers to be full width */
.elementor-widget-shortcode:has(.betformatics-promotion-button-wrapper),
.elementor-widget-shortcode:has(.betformatics-promotion-button-wrapper) .elementor-widget-container,
.elementor-widget-shortcode:has(.betformatics-promotion-button-wrapper) .elementor-shortcode {
    width: 100% !important;
    max-width: 100% !important;
}

/* =============================================================================
   FULLWIDTH VARIANT - Vertical card matching the main promotion card layout
   Uses same visual style as the main promotion card (image on top, content below)
   ============================================================================= */
.betformatics-promotion-button-wrapper.betformatics-promotion-fullwidth {
    flex-direction: column;
    margin: 16px 0;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box !important;
}

/* Elementor full-width override - force expand to column width */
.elementor-widget-shortcode .betformatics-promotion-button-wrapper.betformatics-promotion-fullwidth {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Also target the parent widget container to ensure full width */
.elementor-widget-shortcode:has(.betformatics-promotion-fullwidth) .elementor-widget-container {
    width: 100% !important;
    max-width: none !important;
}

/* Fullwidth image section - override the :has() fallback rules */
.betformatics-promotion-fullwidth .betformatics-promotion-image,
.betformatics-promotion-fullwidth .betformatics-promotion-image:has(.betformatics-promotion-img-fallback) {
    width: 100% !important;
    height: 200px !important;
    aspect-ratio: unset !important;
    border-radius: var(--bf-radius-lg) var(--bf-radius-lg) 0 0 !important;
}

.betformatics-promotion-fullwidth .betformatics-promotion-img-fallback {
    width: 100% !important;
    height: 200px !important;
    border-radius: var(--bf-radius-lg) var(--bf-radius-lg) 0 0 !important;
    padding: 40px !important;
}

.betformatics-promotion-fullwidth .betformatics-promotion-img-fallback .betformatics-promotion-img {
    width: auto !important;
    height: auto !important;
    max-width: 200px !important;
    max-height: 80px !important;
    object-fit: contain !important;
}
