:root {
    --primary-color: #ffd700;
    --secondary-color: #e30613;
    --bg-color: #0c0c0c;
    --card-bg: #161616;
    --card-hover: #222222;
    --card-selected: #2d2a1e;
    --border-color: #222222;
    --text-color: #ffffff;
    --text-muted: #888888;
    --panel-bg: #111111;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* BOTÓ DE MENÚ PER A MÒBILS */
.mobile-toggle-btn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: #000;
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    z-index: 10000;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* 1. SIDEBAR (FILTRES) */
.sidebar {
    width: 280px;
    background-color: #121212;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.logo-section {
    text-align: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--secondary-color);
}

.logo-section h1 {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.logo-section span {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-top: 5px;
}

.filter-group {
    margin-bottom: 18px;
}

.filter-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 6px;
}

.filter-input, .filter-select {
    width: 100%;
    padding: 10px;
    background-color: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.filter-input:focus, .filter-select:focus {
    border-color: var(--primary-color);
}

.btn-clear {
    background-color: #222;
    color: #fff;
    border: 1px solid #333;
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.75rem;
    margin-top: 10px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-clear:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #fff !important;
}

/* TOGGLE SWITCH */
.filter-video-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    background-color: #1a1a1a;
    border: 1px solid var(--border-color, #333);
    padding: 10px 14px;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 5px;
}

.toggle-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color, #fff);
    white-space: nowrap;
    margin: 0;
    line-height: 1;
}

.toggle-switch {
    position: relative;
    display: inline-block !important;
    width: 40px;
    height: 22px;
    margin: 0 !important;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #333;
    transition: 0.3s;
    border-radius: 22px;
    border: 1px solid #444;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #aaa;
    transition: 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-color, #f1c40f);
    border-color: var(--primary-color, #f1c40f);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
    background-color: #000;
}

/* 2. CONTENIDOR PRINCIPAL */
.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

/* 3. COLUMNA ESQUERRA (LLISTA) */
.matches-list-pane {
    width: 45%;
    min-width: 380px;
    max-width: 450px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
    transition: transform 0.3s ease;
}

.pane-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: #0e0e0e;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.pane-header span {
    color: var(--primary-color);
}

.matches-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.next-match-banner {
    background: linear-gradient(135deg, #1f1b04 0%, #161616 100%);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
}

.next-match-title {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.compact-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.compact-card:hover, .compact-card:focus {
    background-color: var(--card-hover);
    border-color: #444;
    outline: none;
}

.compact-card.selected {
    background-color: var(--card-selected);
    border-color: var(--primary-color);
}

.compact-card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.compact-teams-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
    gap: 8px;
}

.mini-escudo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    flex-shrink: 0;
}

.compact-score {
    color: var(--primary-color);
    font-size: 1.1rem;
    font-weight: 800;
    padding: 0 5px;
    text-align: center;
    min-width: 45px;
}

