/* =============================================
   Album Copa 2026 - CSS complementar ao Bootstrap 5
   ============================================= */

/* Figurinha chip - colecao */
.sticker-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s, box-shadow 0.1s;
    border: 2px solid transparent;
    min-width: 75px;
    justify-content: center;
}

.sticker-chip:hover {
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 1;
}

.sticker-chip:active {
    transform: scale(0.95);
}

/* Estados das figurinhas */
.sticker-missing {
    background: #e9ecef;
    color: #6c757d;
    border-color: #dee2e6;
}

.sticker-have {
    background: #d1e7dd;
    color: #0f5132;
    border-color: #a3cfbb;
}

.sticker-dupe {
    background: #fff3cd;
    color: #664d03;
    border-color: #ffda6a;
}

.sticker-qty {
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(0,0,0,0.15);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sticker-qty:empty {
    display: none;
}

/* Legend chips */
.legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.1s, box-shadow 0.1s;
    border: 3px solid;
    min-width: 90px;
    justify-content: center;
}

.legend-chip:hover {
    transform: scale(1.08);
    box-shadow: 0 3px 12px rgba(0,0,0,0.25);
}

.legend-chip:active {
    transform: scale(0.95);
}

.legend-missing {
    background: #f0f0f0 !important;
    color: #999;
}

.legend-have {
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.legend-qty {
    font-size: 0.7rem;
    font-weight: 800;
    background: rgba(0,0,0,0.2);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.legend-qty:empty {
    display: none;
}

/* Grid padronizado de chips: 10 colunas desktop, 5 landscape, 4 portrait */
.chips-grid {
    display: grid;
    grid-template-columns: repeat(10, 88px);
    gap: 8px;
    justify-content: start;
}

/* Chips com nome do jogador (todas as selecoes + Coca-Cola) */
.sticker-chip.cc-chip,
.falt-chip.cc-chip,
.rep-chip.cc-chip {
    position: relative;
    flex-direction: column;
    text-align: center;
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    height: 54px;
    min-height: 54px;
    padding: 5px 4px;
    justify-content: center;
    box-sizing: border-box;
}

/* Qty badge como overlay no canto - nao ocupa espaco vertical */
.sticker-chip.cc-chip .sticker-qty,
.falt-chip.cc-chip .sticker-qty,
.rep-chip.cc-chip .sticker-qty {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 0.6rem;
    width: 17px;
    height: 17px;
    background: rgba(0,0,0,0.25);
    color: inherit;
    z-index: 2;
}

.cc-player-name {
    display: block;
    font-size: 0.6rem;
    font-weight: 500;
    opacity: 0.85;
    line-height: 1.15;
    margin-top: 2px;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Responsivo: tablet / mobile landscape - 5 colunas */
@media (min-width: 577px) and (max-width: 991px) {
    .chips-grid {
        grid-template-columns: repeat(5, 88px);
    }
}

/* Responsivo: mobile portrait - 4 colunas */
@media (max-width: 576px) {
    .chips-grid {
        grid-template-columns: repeat(4, 80px);
        gap: 6px;
    }
    .sticker-chip {
        padding: 4px 6px;
        font-size: 0.78rem;
        min-width: 70px;
    }
    .sticker-chip.cc-chip,
    .falt-chip.cc-chip,
    .rep-chip.cc-chip {
        width: 80px;
        min-width: 80px;
        max-width: 80px;
        height: 50px;
        min-height: 50px;
        padding: 4px 3px;
    }
    .sticker-chip.cc-chip .sticker-qty,
    .falt-chip.cc-chip .sticker-qty,
    .rep-chip.cc-chip .sticker-qty {
        width: 15px;
        height: 15px;
        font-size: 0.55rem;
        top: -4px;
        right: -4px;
    }
    .cc-player-name {
        font-size: 0.55rem;
    }
}

/* Dropdown busca de selecao */
.team-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1050;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.team-dropdown.show {
    display: block;
}

.team-dropdown-item {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.team-dropdown-item:hover,
.team-dropdown-item.active {
    background: #198754;
    color: white;
}

.team-dropdown-item.active small,
.team-dropdown-item:hover small {
    color: rgba(255,255,255,0.8) !important;
}

.col-md-5 {
    position: relative;
}

/* Troca - badges selecionaveis */
.troca-badge {
    transition: transform 0.15s, box-shadow 0.15s, outline 0.15s;
}

.troca-badge:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    z-index: 1;
}

.troca-selecionada {
    outline: 3px solid #0d6efd !important;
    outline-offset: 1px;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25) !important;
    transform: scale(1.08);
    font-weight: 700;
}

.troca-selecionada::after {
    content: ' \2713';
    font-weight: 900;
}

/* Minhas Trocas - status badges */
.troca-status-pendente {
    background: #fff3cd;
    color: #664d03;
    border-left: 4px solid #ffc107;
}

.troca-status-concluida {
    background: #d1e7dd;
    color: #0f5132;
    border-left: 4px solid #198754;
}

.troca-status-cancelada {
    background: #f8d7da;
    color: #842029;
    border-left: 4px solid #dc3545;
}

/* Repetidas - chips */
.rep-chip {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px 4px;
    border-radius: 8px;
    background: #fff3cd;
    border: 2px solid #ffda6a;
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s, box-shadow 0.15s;
    min-width: 60px;
    position: relative;
}

.rep-chip:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.rep-chip:active {
    transform: scale(0.95);
}

.rep-code {
    font-size: 0.8rem;
    font-weight: 700;
    color: #664d03;
}

.rep-count {
    font-size: 0.65rem;
    font-weight: 800;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -6px;
    right: -6px;
}

/* Faltantes - chips */
.falt-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    background: #e8f4fd;
    border: 1px solid #b6d4fe;
    min-width: 50px;
    justify-content: center;
}

.falt-code {
    font-size: 0.78rem;
    font-weight: 700;
    color: #084298;
}

/* Desktop: limitar largura para ficar elegante */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1100px;
    }
}

