/* ===== WEEKLY LOTTO 6/45 STYLES ===== */

/* Background image for weekly lotto page with WebP support and JPG fallback */
.bg-animated {
    position: fixed;
    inset: -20%;
    /* Background image with WebP support and JPG fallback */
    background-image: 
        image-set(
            url("/img/weekly.webp") type("image/webp"),
            url("/img/weekly.jpg") type("image/jpeg")
        ),
        /* Fallback for browsers that don't support image-set */
        url("/img/weekly.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
    /* Subtle living background motion */
    animation: bgDrift 24s ease-in-out infinite;
}

/* Fallback for browsers without image-set */
@supports not (background-image: image-set(url("/img/weekly.webp") type("image/webp"))) {
    .bg-animated {
        background-image: url("/img/weekly.jpg");
    }
}

/* Dark overlay for readability */
.bg-animated::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(5, 8, 22, 0.50) 0%,
        rgba(11, 16, 32, 0.50) 50%,
        rgba(5, 8, 22, 0.50) 100%
    );
    pointer-events: none;
    z-index: 0;
}

/* Subtle animated gradients overlay */
.bg-animated::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 10% 20%, rgba(108, 92, 231, 0.12), transparent 55%),
        radial-gradient(circle at 80% 0%, rgba(0, 184, 148, 0.10), transparent 55%),
        radial-gradient(circle at 50% 100%, rgba(9, 132, 227, 0.12), transparent 55%);
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: screen;
}

/* Subtle background drift animation */
@keyframes bgDrift {
    0% { 
        background-position: 50% 50%;
        transform: translate3d(0, 0, 0) scale(1.01);
    }
    33% { 
        background-position: 51% 49%;
        transform: translate3d(-4px, -6px, 0) scale(1.02);
    }
    66% { 
        background-position: 49% 51%;
        transform: translate3d(4px, 6px, 0) scale(1.02);
    }
    100% { 
        background-position: 50% 50%;
        transform: translate3d(0, 0, 0) scale(1.01);
    }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .bg-animated {
        animation: none;
        background-position: center;
    }
}

.weekly-lotto-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.25;
}

