/* Ranking Bolão Congonhas — tema Brasil premium */

:root {
    --br-green: #009c3b;
    --br-green-deep: #04453a;
    --br-yellow: #ffdf00;
    --br-gold: #ffd700;
    --br-blue: #002776;
    --brand-lime: #c1c446;
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.72);
    --glass: rgba(4, 69, 58, 0.55);
    --glass-border: rgba(255, 223, 0, 0.22);
    --radius-lg: 20px;
    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'Montserrat', system-ui, sans-serif;
    --shadow-gold: 0 0 30px rgba(255, 215, 0, 0.45), 0 8px 32px rgba(0, 0, 0, 0.35);
    --shadow-green: 0 0 40px rgba(0, 156, 59, 0.35);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.rank-page {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-body);
    color: var(--text-primary);
    background: #032a1f;
    -webkit-font-smoothing: antialiased;
}

/* ─── Fundo Brasil ─── */
.rank-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.rank-bg__gradient {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 60% at 50% 0%, rgba(255, 223, 0, 0.28) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 10% 80%, rgba(0, 39, 118, 0.35) 0%, transparent 50%),
        radial-gradient(ellipse 50% 40% at 90% 70%, rgba(0, 156, 59, 0.4) 0%, transparent 50%),
        linear-gradient(165deg, #032a1f 0%, #04453a 28%, #0a5c3a 52%, #1a6b42 78%, #2d7a4a 100%);
}

.rank-bg__diamond {
    position: absolute;
    inset: 0;
    opacity: 0.06;
    background-image:
        linear-gradient(30deg, transparent 48%, rgba(255, 255, 255, 0.9) 49%, rgba(255, 255, 255, 0.9) 51%, transparent 52%),
        linear-gradient(150deg, transparent 48%, rgba(255, 255, 255, 0.9) 49%, rgba(255, 255, 255, 0.9) 51%, transparent 52%);
    background-size: 80px 80px;
}

.rank-bg__glow {
    position: absolute;
    top: -20%;
    left: 50%;
    width: 120%;
    height: 60%;
    transform: translateX(-50%);
    background: radial-gradient(ellipse at center, rgba(255, 215, 0, 0.15) 0%, transparent 65%);
    animation: rank-glow-pulse 6s ease-in-out infinite;
}

@keyframes rank-glow-pulse {
    0%, 100% { opacity: 0.7; transform: translateX(-50%) scale(1); }
    50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

/* ─── Layout ─── */
.rank-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.rank-header {
    position: sticky;
    top: 0;
    z-index: 20;
    border-bottom: 1px solid var(--glass-border);
    background: linear-gradient(180deg, rgba(4, 69, 58, 0.92) 0%, rgba(4, 69, 58, 0.78) 100%);
    backdrop-filter: blur(14px);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.rank-header__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.rank-header__badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--br-yellow);
    margin-bottom: 0.25rem;
}

.rank-header__badge::before,
.rank-header__badge::after {
    content: '';
    width: 18px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--br-yellow));
}

.rank-header__badge::after {
    background: linear-gradient(90deg, var(--br-yellow), transparent);
}