.compact-score.pending {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.compact-gols-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid #222;
    padding-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 4. COLUMNA DRETA (DETALLS) */
.details-pane {
    flex: 1;
    background-color: var(--panel-bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 30px;
    transition: transform 0.3s ease;
}

.back-to-list-btn {
    display: none;
    background-color: #222;
    color: var(--primary-color);
    border: 1px solid #333;
    padding: 10px;
    border-radius: 6px;
    font-weight: bold;
    margin-bottom: 15px;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.no-selection {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    gap: 15px;
}

.no-selection-icon {
    font-size: 3rem;
    color: #222;
}

.details-header {
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 20px;
    margin-bottom: 25px;
}

.details-competicio-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.badge {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-comp { background-color: #1a365d; color: #90cdf4; }
.badge-temp { background-color: #2d3748; color: #e2e8f0; }
.badge-jornada { background-color: #744210; color: #feebc8; }

.details-score-board {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #181818 0%, #0d0d0d 100%);
    padding: 20px 30px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    gap: 20px;
}

.details-team-container {
    display: flex;
    align-items: center;
    width: 40%;
    gap: 15px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.details-team-container:hover, .details-team-container:focus {
    opacity: 0.8;
    outline: none;
}

.details-team-container.local {
    justify-content: flex-start;
    text-align: left;
    flex-direction: row;
}

.details-team-container.visitante {
    justify-content: flex-end;
    text-align: right;
    flex-direction: row;
}

.details-team-name {
    font-size: 1.2rem;
    font-weight: 800;
    text-decoration: underline dashed rgba(255,255,255,0.2);
}

.details-team-container:hover .details-team-name {
    color: var(--primary-color);
    text-decoration: underline solid var(--primary-color);
}

.large-escudo {
    width: 45px;
    height: 45px;
    object-fit: contain;
    flex-shrink: 0;
}

.details-big-score {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-color);
    background-color: #000;
    padding: 5px 25px;
    border-radius: 8px;
    border: 1px solid #333;
    text-align: center;
    white-space: nowrap;
}

.details-big-score.pending {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.maldini-sheet {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.sheet-section {
    background-color: #161616;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px 20px;
}

.sheet-section-title {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 10px;
    border-bottom: 1px solid #222;
    padding-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 15px;
    font-size: 0.9rem;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-item span:first-child {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.meta-item span:last-child {
    font-weight: 600;
}

.split-events-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
    padding: 5px 0;
    min-height: 35px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.tags-container.align-local {
    justify-content: flex-start;
}

.tags-container.align-visitante {
    justify-content: flex-end;
}

.interactive-tag-group {
    display: inline-flex;
    align-items: center;
    background-color: #222;
    border: 1px solid #333;
    border-radius: 5px;
    overflow: hidden;
    transition: all 0.2s;
    max-width: 100%;
}

.clickable-video-group {
    cursor: pointer;
}

.clickable-video-group:hover, .clickable-video-group:focus {
    border-color: var(--primary-color) !important;
    background-color: #2a2a2a !important;
    outline: none;
}

.clickable-video-group:hover .interactive-tag {
    color: var(--primary-color) !important;
}

.deshabilitado-tag {
    cursor: default !important;
    opacity: 0.65;
}

.interactive-tag {
    color: #fff;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
    transition: all 0.2s;
    white-space: normal;
}

.clickable-player {
    cursor: pointer;
    text-decoration: underline dashed rgba(255,255,255,0.2);
}

.clickable-player:hover, .clickable-player:focus {
    color: var(--primary-color) !important;
    text-decoration: underline solid var(--primary-color);
    outline: none;
}

.video-trigger-btn {
    background: #2a2a2a;
    color: #fff;
    border: none;
    padding: 6px 10px;
    font-size: 0.8rem;
    border-left: 1px solid #333;
    height: 100%;
    transition: all 0.2s;
    cursor: pointer;
}

.video-trigger-btn:hover {
    background-color: var(--primary-color);
    color: #000;
}

.btn-play-large {
    background-color: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 15px;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    text-align: center;
    text-transform: uppercase;
    transition: all 0.2s;
    display: block;
    margin-top: auto;
    width: 100%;
}

.btn-play-large:hover {
    background-color: var(--primary-color);
    color: #000;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.2);
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 1rem;
}

/* MODALS RESPONSIVE */
.video-modal, .player-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

.player-modal {
    z-index: 10005;
    background-color: rgba(0, 0, 0, 0.85);
}

.video-container {
    width: 100%;
    max-width: 950px;
    background-color: #000;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.player-card-container {
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    background-color: #141414;
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    display: grid;
    grid-template-rows: auto 1fr;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}

video {
    width: 100%;
    display: block;
    max-height: 80vh;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    z-index: 10001;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover {
    color: var(--secondary-color);
}

/* ESTILS INTERIORS JUGADOR */
.player-card-header {
    background: linear-gradient(135deg, #1c1c1c 0%, #0a0a0a 100%);
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.player-card-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-color);
    text-transform: uppercase;
    padding-right: 30px;
}

.player-card-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 15px;
}

.player-mini-stat {
    background: rgba(255,255,255,0.03);
    border: 1px solid #222;
    padding: 8px 4px;
    border-radius: 6px;
    text-align: center;
}

.player-mini-stat .num {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    display: block;
}

.player-mini-stat .lbl {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-top: 2px;
}

.player-card-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    background-color: #111;
}

.player-history-title {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.player-history-item {
    background: #181818;
    border: 1px solid #222;
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    gap: 10px;
}

@media (max-width: 900px) {
    body {
        flex-direction: column;
        overflow: hidden;
        height: 100vh;
    }

    .mobile-toggle-btn {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 290px;
        height: 100vh;
        z-index: 10005;
        transform: translateX(-100%);
        box-shadow: 5px 0 25px rgba(0,0,0,0.8);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        width: 100vw;
        height: 100dvh;
        height: 100vh;
        position: relative;
        overflow: hidden;
    }

    .matches-list-pane {
        width: 100%;
        max-width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1;
        transform: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .matches-list-scroll {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 80px;
    }

    .details-pane {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 2;
        transform: translateX(100%); 
        padding: 15px;
        padding-bottom: 80px;
        background-color: var(--panel-bg);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .main-content.view-details .matches-list-pane {
        transform: translateX(-100%);
    }

    .main-content.view-details .details-pane {
        transform: translateX(0);
    }

    .back-to-list-btn {
        display: inline-block;
    }

    .details-score-board {
        padding: 15px 10px;
        gap: 8px;
    }

    .details-team-name {
        font-size: 0.95rem;
    }

    .large-escudo {
        width: 30px;
        height: 30px;
    }

    .details-big-score {
        font-size: 1.5rem;
        padding: 5px 12px;
    }

    .split-events-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .split-events-row > div {
        padding: 0 !important;
        border-right: none !important;
    }

    .tags-container.align-visitant {
        justify-content: flex-start;
    }

    .player-card-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .player-card-container {
        display: flex;
        flex-direction: column;
        margin-bottom: 20px;
    }

    .player-card-body {
        flex: 1 1 auto;
        overflow-y: auto;
        min-height: 0;
        padding-bottom: 20px;
    }
}