/* DATABASE V2 - STRICTLY MATCHING TOURNAMENT V2 / MYCLUB V2 */

/* Compat: database.js scrive alcuni colori inline usando le
   variabili del vecchio styles.css, qui rimappate sui valori v2 */
:root {
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);
}

.main-content {
    position: relative;
    z-index: 10;
    padding-top: 120px;
    padding-bottom: 60px;
}

/* La navbar e' flottante e cambia altezza al restringersi:
   finisce a 96px su desktop, 114px intorno ai 1024px e 132px
   sotto i 600px (logo + hamburger). Il padding segue quelle misure,
   altrimenti il titolo finisce sotto la navbar. */
@media (max-width: 1100px) {
    .main-content { padding-top: 140px; }
}
@media (max-width: 600px) {
    .main-content { padding-top: 155px; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

/* ============================================
   INTESTAZIONE PAGINA
   ============================================ */
.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-title {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: white;
    letter-spacing: -1px;
}

.page-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.6);
}

/* ============================================
   FILTRI
   ============================================ */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.filter-input,
.filter-select {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
}

.filter-input {
    flex: 1;
    min-width: 220px;
}
.filter-input::placeholder { color: rgba(255, 255, 255, 0.4); }

.filter-select { cursor: pointer; }

.filter-input:focus,
.filter-select:focus {
    border-color: rgba(139, 92, 246, 0.5);
}

.filter-select option,
.filter-select optgroup {
    background: #0a0b10;
    color: white;
}

/* ============================================
   TABELLA CARTE
   ============================================ */
.card-list-wrapper {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 20px 12px;
    overflow-x: auto;
    transition: all 0.3s ease;
}
.card-list-wrapper:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.card-list-table {
    width: 100%;
    border-collapse: collapse;
}

.card-list-table th {
    padding: 15px 8px;
    text-align: left;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.card-list-table td {
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    font-weight: 600;
    font-size: 1rem;
    vertical-align: middle;
    color: white;
}

.card-list-table tbody tr {
    transition: background 0.3s ease;
}
.card-list-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* colonna immagine: database.js imposta width:40px inline */
.card-list-table td img {
    border-radius: 6px;
    display: block;
}

.td-club,
.td-nation {
    white-space: nowrap;
}

/* Ruolo principale + ruoli alternativi */
.position-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: white;
    min-width: 42px;
    text-align: center;
}

.altpos-text {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================
   LOAD MORE
   ============================================ */
.load-more-bar {
    text-align: center;
    margin-top: 30px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #8b5cf6;
    color: white;
    padding: 12px 24px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-primary:hover:not(:disabled) {
    background: #7c3aed;
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.database-stats {
    color: rgba(255, 255, 255, 0.4);
    margin-top: 14px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============================================
   STATI
   ============================================ */
.loading-state,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255, 255, 255, 0.4);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loading-spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================
   MODALE LOGIN (auth.js)
   ============================================ */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.modal.show,
.modal.active { display: flex; }

.modal-content {
    position: relative;
    background: #0a0b10;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    padding: 40px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}
.modal-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}
.modal-close:hover { color: white; }

.discord-login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}
.discord-login-text { color: rgba(255, 255, 255, 0.6); }

.btn-discord {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    background: #5865F2;
    color: white;
    padding: 14px 24px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-discord:hover { background: #4752c4; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    padding: 12px 24px;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

/* Utilities */
.admin-only { display: none; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .filters-bar { flex-direction: column; }
    .filter-input, .filter-select { width: 100%; }

    .card-list-wrapper { padding: 10px; }
    .card-list-table th,
    .card-list-table td { padding: 10px 6px; font-size: 0.85rem; }
    .th-club, .td-club,
    .th-nation, .td-nation { display: none; }

    .modal-content { padding: 24px; }
}
