/**
 * BX Toplist - Clean Professional Design
 * Matches Beaxy casino theme styling
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    --bx-bg: #ffffff;
    --bx-bg-subtle: #f8fafc;
    --bx-border: #e2e8f0;
    --bx-border-strong: #cbd5e1;
    --bx-accent: #059669;
    --bx-accent-light: rgba(5, 150, 105, 0.1);
    --bx-accent-hover: #047857;
    --bx-gold: #ca8a04;
    --bx-gold-bg: #fef9c3;
    --bx-text: #1e293b;
    --bx-text-secondary: #64748b;
    --bx-text-muted: #94a3b8;
    --bx-font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --bx-font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ============================================
   TOPLIST CONTAINER
   ============================================ */
.bx-toplist {
    font-family: var(--bx-font-sans);
    color: var(--bx-text);
    max-width: 100%;
}

/* ============================================
   FILTERS
   ============================================ */
.bx-toplist__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 0;
    margin-bottom: 0.5rem;
}

.bx-toplist__filter {
    padding: 0.5rem 1rem;
    background: var(--bx-bg);
    border: 1px solid var(--bx-border);
    border-radius: 6px;
    color: var(--bx-text-secondary);
    font-family: var(--bx-font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bx-toplist__filter:hover {
    border-color: var(--bx-accent);
    color: var(--bx-accent);
}

.bx-toplist__filter--active {
    background: var(--bx-accent);
    border-color: var(--bx-accent);
    color: #fff;
    font-weight: 600;
}

/* ============================================
   OFFERS CONTAINER
   ============================================ */
.bx-toplist__offers {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ============================================
   OFFER CARD
   ============================================ */
.bx-toplist__card {
    position: relative;
    background: var(--bx-bg);
    border: 1px solid var(--bx-border);
    border-radius: 8px;
    overflow: visible;
    transition: all 0.15s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.bx-toplist__card:hover {
    border-color: var(--bx-accent);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.1);
}

/* Featured card (position 1) */
.bx-toplist__card--featured {
    border-color: var(--bx-gold);
    background: linear-gradient(90deg, var(--bx-gold-bg) 0%, var(--bx-bg) 20%);
}

.bx-toplist__card--featured:hover {
    border-color: var(--bx-gold);
    box-shadow: 0 4px 16px rgba(202, 138, 4, 0.15);
}

.bx-toplist__card--hidden {
    display: none;
}

.bx-toplist__card--filtered {
    display: none !important;
}

/* ============================================
   POSITION NUMBER - Corner overlay
   ============================================ */
.bx-toplist__position {
    position: absolute;
    top: -1px;
    left: -1px;
    font-family: var(--bx-font-mono);
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--bx-text-muted);
    border-radius: 8px 0 8px 0;
    padding: 4px 10px;
    z-index: 2;
    line-height: 1;
}

.bx-toplist__card--featured .bx-toplist__position {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ============================================
   TOP PICK BADGE
   ============================================ */
.bx-toplist__top-badge {
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 14px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    font-family: var(--bx-font-sans);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 0 0 6px 6px;
    z-index: 3;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

/* ============================================
   CONTENT LAYOUT
   ============================================ */
.bx-toplist__content {
    display: grid;
    grid-template-columns: 140px 1fr 160px;
    gap: 1rem;
    padding: 12px 16px 12px 40px;
    align-items: center;
    min-height: 70px;
}

.bx-toplist__card--featured .bx-toplist__content {
    padding-top: 20px;
}

/* ============================================
   BRAND SECTION
   ============================================ */
.bx-toplist__brand-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.bx-toplist__logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 50px;
}

.bx-toplist__logo {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.bx-toplist__brand-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--bx-text);
    line-height: 1.2;
}

/* ============================================
   OFFER SECTION
   ============================================ */
.bx-toplist__offer-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-left: 16px;
    border-left: 1px solid var(--bx-border);
}

.bx-toplist__offer-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--bx-text);
    line-height: 1.4;
}

.bx-toplist__offer-text p {
    margin: 0;
}