.rank-header__title {
    font-family: var(--font-display);
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    letter-spacing: 0.04em;
    line-height: 1;
    background: linear-gradient(135deg, #fff 0%, var(--br-yellow) 45%, var(--br-gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.3));
}

.rank-header__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    border: 1px solid rgba(255, 223, 0, 0.35);
    background: linear-gradient(135deg, rgba(0, 156, 59, 0.5), rgba(0, 39, 118, 0.35));
    transition: transform 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.rank-header__link:hover {
    transform: translateY(-1px);
    border-color: var(--br-yellow);
    box-shadow: var(--shadow-green);
}

.rank-header__actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.rank-main {
    flex: 1;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

/* ─── Cards ─── */
.rank-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.rank-card__title {
    font-family: var(--font-display);
    font-size: 1.35rem;
    letter-spacing: 0.06em;
    color: var(--br-yellow);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rank-card__subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
}

/* ─── Pódio visual ─── */
.podium-section {
    padding: 2rem 1.25rem 2.5rem;
    margin-bottom: 2rem;
    overflow: hidden;
    position: relative;
}

.podium-section::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: radial-gradient(ellipse 80% 100% at 50% 100%, rgba(0, 156, 59, 0.25) 0%, transparent 70%);
    pointer-events: none;
}

.podium-section__head {
    text-align: center;
    margin-bottom: 2rem;
}

.podium-stage {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(0.5rem, 2vw, 1.25rem);
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 0.5rem;
}

.podium-col {
    flex: 1;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.podium-col--1 { order: 2; }
.podium-col--2 { order: 1; }
.podium-col--3 { order: 3; }

.podium-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 0.75rem;
    width: 100%;
    animation: podium-rise 0.7s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.podium-col--1 .podium-player { animation-delay: 0.15s; }
.podium-col--2 .podium-player { animation-delay: 0.05s; }
.podium-col--3 .podium-player { animation-delay: 0.25s; }

@keyframes podium-rise {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

.podium-player__crown {
    font-size: 1.5rem;
    line-height: 1;
    margin-bottom: 0.25rem;
    filter: drop-shadow(0 2px 6px rgba(255, 215, 0, 0.6));
    animation: crown-bounce 2.5s ease-in-out infinite;
}

@keyframes crown-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.podium-player__avatar-wrap {
    position: relative;
    margin-bottom: 0.5rem;
}

.podium-player__avatar {
    width: clamp(64px, 14vw, 88px);
    height: clamp(64px, 14vw, 88px);
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.podium-col--1 .podium-player__avatar {
    width: clamp(76px, 16vw, 104px);
    height: clamp(76px, 16vw, 104px);
    border-width: 4px;
    border-color: var(--br-gold);
    box-shadow: var(--shadow-gold);
}

.podium-col--2 .podium-player__avatar {
    border-color: #e8e8e8;
    box-shadow: 0 0 20px rgba(192, 192, 192, 0.45);
}

.podium-col--3 .podium-player__avatar {
    border-color: #cd7f32;
    box-shadow: 0 0 18px rgba(205, 127, 50, 0.4);
}

.podium-player__medal {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 800;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.podium-col--1 .podium-player__medal {
    background: linear-gradient(135deg, #fff8dc, #ffd700, #b8860b);
    color: #5c4000;
}

.podium-col--2 .podium-player__medal {
    background: linear-gradient(135deg, #f8f8f8, #c0c0c0, #808080);
    color: #333;
}

.podium-col--3 .podium-player__medal {
    background: linear-gradient(135deg, #e8a87c, #cd7f32, #8b4513);
    color: #fff;
}

.podium-player__name {
    font-size: clamp(0.7rem, 2.2vw, 0.85rem);
    font-weight: 700;
    line-height: 1.25;
    padding: 0 0.25rem;
    max-width: 100%;
    word-break: break-word;
}

.podium-player__stats {
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.podium-player__stats strong {
    color: var(--br-yellow);
    font-weight: 700;
}

.podium-player--empty .podium-player__avatar {
    opacity: 0.35;
    filter: grayscale(1);
    border-style: dashed;
}

.podium-player--empty .podium-player__name {
    color: var(--text-muted);
    font-weight: 500;
}

/* Degraus do pódio */
.podium-block {
    width: 100%;
    position: relative;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.25),
        inset 0 -4px 12px rgba(0, 0, 0, 0.2),
        4px 0 12px rgba(0, 0, 0, 0.15);
}

.podium-block::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 35%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, transparent 100%);
    border-radius: 8px 8px 0 0;
    pointer-events: none;
}

.podium-block__rank {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3rem);
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.92);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
}

.podium-block--1 {
    height: clamp(110px, 22vw, 160px);
    background: linear-gradient(180deg, #ffe566 0%, #ffd700 35%, #daa520 70%, #b8860b 100%);
    box-shadow: var(--shadow-gold), inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.podium-block--2 {
    height: clamp(80px, 16vw, 120px);
    background: linear-gradient(180deg, #f0f0f0 0%, #d4d4d4 40%, #a8a8a8 75%, #787878 100%);
}

.podium-block--3 {
    height: clamp(60px, 12vw, 90px);
    background: linear-gradient(180deg, #e8a87c 0%, #cd7f32 45%, #a0522d 80%, #8b4513 100%);
}

/* Base verde — gramado brasileiro */
.podium-base {
    max-width: 720px;
    margin: 0 auto;
    height: 18px;
    border-radius: 0 0 6px 6px;
    background: linear-gradient(180deg, #1a8f4a 0%, #009c3b 40%, #046b32 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top: 2px solid rgba(255, 223, 0, 0.35);
    box-shadow: 0 8px 24px rgba(0, 156, 59, 0.4);
    position: relative;
}

.podium-base::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 12px,
        rgba(255, 255, 255, 0.04) 12px,
        rgba(255, 255, 255, 0.04) 24px
    );
    border-radius: inherit;
}

/* ─── Tabela classificação ─── */
.rank-table-section {
    padding: 1.5rem;
}

.rank-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: min(65vh, 560px);
    margin-top: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.rank-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.rank-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.rank-table thead th {
    padding: 0.85rem 0.65rem;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--br-yellow);
    background: linear-gradient(180deg, rgba(4, 69, 58, 0.98), rgba(4, 69, 58, 0.92));
    border-bottom: 1px solid rgba(255, 223, 0, 0.2);
}

.rank-table thead th.num {
    text-align: right;
}

.rank-table tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    transition: background 0.2s;
}

.rank-table tbody tr:hover {
    background: rgba(255, 223, 0, 0.06);
}

.rank-table tbody td {
    padding: 0.75rem 0.65rem;
    vertical-align: middle;
}

.rank-table .col-pos {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.55);
    width: 2.5rem;
}

.rank-table .col-participant {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 600;
}

.rank-table .col-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 223, 0, 0.3);
    flex-shrink: 0;
}

.rank-table .col-palpites {
    font-size: 0.72rem;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rank-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.rank-table .col-acertos {
    color: #6ee7a0;
    font-weight: 600;
}

.rank-table .col-pts {
    color: var(--br-gold);
    font-weight: 700;
}

.rank-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
}

.rank-footer {
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    padding: 1.5rem 1rem 2rem;
}

/* ─── Admin ─── */
.rank-alert {
    padding: 1rem 1.15rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
}

.rank-alert--ok {
    background: rgba(0, 156, 59, 0.25);
    border: 1px solid rgba(0, 200, 83, 0.45);
    color: #a7f3c4;
}

.rank-alert--err {
    background: rgba(180, 40, 40, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

.rank-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.55;
}

.rank-hint code {
    color: var(--br-yellow);
    font-size: 0.78rem;
}

.rank-hint strong {
    color: #fff;
}

.rank-admin-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem;
}

.rank-admin-form label {
    font-size: 0.68rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rank-admin-form input[type="number"] {
    width: 4.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 223, 0, 0.25);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 0.8rem;
}

.rank-btn {
    padding: 0.45rem 0.85rem;
    border: none;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    background: linear-gradient(135deg, var(--br-green), #006b2e);
    color: #fff;
    border: 1px solid rgba(255, 223, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.rank-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-green);
}

.rank-pos-badge {
    display: inline-block;
    min-width: 2rem;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--br-yellow);
}

.rank-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.rank-btn--gold {
    background: linear-gradient(135deg, #ffe566, #ffd700, #daa520);
    color: #3d2e00;
    border-color: rgba(255, 255, 255, 0.35);
}

.rank-btn--gold:hover {
    box-shadow: var(--shadow-gold);
}

.rank-btn--ghost {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.rank-btn--ghost:hover {
    border-color: var(--br-yellow);
    box-shadow: none;
}

.rank-btn--danger {
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    border-color: rgba(248, 113, 113, 0.35);
}

.rank-btn--danger:hover {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.35);
}

.rank-row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.rank-admin-form input[type="text"],
.rank-admin-form input[type="tel"] {
    min-width: 5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 223, 0, 0.25);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 0.8rem;
}

/* Modal */
.rank-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.rank-modal.is-open {
    display: flex;
}

.rank-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
}

.rank-modal__panel {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(165deg, rgba(4, 69, 58, 0.98), rgba(3, 42, 31, 0.98));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

.rank-modal__title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 0.05em;
    color: var(--br-yellow);
    margin-bottom: 1.25rem;
}

.rank-form-grid {
    display: grid;
    gap: 1rem;
}

.rank-form-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.rank-form-grid input,
.rank-form-grid textarea {
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 223, 0, 0.25);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.rank-form-grid textarea {
    min-height: 72px;
    resize: vertical;
}

.rank-form-grid input:focus,
.rank-form-grid textarea:focus {
    outline: none;
    border-color: var(--br-yellow);
    box-shadow: 0 0 0 2px rgba(255, 223, 0, 0.15);
}

.rank-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.rank-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.rank-phone-muted {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 400;
}

.rank-avatar-form {
    margin: 0;
    flex-shrink: 0;
}

.rank-avatar-picker {
    position: relative;
    display: block;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
}

.rank-avatar-picker .col-avatar {
    display: block;
    transition: transform 0.2s, opacity 0.2s;
}

.rank-avatar-picker:hover .col-avatar {
    transform: scale(1.05);
    opacity: 0.85;
}

.rank-avatar-picker__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 50%;
}

.rank-avatar-picker:hover .rank-avatar-picker__overlay {
    opacity: 1;
}

.rank-avatar-picker__input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.rank-avatar-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.rank-avatar-preview img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 223, 0, 0.45);
    box-shadow: var(--shadow-gold);
}

.rank-form-file {
    font-size: 0.8rem;
}

.rank-form-file input[type="file"] {
    margin-top: 0.35rem;
    width: 100%;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.rank-avatar-hint {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.45);
    margin-top: 0.25rem;
}

@media (max-width: 640px) {
    .rank-form-row {
        grid-template-columns: 1fr;
    }

    .rank-table .hide-admin-sm {
        display: none;
    }
}

@media (max-width: 640px) {
    .rank-table .hide-sm {
        display: none;
    }

    .podium-stage {
        gap: 0.35rem;
    }

    .podium-player__name {
        font-size: 0.62rem;
    }
}

@media (min-width: 900px) {
    .rank-main--public {
        padding-top: 2rem;
    }
}

.rank-regulamento__list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.65;
}

.rank-regulamento__list li + li {
    margin-top: 0.45rem;
}
