/* =============================================
   Photo Bracket Voting — Frontend v2
   ============================================= */

/* ---------- Base ---------- */
.pb-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px 8px 40px;
    color: #111;
    box-sizing: border-box;
}
.pb-wrap *, .pb-wrap *::before, .pb-wrap *::after { box-sizing: inherit; }

.pb-title {
    text-align: center;
    font-size: clamp(1.3em, 3vw, 2.2em);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin: 0 0 28px;
    color: #111;
}

/* ---------- Champion Banner ---------- */
.pb-champion-banner {
    text-align: center;
    background: linear-gradient(135deg, #ffe066, #f29f05);
    border-radius: 16px;
    padding: 28px 20px 22px;
    margin-bottom: 36px;
    box-shadow: 0 6px 28px rgba(242,159,5,.35);
}
.pb-champion-icon  { font-size: 2.6em; line-height: 1; margin-bottom: 2px; }
.pb-champion-label { font-size: .72em; font-weight: 700; letter-spacing: 4px; text-transform: uppercase; color: #7a4f00; margin-bottom: 12px; }
.pb-champion-banner img {
    display: block; margin: 0 auto 12px;
    width: 160px; height: 160px; object-fit: cover;
    border-radius: 10px; border: 4px solid #fff;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    cursor: zoom-in;
}
.pb-champion-name { font-size: 1.3em; font-weight: 800; color: #3d2600; }

/* ---------- Bracket Outer ---------- */
.pb-bracket-outer {
    display: flex;
    align-items: stretch;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 12px;
    /* Each column stretches to fill equal height */
}

/* ---------- Columns ---------- */
.pb-col {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 150px;
    max-width: 210px;
}

/* Round 1 cols are widest */
.pb-col-r1 { min-width: 165px; max-width: 220px; }

/* Later rounds get slightly narrower naturally */
.pb-col-r2 { min-width: 155px; max-width: 205px; }
.pb-col-r3 { min-width: 155px; max-width: 205px; }

.pb-col-final {
    min-width: 170px;
    max-width: 225px;
    flex-shrink: 0;
}

.pb-col-header {
    text-align: center;
    font-size: .6em;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #666;
    background: #f2f2f2;
    border-radius: 5px;
    padding: 7px 4px;
    margin-bottom: 10px;
    white-space: nowrap;
}

.pb-col-final .pb-col-header {
    background: linear-gradient(135deg, #ffe066, #f29f05);
    color: #5a3900;
    font-size: .65em;
}

.pb-col-matchups {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    flex: 1;
    gap: 8px;
}

/* ---------- Matchup Card ---------- */
.pb-matchup {
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color .25s, box-shadow .25s;
    flex-shrink: 0;
}

.pb-matchup--active {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,.15);
}

.pb-matchup--decided { border-color: #ccc; }

.pb-matchup--big .pb-photo-wrap { height: 90px !important; }

/* ---------- Status bar at top of matchup ---------- */
.pb-status-bar {
    font-size: .65em;
    font-weight: 700;
    padding: 5px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.pb-status-bar--open {
    background: #0073aa;
    color: #fff;
}
.pb-status-bar--soon {
    background: #f5f5f0;
    color: #666;
    border-bottom: 1px solid #e8e8e8;
}

/* ---------- Slot (each contestant row) ---------- */
.pb-slot {
    border-bottom: 1px solid #eee;
    transition: background .2s;
}
.pb-slot:last-of-type { border-bottom: none; }
.pb-slot--winner { background: #f0fff4; }
.pb-slot--loser  { opacity: .5; }
.pb-slot--empty  { background: #fafafa; }

/* Inner row: photo + info side by side */
.pb-contestant-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 6px;
}

/* ---------- Photo ---------- */
.pb-photo-wrap {
    position: relative;
    width: 62px;
    height: 62px;
    flex-shrink: 0;
    border-radius: 7px;
    overflow: hidden;
    background: #eee;
    cursor: zoom-in;
}

.pb-photo-wrap--empty {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4em;
    color: #ccc;
    background: #f8f8f8;
    border: 2px dashed #ddd;
    cursor: default;
}

.pb-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .25s;
}

.pb-photo-wrap:hover .pb-photo { transform: scale(1.07); }

/* Zoom icon overlay on hover */
.pb-zoom-icon {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: .65em;
    border-radius: 3px;
    padding: 1px 3px;
    opacity: 0;
    transition: opacity .2s;
    pointer-events: none;
    line-height: 1.4;
}
.pb-photo-wrap:hover .pb-zoom-icon { opacity: 1; }

/* Winner checkmark badge */
.pb-winner-badge {
    position: absolute;
    top: 3px;
    right: 3px;
    background: #00a32a;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: .65em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
}

/* ---------- Info (name + bar) ---------- */
.pb-info {
    flex: 1;
    min-width: 0;
}

.pb-name {
    display: block;
    font-size: .72em;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
    color: #1a1a1a;
}
.pb-slot--winner .pb-name { color: #00693e; }
.pb-name--placeholder {
    font-style: italic;
    color: #aaa;
    font-weight: 500;
    white-space: normal;
    font-size: .65em;
    line-height: 1.3;
}

.pb-bar-wrap {
    position: relative;
    height: 16px;
    background: #efefef;
    border-radius: 8px;
    overflow: hidden;
}
.pb-bar {
    position: absolute;
    inset: 0;
    right: auto;
    background: linear-gradient(90deg, #0073aa, #00a0d2);
    border-radius: 8px;
    transition: width .7s ease;
    min-width: 4px;
}
.pb-slot--winner .pb-bar { background: linear-gradient(90deg, #00a32a, #33c957); }
.pb-bar-label {
    position: relative;
    z-index: 1;
    font-size: .6em;
    font-weight: 700;
    color: #333;
    white-space: nowrap;
    padding: 0 5px;
    line-height: 16px;
}

/* ---------- VS Divider ---------- */
.pb-vs {
    text-align: center;
    padding: 0;
    line-height: 1;
}
.pb-vs span {
    display: inline-block;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: .55em;
    font-weight: 900;
    color: #999;
    letter-spacing: 1px;
    padding: 2px 6px;
    margin: 0 auto;
}

/* ---------- VOTE BUTTON — always visible, full width ---------- */
.pb-vote-btn {
    display: block;
    width: calc(100% - 16px);
    margin: 0 8px 8px;
    padding: 8px 10px;
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: #fff !important;
    border: none;
    border-radius: 7px;
    font-size: .72em;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: background .2s, transform .1s, box-shadow .2s;
    box-shadow: 0 3px 10px rgba(0,115,170,.35);
    letter-spacing: .3px;
}
.pb-vote-btn:hover {
    background: linear-gradient(135deg, #005a87, #003f60);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(0,115,170,.45);
}
.pb-vote-btn:active { transform: translateY(0); }

/* ---------- Countdown ---------- */
.pb-countdown {
    font-size: .9em;
    opacity: .85;
    font-variant-numeric: tabular-nums;
}

/* ---------- LIGHTBOX ---------- */
.pb-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0,0,0,.88);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
}
.pb-lightbox.is-open { display: flex; }

.pb-lightbox-img {
    max-width: min(90vw, 800px);
    max-height: 75vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0,0,0,.6);
    display: block;
}

.pb-lightbox-caption {
    color: #fff;
    font-size: 1.1em;
    font-weight: 700;
    margin-top: 14px;
    text-align: center;
    letter-spacing: .5px;
}

.pb-lightbox-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,.15);
    border: 2px solid rgba(255,255,255,.35);
    color: #fff;
    font-size: 1.6em;
    line-height: 1;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
.pb-lightbox-close:hover { background: rgba(255,255,255,.28); }

/* ---------- Error ---------- */
.pb-error {
    color: #d63638;
    font-style: italic;
    padding: 10px 14px;
    background: #fff0f0;
    border: 1px solid #d63638;
    border-radius: 6px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .pb-col { min-width: 130px; }
    .pb-col-r1 { min-width: 140px; }
    .pb-photo-wrap { width: 52px; height: 52px; }
}

@media (max-width: 700px) {
    /* Stack into vertical single-column view on mobile */
    .pb-bracket-outer {
        flex-direction: column;
        overflow-x: hidden;
    }
    .pb-col, .pb-col-r1, .pb-col-r2, .pb-col-r3, .pb-col-final {
        min-width: unset;
        max-width: 100%;
    }
    .pb-col-matchups {
        flex-direction: column;
        gap: 10px;
    }
    .pb-photo-wrap { width: 68px; height: 68px; }
}