/* Feature pills */
.bx-toplist__features {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.bx-toplist__feature-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--bx-accent-light);
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    color: var(--bx-accent);
    white-space: nowrap;
}

/* Rating - Below features */
.bx-toplist__rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.bx-toplist__rating-stars {
    display: flex;
    gap: 1px;
    font-size: 13px;
    line-height: 1;
}

.bx-star {
    color: #d1d5db;
}

.bx-star--full {
    color: #f59e0b;
    text-shadow: 0 1px 2px rgba(245, 158, 11, 0.3);
}

.bx-star--half {
    color: #f59e0b;
    opacity: 0.5;
}

.bx-star--empty {
    color: #e5e7eb;
}

.bx-toplist__rating-score {
    font-family: var(--bx-font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--bx-text-secondary);
}

/* ============================================
   CTA SECTION - Theme buttons
   ============================================ */
.bx-toplist__cta-section {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

/* Primary CTA - inherits from theme .btn--casino-primary */
.bx-toplist .bx-toplist__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    /* Use casino theme colors via CSS variables */
    background: var(--casino-accent, #059669);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
}

.bx-toplist .bx-toplist__cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
    filter: brightness(1.1);
    color: #ffffff;
    text-decoration: none;
}

.bx-toplist .bx-toplist__cta svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Secondary Review button - inherits from theme .btn--casino-secondary */
.bx-toplist .bx-toplist__review-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    /* Use casino theme colors via CSS variables */
    background: var(--casino-bg-card, #ffffff);
    color: var(--casino-text, #1e293b);
    border: 1px solid var(--casino-border, #e2e8f0);
}

.bx-toplist .bx-toplist__review-btn:hover {
    background: var(--casino-bg-subtle, #f8fafc);
    border-color: var(--casino-accent, #059669);
    color: var(--casino-accent, #059669);
    text-decoration: none;
}

/* ============================================
   SHOW MORE BUTTON
   ============================================ */
.bx-toplist__show-more {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 1rem;
    padding: 0.875rem 2rem;
    background: var(--bx-bg);
    border: 1px dashed var(--bx-border);
    border-radius: 8px;
    color: var(--bx-text-secondary);
    font-family: var(--bx-font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bx-toplist__show-more:hover {
    border-color: var(--bx-accent);
    border-style: solid;
    color: var(--bx-accent);
    background: var(--bx-accent-light);
}

/* ============================================
   RESPONSIVE - TABLET
   ============================================ */
@media (max-width: 900px) {
    .bx-toplist__content {
        grid-template-columns: 110px 1fr 140px;
        gap: 12px;
        padding: 10px 14px 10px 36px;
    }

    .bx-toplist__card--featured .bx-toplist__content {
        padding-top: 18px;
    }

    .bx-toplist__position {
        font-size: 11px;
        padding: 3px 8px;
    }

    .bx-toplist__logo-wrap {
        width: 80px;
        height: 40px;
    }

    .bx-toplist__brand-name {
        font-size: 11px;
    }

    .bx-toplist__offer-text {
        font-size: 13px;
    }

    .bx-toplist .bx-toplist__cta {
        padding: 8px 14px;
        font-size: 11px;
    }

    .bx-toplist .bx-toplist__review-btn {
        padding: 6px 12px;
        font-size: 10px;
    }
}

/* ============================================
   RESPONSIVE - MOBILE
   ============================================ */
@media (max-width: 640px) {
    .bx-toplist__filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .bx-toplist__filters::-webkit-scrollbar {
        display: none;
    }

    .bx-toplist__filter {
        flex-shrink: 0;
    }

    .bx-toplist__top-badge {
        font-size: 9px;
        padding: 3px 10px;
    }

    .bx-toplist__position {
        position: absolute;
        top: -1px;
        left: -1px;
        font-size: 10px;
        padding: 3px 8px;
    }

    /* Stack layout on mobile */
    .bx-toplist__content {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 12px;
        padding-top: 10px;
    }

    .bx-toplist__card--featured .bx-toplist__content {
        padding-top: 22px;
    }

    /* Brand section - horizontal on mobile */
    .bx-toplist__brand-section {
        flex-direction: row;
        width: 100%;
        gap: 10px;
        text-align: left;
        align-items: center;
        padding-left: 28px;
    }

    .bx-toplist__logo-wrap {
        width: 60px;
        height: 35px;
        flex-shrink: 0;
    }

    .bx-toplist__brand-name {
        font-size: 14px;
    }

    /* Offer section */
    .bx-toplist__offer-section {
        width: 100%;
        padding-left: 0;
        border-left: none;
        padding-top: 8px;
        border-top: 1px solid var(--bx-border);
    }

    .bx-toplist__offer-text {
        font-size: 13px;
    }

    .bx-toplist__feature-pill {
        font-size: 9px;
    }

    .bx-toplist__rating {
        margin-top: 6px;
    }

    .bx-toplist__rating-stars {
        font-size: 14px;
    }

    .bx-toplist__rating-score {
        font-size: 12px;
    }

    /* CTA section */
    .bx-toplist__cta-section {
        width: 100%;
        flex-direction: row;
        gap: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--bx-border);
    }

    .bx-toplist .bx-toplist__cta {
        flex: 1;
        padding: 10px 16px;
        font-size: 12px;
        justify-content: center;
    }

    .bx-toplist .bx-toplist__review-btn {
        padding: 10px 16px;
        font-size: 11px;
    }
}

/* ============================================
   BRAND REVIEW COMPONENT
   ============================================ */
.bx-brand-review {
    position: relative;
    font-family: var(--bx-font-sans);
    color: var(--bx-text);
    width: 100%;
    max-width: 48rem;
    margin: 1.5rem auto;
    background: var(--bx-bg);
    border: 1px solid var(--bx-border);
    border-radius: 12px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.bx-brand-review:hover {
    border-color: var(--bx-accent);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.1);
}

/* Sticky container */
.bx-brand-review__sticky {
    position: relative;
    z-index: 10;
    background: var(--bx-bg-subtle);
    border-radius: 12px 12px 0 0;
    transition: box-shadow 0.2s ease;
    cursor: pointer;
}

.bx-brand-review__sticky.is-stuck {
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 0;
    border-bottom: 1px solid var(--bx-border);
}

.bx-brand-review__sticky:hover {
    background: var(--bx-bg);
}

/* Toggle button */
.bx-brand-review__toggle {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    z-index: 5;
}

.bx-brand-review__toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--bx-bg);
    border: 1px solid var(--bx-border);
    border-radius: 6px;
    color: var(--bx-text-muted);
    transition: all 0.2s ease;
}

.bx-brand-review__toggle-icon svg {
    width: 16px;
    height: 16px;
}

.bx-brand-review__sticky:hover .bx-brand-review__toggle-icon {
    color: var(--bx-accent);
    border-color: var(--bx-accent);
}

/* Collapsed state */
.bx-brand-review--collapsed .bx-brand-review__toggle-icon {
    transform: rotate(180deg);
}

.bx-brand-review--collapsed .bx-brand-review__content {
    display: none;
}

.bx-brand-review--collapsed .bx-brand-review__sticky {
    border-radius: 12px;
}

.bx-brand-review--collapsed .bx-brand-review__header {
    border-bottom: none;
}

/* Title */
.bx-brand-review__title,
h2.bx-brand-review__title,
h3.bx-brand-review__title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--bx-accent);
    margin: 0;
    padding: 1rem 1.25rem;
    padding-right: 4rem;
    background: transparent;
    border-bottom: 1px solid var(--bx-border);
    line-height: 1.4;
}

.bx-brand-review__title-text {
    display: block;
}

/* Header */
.bx-brand-review__header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    padding: 1.25rem;
    align-items: center;
    background: transparent;
    border-bottom: 1px solid var(--bx-border);
}

.bx-brand-review__logo-wrap {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bx-bg);
    border-radius: 10px;
    border: 1px solid var(--bx-border);
    overflow: hidden;
}