/* ===== HEADER ===== */
.weekly-lotto-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(8px, env(safe-area-inset-top, 8px)) 10px 10px;
    flex-shrink: 0;
    margin: 8px 8px 6px;
    background: rgba(15, 20, 40, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.btn-home {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 8px;
    color: var(--accent);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.btn-home:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-home i {
    font-size: 12px;
}

.weekly-lotto-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 0 8px rgba(108, 92, 231, 0.3);
}

.status-pill {
    padding: 4px 10px;
    background: rgba(108, 92, 231, 0.2);
    border: 1px solid rgba(108, 92, 231, 0.4);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    flex-shrink: 0;
}

.status-pill.status-open {
    background: rgba(0, 184, 148, 0.2);
    border-color: rgba(0, 184, 148, 0.4);
    color: var(--success);
}

.status-pill.status-settled {
    background: rgba(108, 92, 231, 0.2);
    border-color: rgba(108, 92, 231, 0.4);
    color: var(--accent);
}

/* ===== HERO SECTION ===== */
.hero-section {
    flex-shrink: 0;
    padding: 0 4px;
}

.hero-subtitle {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.jackpot-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

.jackpot-amount {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.jackpot-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.jackpot-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    text-shadow: 0 0 12px rgba(108, 92, 231, 0.5);
}

.jackpot-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.stat-label {
    color: var(--text-muted);
}

.stat-value {
    font-weight: 600;
    color: var(--text);
}

.countdown {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 8px;
}

.countdown-label {
    color: var(--text-muted);
}

.countdown-value {
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--accent);
}

.schedule-line {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* ===== WINNING NUMBERS ===== */
.winning-numbers-section {
    flex-shrink: 0;
    padding: 0 4px;
}

.winning-numbers-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 16px;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

.winning-numbers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.btn-replay {
    padding: 4px 10px;
    background: rgba(108, 92, 231, 0.2);
    border: 1px solid rgba(108, 92, 231, 0.4);
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-replay:hover {
    background: rgba(108, 92, 231, 0.3);
}

.winning-numbers-container {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.winning-number-chip {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--accent-strong), #4834d4);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

/* Replay animation */
.replay-container {
    margin-top: 16px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.drum-container {
    position: relative;
    width: 100%;
    height: 120px;
    background: rgba(15, 20, 40, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.ball {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-strong), #4834d4);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 14px;
}

.ball.rolling {
    animation: ballRoll 2s ease-in-out infinite;
}

@keyframes ballRoll {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(20px, 60px) rotate(90deg); }
    50% { transform: translate(40px, 30px) rotate(180deg); }
    75% { transform: translate(60px, 80px) rotate(270deg); }
}

.ball.exit {
    animation: ballExit 1s ease-out forwards;
}

@keyframes ballExit {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.5) translateX(200px); }
}

/* ===== PRIZE TIERS ===== */
.tiers-section {
    flex-shrink: 0;
    padding: 0 4px;
}

.tiers-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 12px 14px;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

.tiers-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.tiers-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tier-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.tier-match {
    color: var(--text-muted);
    font-weight: 600;
}

.tier-reward {
    color: var(--text);
    font-weight: 500;
}

/* ===== TICKET PICKER ===== */
.ticket-section {
    flex-shrink: 0;
    padding: 0 4px;
}

.ticket-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 16px;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.ticket-price {
    color: var(--accent);
    font-weight: 700;
}

.selected-numbers {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.number-slot {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.number-slot.filled {
    background: linear-gradient(135deg, var(--accent-strong), #4834d4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    gap: 6px;
    margin-bottom: 16px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
}

.number-btn {
    aspect-ratio: 1;
    min-width: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.number-btn.selected {
    background: linear-gradient(135deg, var(--accent-strong), #4834d4);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.number-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ticket-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-primary,
.btn-secondary {
    flex: 1;
    min-width: 80px;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-strong), #4834d4);
    color: #fff;
    box-shadow: 0 4px 12px rgba(108, 92, 231, 0.4);
}

.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.6);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Ticket summary */
.ticket-summary-card {
    margin-top: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 14px 16px;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

.ticket-summary-header {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.ticket-summary-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.summary-label {
    color: var(--text-muted);
}

.summary-value {
    font-weight: 600;
    color: var(--text);
}

.payment-section,
.confirm-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.invoice-info {
    margin-top: 8px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.invoice-id {
    margin-bottom: 8px;
}

.numbers-locked {
    margin-top: 12px;
    padding: 10px;
    background: rgba(108, 92, 231, 0.1);
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 8px;
    text-align: center;
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
}

.numbers-locked i {
    margin-right: 6px;
}

/* ===== MY TICKETS ===== */
.my-tickets-section {
    flex-shrink: 0;
    padding: 0 4px;
}

.my-tickets-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 12px 14px;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

.tickets-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket-item {
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.ticket-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.ticket-item-id {
    font-weight: 600;
    color: var(--accent);
}

.ticket-item-status {
    padding: 2px 8px;
    background: rgba(108, 92, 231, 0.2);
    border: 1px solid rgba(108, 92, 231, 0.4);
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--accent);
}

.ticket-item-numbers {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.ticket-number-mini {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 92, 231, 0.2);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.ticket-item-result {
    font-size: 12px;
    color: var(--text-muted);
}

.ticket-item-result.match {
    color: var(--success);
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 13px;
    margin: 0;
}

/* ===== LEADERBOARD ===== */
.leaderboard-section {
    flex-shrink: 0;
    padding: 0 4px;
    margin-bottom: 12px;
}

.leaderboard-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 12px 14px;
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

.leaderboard-item-rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(108, 92, 231, 0.2);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.leaderboard-item-info {
    flex: 1;
    margin-left: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.leaderboard-item-user {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.leaderboard-item-match {
    font-size: 11px;
    color: var(--text-muted);
}

.leaderboard-item-payout {
    font-size: 13px;
    font-weight: 600;
    color: var(--success);
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: max(20px, env(safe-area-inset-top, 20px));
    right: 12px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 16px;
    background: rgba(15, 20, 40, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    font-size: 13px;
    color: var(--text);
    pointer-events: auto;
    animation: toastSlideIn 0.3s ease-out;
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
}

.toast.error {
    border-color: rgba(255, 77, 77, 0.4);
    background: rgba(255, 77, 77, 0.1);
}

.toast.success {
    border-color: rgba(0, 184, 148, 0.4);
    background: rgba(0, 184, 148, 0.1);
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== UTILITY ===== */
.hidden {
    display: none !important;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .number-grid {
        grid-template-columns: repeat(9, 1fr);
        gap: 4px;
    }
    
    .number-btn {
        font-size: 12px;
    }
    
    .jackpot-value {
        font-size: 28px;
    }
    
    .ticket-actions {
        flex-direction: column;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
    }
}