/* Admin - Faltantes unificadas */
.admin-falt-chip {
    position: relative;
    cursor: pointer;
    transition: opacity 0.3s, transform 0.3s;
}

.admin-falt-chip:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.admin-falt-chip:active {
    transform: scale(0.95);
}

.admin-falt-badge {
    position: absolute;
    top: -7px;
    right: -7px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 0.65rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.admin-falt-badge.badge-all {
    background: #dc3545;
    animation: pulse-badge 1.5s infinite;
}

.admin-falt-badge.badge-some {
    background: #fd7e14;
}

.admin-falt-badge.badge-one {
    background: #0d6efd;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* User toggle buttons */
.user-toggle {
    transition: all 0.2s;
}

.user-toggle.active {
    box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.4);
}

/* =============================================
   Mobile nativo - elimina bounce, margens, safe-area
   ============================================= */

/* Fundo verde na area da status bar (safe-area) - visual nativo no iPhone */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: env(safe-area-inset-top, 0px);
    background-color: #198754; /* mesma cor da navbar bg-success */
    z-index: 1031;
    pointer-events: none;
}

/* Navbar sticky respeita safe-area do iPhone com notch */
.navbar.sticky-top {
    top: env(safe-area-inset-top, 0px);
}

/* Anti-bounce / elastic scroll (iOS Safari) */
html, body {
    overscroll-behavior-y: none;
}

/* overflow-x: hidden só no body — no html quebraria position: sticky da navbar */
body {
    overflow-x: hidden;
}