.bx-brand-review__logo {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.bx-brand-review__info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.bx-brand-review__name {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--bx-text);
}

.bx-brand-review__rating-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bx-brand-review__stars {
    display: flex;
    font-size: 0.85rem;
}

.bx-brand-review__score {
    font-family: var(--bx-font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bx-text-secondary);
}

.bx-brand-review__header-cta {
    display: flex;
    align-items: center;
}

.bx-brand-review__cta,
.bx-brand-review__cta:link,
.bx-brand-review__cta:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bx-accent);
    border: none;
    border-radius: 8px;
    color: #fff !important;
    font-family: var(--bx-font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
    white-space: nowrap;
}

.bx-brand-review__cta:hover,
.bx-brand-review__cta:focus,
.bx-brand-review__cta:active {
    background: var(--bx-accent-hover);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
    text-decoration: none;
    color: #fff !important;
}

.bx-brand-review__cta-arrow {
    transition: transform 0.2s ease;
}

.bx-brand-review__cta:hover .bx-brand-review__cta-arrow {
    transform: translateX(3px);
}

/* Content section */
.bx-brand-review__content {
    padding: 1.25rem;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--bx-text);
    background: var(--bx-bg);
    border-radius: 0 0 12px 12px;
    word-break: break-word;
}

.bx-brand-review:not(.bx-brand-review--wrapped) .bx-brand-review__content {
    background: transparent;
    border-top: 1px dashed var(--bx-border);
}

