/* Tournament & prize modals — uses index.css theme variables */

/* Bottom toolbar prize button */
.ethiomark-bottom-navbar {
    justify-content: center;
    align-items: stretch;
    gap: 6px;
    padding: 2px 8px;
    padding-bottom: calc(2px + env(safe-area-inset-bottom, 0px));
    min-height: 0;
}

.nav-action-btn.prize {
    flex: 1;
    max-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 4px 8px;
    border-radius: 14px;
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    min-height: 36px;
    box-shadow: -3px 0 10px rgba(0, 0, 0, 0.22), 3px 0 10px rgba(0, 0, 0, 0.22);
    transition: box-shadow 0.2s, transform 0.15s;
}

.nav-action-btn.prize .nav-btn-icon {
    font-size: 1.15rem;
    line-height: 1.1;
}

.nav-action-btn.prize .nav-btn-label {
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--highlight-color);
}

.nav-action-btn.prize:hover {
    box-shadow: -4px 0 14px color-mix(in srgb, var(--highlight-color) 25%, transparent), 4px 0 14px color-mix(in srgb, var(--highlight-color) 25%, transparent);
    transform: translateY(-1px);
    border: 1px solid color-mix(in srgb, var(--highlight-color) 50%, transparent);
}

.nav-action-btn.start {
    flex: none;
    max-width: none;
    width: auto;
    min-width: 120px;
    min-height: 36px;
    padding: 4px 18px;
    font-size: 12px;
}

/* Shared overlays — above top chrome (10000), app menu (10002), loader (9998) */
.prize-board-overlay,
.prize-list-overlay {
    position: fixed;
    inset: 0;
    z-index: 10100;
    background: var(--overlay-bg);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.prize-list-overlay {
    z-index: 10110;
}

.prize-board-overlay[hidden],
.prize-list-overlay[hidden] {
    display: none !important;
}

body.prize-board-open {
    overflow: hidden;
}

.tournament-modal,
.prize-list-modal {
    width: 100%;
    max-width: 480px;
    max-height: min(92vh, 720px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: 16px 16px 0 0;
    color: var(--text-primary);
    position: relative;
    border: none;
    box-shadow:
        0 -8px 32px rgba(0, 0, 0, 0.35),
        -6px 0 20px rgba(0, 0, 0, 0.18),
        6px 0 20px rgba(0, 0, 0, 0.18);
}

@media (min-width: 500px) {
    .prize-board-overlay,
    .prize-list-overlay {
        align-items: center;
        padding: 12px;
    }
    .tournament-modal,
    .prize-list-modal {
        border-radius: 16px;
        max-height: min(90vh, 680px);
    }
}

.tournament-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

/* Header — accent gradient (system green/gold, not red) */
.tournament-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px 14px;
    padding-right: 40px;
    background: linear-gradient(
        135deg,
        var(--primary-700) 0%,
        var(--primary-600) 45%,
        var(--primary-800) 100%
    );
    flex-shrink: 0;
    border-bottom: 1px solid var(--border-color);
}

[data-theme="light"] .tournament-header {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-500) 55%, var(--primary-700) 100%);
}

.tournament-header-text {
    flex: 1;
    min-width: 0;
}

.tournament-header h2 {
    font-size: 0.95rem;
    font-weight: 800;
    margin: 0 0 4px;
    letter-spacing: 0.02em;
    color: #fff;
}

.tournament-schedule-label {
    font-size: 0.68rem;
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.35;
}

.tournament-header-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.tournament-prizes-btn {
    padding: 5px 10px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.tournament-prizes-btn:hover {
    background: rgba(0, 0, 0, 0.35);
}

.tournament-countdown {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.tournament-countdown .cd-box {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 6px;
    padding: 4px 6px;
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--secondary-200);
    line-height: 1.2;
}

.tournament-countdown .cd-box b {
    display: block;
    font-size: 0.85rem;
    color: #fff;
    font-weight: 800;
}

.tournament-countdown .cd-sep {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
}

.tournament-trophy-art {
    font-size: 2rem;
    line-height: 1;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25));
}

.tournament-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px 12px;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-secondary);
}

.tournament-period-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px 0;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.tournament-period-select {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.tournament-period-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

[data-theme="light"] .tournament-body {
    background: var(--gray-50);
}

/* Podium */
.tournament-podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    margin: 12px 0 14px;
    padding: 0 2px;
}

