/* ============================================================
   suSync Widgets — Shared Team Card Structure
   ============================================================ */

/* --- Grid --- */
.susync-next-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Team Card --- */
.susync-team-card {
    background: #fff;
    border-radius: 8px;
    padding: 16px 18px;
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.2s ease;
}
.susync-team-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* --- Header: Datum – Team – Liga auf einer Zeile --- */
.susync-team-card-header {
    display: flex;
    align-items: baseline;
    gap: 0;
    flex-wrap: wrap;
}

.susync-team-card-date {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

.susync-team-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
}

.susync-team-card-league {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
}

.susync-team-card-header > span + span::before {
    content: '–';
    margin: 0 6px;
    color: #d1d5db;
    font-weight: 400;
}

/* --- Austragungsort mit Maps-Link --- */
.susync-team-card-venue {
    margin-top: 2px;
    font-size: 12px;
}

.susync-team-card-venue a {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.15s ease;
}

.susync-team-card-venue a:hover {
    color: #6b7280;
    text-decoration: underline;
}

/* --- Spiele --- */
.susync-team-card-games {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 12px;
}

.susync-next-game-row {
    padding: 8px 0;
}

.susync-next-game-row + .susync-next-game-row {
    border-top: 1px solid #f3f4f6;
}

.susync-next-game-comp {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 2px;
}

.susync-next-game-time {
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    text-align: center;
    margin-bottom: 2px;
}

/* --- Matchup-Zeile: Logo – Team – Score/vs – Team – Logo --- */
.susync-next-game-matchup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.susync-next-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

.susync-next-logo-placeholder {
    display: inline-block;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.susync-next-team {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.susync-next-home {
    text-align: right;
}

.susync-next-away {
    text-align: left;
}

/* --- vs (Nächste Spiele) --- */
.susync-next-vs {
    font-size: 14px;
    font-weight: 700;
    color: #d1d5db;
    font-style: italic;
    flex-shrink: 0;
}

/* --- Score (Resultate) --- */
.susync-result-score {
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    color: #111827;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.susync-result-note {
    font-size: 9px;
    color: #9ca3af;
    flex-shrink: 0;
    white-space: nowrap;
}

/* --- Abweichender Ort pro Spiel --- */
.susync-next-game-meta {
    font-size: 11px;
    color: #9ca3af;
    text-align: center;
    margin-top: 2px;
}

/* ============================================================
   Alle Spiele — Einzeilige Liste in Card (CSS Grid)
   ============================================================ */

.susync-allgames-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 16px;
    transition: box-shadow 0.2s ease;
}

.susync-allgames-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Zeile = CSS Grid: Datum | Logo | Team | Score */
.susync-ag-row {
    display: grid;
    grid-template-columns: auto 32px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.susync-ag-row + .susync-ag-row {
    border-top: 1px solid #f3f4f6;
}

/* Spalte 1: Datum + Zeit */
.susync-ag-col-date {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}

.susync-ag-date {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
}

.susync-ag-time {
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    opacity: 0.75;
}

/* Spalte 2: Logo (fixe Breite, zentriert) */
.susync-ag-col-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.susync-ag-logo {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

/* Spalte 3: Gegner + H/A */
.susync-ag-col-team {
    display: flex;
    align-items: baseline;
    gap: 5px;
    min-width: 0;
}

.susync-ag-opponent {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.susync-ag-ha {
    font-size: 10px;
    font-weight: 600;
    color: #1f2937;
    opacity: 0.3;
    flex-shrink: 0;
}

/* Spalte 4: Score rechts */
.susync-ag-col-score {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.susync-ag-score {
    font-size: 16px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.susync-ag-note {
    font-size: 9px;
    color: #9ca3af;
    opacity: 0.5;
}

/* ============================================================
   Tabelle / Rankings
   ============================================================ */

.susync-rank-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.susync-rank-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Grid: # | Logo | S | SV | NV | N | +/- | P */
.susync-rank-header,
.susync-rank-row {
    display: grid;
    grid-template-columns: 28px 34px repeat(4, 1fr) 48px 36px;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
}

.susync-rank-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 4px;
    margin-bottom: 2px;
}

.susync-rank-row {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.susync-rank-row:hover {
    background: #f3f4f6;
}

.susync-rank-row + .susync-rank-row {
    border-top: 1px solid #f3f4f6;
}

.susync-rank-row.is-own {
    background: #fef3c7;
}

.susync-rank-row.is-own:hover {
    background: #fde68a;
}

/* Spalten */
.susync-rank-col-rg {
    text-align: center;
    font-weight: 800;
    font-size: 13px;
}

.susync-rank-col-logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.susync-rank-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.susync-rank-col-stats {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.susync-rank-col-diff {
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.susync-rank-col-pts {
    text-align: center;
    font-weight: 800;
    font-size: 15px;
    color: #111827;
}

/* --- Popup / Overlay --- */
.susync-rank-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.susync-rank-popup {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    width: 100%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: susync-popup-in 0.2s ease;
}

@keyframes susync-popup-in {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.susync-rank-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.susync-rank-popup-close:hover {
    color: #1f2937;
}

.susync-rank-popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.susync-rank-popup-logo {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.susync-rank-popup-team {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.susync-rank-popup-table {
    width: 100%;
    border-collapse: collapse;
}

.susync-rank-popup-table td {
    padding: 6px 0;
    font-size: 13px;
    border-top: 1px solid #f3f4f6;
}

.susync-rank-popup-table tr:first-child td {
    border-top: none;
}

.susync-rank-popup-table td:first-child {
    color: #6b7280;
    font-weight: 400;
}

.susync-rank-popup-table td:last-child {
    text-align: right;
    font-weight: 700;
    color: #1f2937;
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .susync-team-card {
        padding: 12px 14px;
    }

    .susync-team-card-header {
        flex-direction: column;
        gap: 0;
    }

    .susync-team-card-header > span + span::before {
        display: none;
    }

    .susync-next-game-matchup {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }

    .susync-next-team {
        flex: 1 1 100%;
        text-align: center !important;
        font-size: 13px;
    }

    .susync-next-vs,
    .susync-result-score {
        width: 100%;
        text-align: center;
    }

    .susync-next-logo,
    .susync-next-logo-placeholder {
        display: none;
    }

    /* Alle Spiele */
    .susync-allgames-card {
        padding: 10px 12px;
    }

    .susync-ag-row {
        grid-template-columns: auto 24px 1fr auto;
        gap: 6px;
        padding: 6px 0;
    }

    .susync-ag-col-logo {
        width: 24px;
        height: 24px;
    }

    .susync-ag-logo {
        width: 22px;
        height: 22px;
    }

    .susync-ag-date {
        font-size: 11px;
    }

    .susync-ag-time {
        font-size: 10px;
    }

    .susync-ag-opponent {
        font-size: 12px;
    }

    .susync-ag-score {
        font-size: 14px;
    }

    /* Tabelle */
    .susync-rank-card {
        padding: 8px;
    }

    .susync-rank-header,
    .susync-rank-row {
        grid-template-columns: 22px 28px repeat(4, 1fr) 38px 30px;
        gap: 1px;
        padding: 5px 2px;
    }

    .susync-rank-header {
        font-size: 10px;
    }

    .susync-rank-row {
        font-size: 12px;
    }

    .susync-rank-logo {
        width: 22px;
        height: 22px;
    }

    .susync-rank-col-pts {
        font-size: 13px;
    }

    .susync-rank-popup {
        padding: 18px;
        max-width: 300px;
    }
}