.bx-brand-review--wrapped .bx-brand-review__content {
    border-top: none;
}

.bx-brand-review__content p {
    margin: 0 0 1rem;
}

.bx-brand-review__content p:last-child {
    margin-bottom: 0;
}

.bx-brand-review__content h2,
.bx-brand-review__content h3,
.bx-brand-review__content h4 {
    color: var(--bx-text);
    margin: 1.5rem 0 0.75rem;
}

.bx-brand-review__content h2:first-child,
.bx-brand-review__content h3:first-child,
.bx-brand-review__content h4:first-child {
    margin-top: 0;
}

.bx-brand-review__content ul,
.bx-brand-review__content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.bx-brand-review__content li {
    margin-bottom: 0.5rem;
}

.bx-brand-review__content a {
    color: var(--bx-accent);
    text-decoration: none;
}

.bx-brand-review__content a:hover {
    text-decoration: underline;
}

/* Mobile Brand Review */
@media (max-width: 768px) {
    .bx-brand-review__toggle {
        top: 0.875rem;
        right: 1rem;
    }

    .bx-brand-review__header {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 1rem;
        padding: 1rem;
    }

    .bx-brand-review__logo-wrap {
        width: 56px;
        height: 56px;
    }

    .bx-brand-review__logo {
        width: 44px;
        height: 44px;
    }

    .bx-brand-review__name {
        font-size: 1rem;
    }

    .bx-brand-review__header-cta {
        grid-column: 1 / -1;
        width: 100%;
    }

    .bx-brand-review__cta {
        width: 100%;
        justify-content: center;
    }

    .bx-brand-review__title {
        padding: 0.875rem 1rem;
        padding-right: 3.5rem;
        font-size: 0.95rem;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes bxCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bx-toplist__card {
    animation: bxCardFadeIn 0.3s ease forwards;
}

.bx-toplist__card:nth-child(1) { animation-delay: 0s; }
.bx-toplist__card:nth-child(2) { animation-delay: 0.05s; }
.bx-toplist__card:nth-child(3) { animation-delay: 0.1s; }
.bx-toplist__card:nth-child(4) { animation-delay: 0.15s; }
.bx-toplist__card:nth-child(5) { animation-delay: 0.2s; }

/* Hidden cards (show more) */
.bx-toplist__card--hidden {
    display: none;
}

/* Reveal animation for show more */
.bx-toplist__card--reveal {
    animation: bxCardFadeIn 0.3s ease forwards;
}

/* Filtered cards */
.bx-toplist__card--filtered {
    display: none;
}