.podium-card {
    flex: 1;
    max-width: 118px;
    border-radius: 12px 12px 8px 8px;
    padding: 28px 6px 10px;
    text-align: center;
    position: relative;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--border-color);
}

.podium-card.rank-1 {
    order: 2;
    min-height: 130px;
    background: linear-gradient(180deg, var(--secondary-400) 0%, var(--secondary-600) 50%, var(--secondary-800) 100%);
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.25);
}

.podium-card.rank-2 {
    order: 1;
    background: linear-gradient(180deg, var(--gray-200) 0%, var(--gray-400) 50%, var(--gray-600) 100%);
}

.podium-card.rank-3 {
    order: 3;
    background: linear-gradient(180deg, #fdba74 0%, #ea580c 50%, #9a3412 100%);
}

.podium-crown {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.25rem;
    line-height: 1;
}

.podium-rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: #fff;
}

.podium-card .p-name {
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #fff;
}

.podium-card .p-phone {
    font-size: 0.58rem;
    opacity: 0.85;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.9);
}

.podium-card .p-points {
    font-size: 0.95rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.podium-prize-img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    margin-bottom: 4px;
    border: 2px solid rgba(255, 255, 255, 0.35);
}

.p-prize-label {
    font-size: 0.62rem;
    font-weight: 700;
    margin-top: 4px;
    line-height: 1.2;
    color: #fff;
}

.p-prize-sub {
    font-size: 0.55rem;
    opacity: 0.85;
    display: block;
    margin-top: 2px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.9);
}

.podium-card.empty {
    opacity: 0.5;
    justify-content: flex-end;
}

/* Leaderboard list */
.tournament-table-head {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 8px;
    padding: 6px 8px 8px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-color);
}

.tournament-table-head span:nth-child(2),
.tournament-table-head span:nth-child(3) {
    text-align: right;
    min-width: 52px;
}

.tournament-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.tournament-row {
    display: grid;
    grid-template-columns: 36px 1fr auto auto;
    align-items: center;
    gap: 6px;
    padding: 10px 6px;
    border-bottom: 1px solid var(--border-color);
}

.tournament-row:last-child {
    border-bottom: none;
}

.tournament-rank-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    background: var(--primary-600);
}

.tournament-rank-dot.r4 { background: var(--primary-700); }
.tournament-rank-dot.r5 { background: var(--info); }
.tournament-rank-dot.r6 { background: var(--warning); }
.tournament-rank-dot.r7 { background: #0891b2; }
.tournament-rank-dot.r8 { background: #db2777; }
.tournament-rank-dot.r9 { background: var(--primary-500); }
.tournament-rank-dot.r10 { background: var(--secondary-600); }

.tournament-player .t-name {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tournament-player .t-phone {
    display: block;
    font-size: 0.62rem;
    color: var(--text-secondary);
    margin-top: 1px;
}

.tournament-points {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--accent-color);
    text-align: right;
    min-width: 44px;
}

.tournament-prize {
    font-size: 0.72rem;
    font-weight: 600;
    text-align: right;
    min-width: 48px;
    color: var(--text-secondary);
}

.prize-board-loading,
.prize-board-empty {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 1.5rem 1rem;
}

/* Prize list sub-modal */
.prize-list-header {
    padding: 14px 40px 12px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.prize-list-header h3 {
    font-size: 0.95rem;
    font-weight: 800;
    margin: 0 0 4px;
    color: var(--text-primary);
}

.prize-list-header p {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.4;
}

.prize-list-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 16px;
    -webkit-overflow-scrolling: touch;
}

.prize-list-item {
    display: grid;
    grid-template-columns: 32px 64px 1fr;
    gap: 10px;
    align-items: start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.prize-list-item:last-child {
    border-bottom: none;
}

.prize-list-rank {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--highlight-color);
    padding-top: 4px;
}

.prize-list-thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.prize-list-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.prize-list-placeholder {
    font-size: 1.75rem;
}

.prize-list-info h4 {
    font-size: 0.82rem;
    font-weight: 700;
    margin: 2px 0 4px;
    color: var(--text-primary);
}

.prize-list-type {
    font-size: 0.65rem;
    color: var(--text-secondary);
}

.prize-list-amt {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-top: 2px;
}

.prize-list-desc {
    font-size: 0.68rem;
    color: var(--text-secondary);
    margin: 4px 0 0;
    line-height: 1.35;
}