/* Safe area para iPhones com notch */
body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* Mobile: conteudo borda-a-borda, visual nativo */
@media (max-width: 768px) {
    /* Remove margens do body */
    body {
        margin: 0 !important;
        overflow-x: hidden;
    }

    /* Reduz padding lateral dos containers no mobile */
    .container,
    .container-fluid,
    .container-sm,
    .container-md {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Navbar colada nas bordas */
    .navbar {
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Cards com borda levemente arredondada = mais nativo */
    .card {
        border-radius: 8px;
    }

    /* Conteudo principal com menos padding vertical */
    .container.py-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }

    /* === Pagina Repetidas: topo responsivo === */

    /* Titulo menor no mobile */
    .rep-topo h2 {
        font-size: 1.2rem;
    }

    /* Badges menores no mobile */
    .rep-badge-top {
        font-size: 0.72rem !important;
        padding: 0.25em 0.5em;
    }

    /* Botoes de acao menores no mobile */
    .rep-topo-acoes .btn-sm,
    .rep-topo-acoes .btn-group-sm > .btn {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
    }

    /* Barra de busca/ferramentas: garante que nao estoure */
    .rep-topo-acoes {
        max-width: 100%;
    }

    /* === Pagina Faltantes: topo responsivo === */

    .falt-topo h2 {
        font-size: 1.2rem;
    }

    .falt-badge-top {
        font-size: 0.72rem !important;
        padding: 0.25em 0.5em;
    }

    .falt-topo-acoes .btn-sm,
    .falt-topo-acoes .btn-group-sm > .btn {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
    }

    .falt-topo-acoes {
        max-width: 100%;
    }

    /* Texto informativo menor */
    .card-body small.text-muted {
        font-size: 0.7rem;
    }

    /* === Pagina Minhas Trocas: topo responsivo === */

    .troca-topo h2 {
        font-size: 1.2rem;
    }

    .troca-btn-nova {
        font-size: 0.78rem;
        padding: 0.3rem 0.6rem;
    }

    /* Filtros menores no mobile */
    .troca-filtros .btn {
        font-size: 0.65rem;
        padding: 0.2rem 0.35rem;
    }

    .troca-filtros .badge {
        font-size: 0.6rem;
    }

    /* Card header: nome truncado e badges menores */
    .troca-card .card-header {
        padding: 0.5rem 0.75rem;
    }

    .troca-card .card-header .badge {
        font-size: 0.65rem;
        padding: 0.2em 0.4em;
        white-space: nowrap;
    }

    .troca-card .card-header small {
        font-size: 0.65rem;
    }

    .troca-card .card-header strong {
        font-size: 0.82rem;
    }

    /* Botao "Mais trocas com..." truncado no mobile */
    .troca-btn-mais {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.72rem;
    }

    /* Badges de figurinhas menores nas trocas */
    .troca-card .card-body .badge {
        font-size: 0.68rem;
        padding: 0.18em 0.38em;
    }

    /* Secoes enviou/recebeu: labels menores */
    .troca-card .card-body p.small {
        font-size: 0.72rem;
    }

    /* Botoes de acao menores */
    .troca-card .btn-sm {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
    }

    /* === Pagina Dashboard: topo e stats responsivos === */

    .dash-titulo {
        font-size: 1.2rem;
    }

    /* Coluna de stats no progresso por selecao */
    .dash-stat-col {
        white-space: nowrap;
        font-size: 0.75rem;
    }

    .dash-stat-badge {
        font-size: 0.6em;
    }

    /* Display numbers menores no mobile */
    .display-4 {
        font-size: 1.8rem;
    }

    /* === Pagina Colecao: topo e cards responsivos === */

    .colecao-topo h2 {
        font-size: 1.2rem;
    }

    .colecao-card-header {
        padding: 0.5rem 0.75rem;
    }

    .colecao-card-header strong {
        font-size: 0.82rem;
    }

    .colecao-card-header small {
        font-size: 0.65rem;
    }

    /* Legenda e botoes da barra de filtro */
    .col-md-7 .ms-auto .btn-group-sm .btn {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
    }

    /* === Pagina Legends: topo e cards responsivos === */

    .legends-topo h2 {
        font-size: 1.2rem;
    }

    .legends-card-header {
        padding: 0.5rem 0.75rem;
    }

    .legends-card-header strong {
        font-size: 0.82rem;
    }

    /* Chips legend menores no mobile */
    .legend-chip {
        padding: 6px 10px;
        font-size: 0.78rem;
        min-width: 70px;
    }

    /* === Pagina Trocas (Central): topo e cards responsivos === */

    .trocas-titulo {
        font-size: 1.2rem;
    }

    .trocas-subtitulo {
        font-size: 1rem;
    }

    .trocas-card-header {
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }

    .trocas-card-header .btn-sm {
        font-size: 0.68rem;
        padding: 0.15rem 0.35rem;
    }

    .trocas-header-text {
        font-size: 0.78rem;
    }

    /* Barra de selecao sticky */
    #barraSelecao {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem !important;
    }

    #barraSelecao .btn-sm {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }

    /* Badges de figurinhas nos cards de troca */
    .troca-badge {
        font-size: 0.68rem;
        padding: 0.15em 0.35em;
    }

    /* Dica/info text no final */
    .alert.alert-info,
    .alert.alert-primary {
        font-size: 0.8rem;
    }

    /* === Pagina Indice: titulo responsivo === */

    .indice-titulo {
        font-size: 1.2rem;
    }

    /* Cards do indice mais compactos */
    .indice-card .card-body {
        padding: 0.35rem 0.5rem !important;
    }

    .indice-card .badge {
        min-width: 36px;
        font-size: 0.7rem;
    }

    .indice-card .fw-bold {
        font-size: 0.78rem !important;
    }

    .indice-card small {
        font-size: 0.65rem;
    }

    /* === Admin Faltantes: topo responsivo === */

    .admfalt-topo h2 {
        font-size: 1.2rem;
    }

    .admfalt-badge-top {
        font-size: 0.72rem !important;
        padding: 0.25em 0.5em;
    }

    .admfalt-topo-acoes .btn-sm {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
    }

    /* === Admin Comparar: titulo e cards responsivos === */

    .admcomp-titulo {
        font-size: 1.2rem;
    }

    .admcomp-versus {
        font-size: 0.9rem;
    }

    .admcomp-card-header {
        padding: 0.5rem 0.75rem;
        font-size: 0.82rem;
    }

    .admcomp-header-text {
        font-size: 0.78rem;
    }

    /* Badges de figurinhas menores no comparar */
    .comp-badge {
        font-size: 0.68rem;
        padding: 0.15em 0.35em;
    }
}

/* =============================================
   Busca unificada (Filtrar / Localizar)
   ============================================= */
.search-anchor-bar {
    position: sticky;
    top: 56px;
    z-index: 100;
}

/* Toggle de modo (Filtrar / Localizar) */
.search-mode-toggle {
    flex-shrink: 0;
}

.search-mode-toggle .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 0;
}

.search-mode-toggle .btn:first-child {
    border-top-left-radius: 0.25rem;
    border-bottom-left-radius: 0.25rem;
}

.search-mode-toggle .btn:last-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Highlight amarelo para todos os resultados (modo Localizar) */
.search-highlight {
    background: #fff3cd !important;
    outline: 2px solid #ffc107 !important;
    outline-offset: 1px;
    z-index: 1;
}

/* Foco azul para o resultado atual (modo Localizar) */
.search-focus {
    background: #cfe2ff !important;
    outline: 3px solid #0d6efd !important;
    outline-offset: 2px;
    box-shadow: 0 0 12px rgba(13, 110, 253, 0.5) !important;
    z-index: 2;
}

.search-nav-counter {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    min-width: 60px;
    text-align: center;
    color: #0d6efd;
    background: #e7f1ff;
}

.search-nav-btn {
    padding: 0.15rem 0.4rem;
}

.search-nav-btn i {
    font-size: 0.7rem;
}

@media (max-width: 768px) {
    .search-anchor-bar {
        top: 0;
    }
}

/* =============================================
   Indice alfabetico lateral (estilo contatos)
   ============================================= */
.alpha-index {
    position: fixed;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1020;
    padding: 4px 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.alpha-letter {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 18px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #198754;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.1s, background 0.1s;
    border-radius: 4px;
    line-height: 1;
}

.alpha-letter:hover {
    background: #198754;
    color: #fff;
}

.alpha-letter:active {
    background: #146c43;
    color: #fff;
}

.alpha-letter-disabled {
    color: #ccc;
    pointer-events: none;
    cursor: default;
}

.alpha-letter-disabled:hover {
    background: transparent;
    color: #ccc;
}

/* Tooltip central (aparece ao arrastar) */
.alpha-tooltip {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: rgba(25, 135, 84, 0.92);
    color: #fff;
    font-size: 1.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s, transform 0.12s;
}

.alpha-tooltip-visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Mobile: letras um pouco menores para caber tudo */
@media (max-width: 576px) {
    .alpha-index {
        right: 1px;
        padding: 2px 0;
    }

    .alpha-letter {
        width: 18px;
        height: 16px;
        font-size: 0.52rem;
    }

    .alpha-tooltip {
        width: 56px;
        height: 56px;
        font-size: 1.6rem;
    }
}
