:root {
    --bg-dark: #121212;
    /* Darker, close to black */
    --bg-card: #1e1e1e;
    /* Dark grey */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #ffffff;
    /* White accent for black/white theme */
    --accent-glow: rgba(255, 255, 255, 0.1);
    --border: #333333;
    --font-main: 'Outfit', sans-serif;
    --transition-speed: 0.3s;

    /* Position Colors */
    --pos-1: #ffd700;
    /* Gold */
    --pos-2: #c0c0c0;
    /* Silver */
    --pos-3: #cd7f32;
    /* Bronze */
    --pos-4: #38bdf8;
    /* Blue */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header & Nav */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.logo .highlight {
    color: var(--accent);
}

.main-nav {
    display: flex;
    gap: 20px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all var(--transition-speed);
}

.nav-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    color: var(--bg-dark);
    background-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Views */
.view-section {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 300;
    letter-spacing: -0.03em;
}

h2 {
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 20px;
    border-left: 3px solid var(--accent);
    padding-left: 10px;
}

/* Groups Grid */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.group-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
}

.group-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 800;
    color: var(--accent);
}

.group-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.group-table th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 400;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.group-table td {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-left: 8px;
}

.groupRow:hover {
    background-size: cover;
    background-image: var(--banner-url);
    animation: fadeInOpacity 0.35s ease-out;
}

@keyframes fadeInOpacity {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

.pos-1 .team-cell {
    border-left: 3px solid var(--pos-1);
    padding-left: 8px;
}

.pos-2 .team-cell {
    border-left: 3px solid var(--pos-2);
    padding-left: 8px;
}

.pos-3 .team-cell {
    border-left: 3px solid var(--pos-3);
    padding-left: 8px;
}

.pos-4 .team-cell {
    border-left: 3px solid var(--pos-4);
    padding-left: 8px;
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.team-flag-sm {
    width: 20px;
    height: 15px;
    background-color: #333;
    /* Placeholder */
    border-radius: 2px;
    object-fit: cover;
}

/* Fixtures Layout */
.fixtures-layout {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.ongoing-section {
    width: 100%;
}

/* Lower Third Graphic Style */
.match-graphic {
    width: 100%;
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    border: 1px solid var(--border);
    border-radius: 0;
    /* Broadcast style often sharp or slightly rounded */
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    height: 120px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.match-graphic::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.team-side {
    flex: 1;
    display: flex;
    align-items: center;
    height: 100%;
    position: relative;
    transition: all 0.3s;
}

.team-side.home {
    justify-content: flex-start;
    padding-left: 40px;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%);
}

.team-side.away {
    justify-content: flex-end;
    padding-right: 40px;
    background: linear-gradient(-90deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%);
}

.team-info {
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 2;
}

.team-side.away .team-info {
    flex-direction: row-reverse;
}

.team-name {
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* The Magic Image Container */
.team-asset-container {
    width: 80px;
    height: 80px;
    position: relative;
    cursor: pointer;
    perspective: 1000px;
}

.team-asset {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s;
    backface-visibility: hidden;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.team-asset.owner-photo {
    transform: rotateY(180deg);
    opacity: 0;
    border-radius: 0%;
    border: 0px solid var(--accent);
}

/* Hover effect to flip */
.team-asset-container:hover .team-logo {
    transform: rotateY(180deg);
    opacity: 0;
}

.team-asset-container:hover .team-asset.owner-photo {
    transform: rotateY(0deg);
    opacity: 1;
}

.score-board {
    background-color: #000;
    color: #fff;
    padding: 10px 30px;
    font-size: 2.5rem;
    font-weight: 800;
    font-family: monospace;
    /* Digital clock feel */
    border-radius: 4px;
    border: 1px solid var(--border);
    z-index: 10;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.match-time {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    background-color: rgba(15, 23, 42, 0.8);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Fixture Lists */
.fixtures-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.fixture-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fixture-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.fixture-card:hover {
    transform: translateX(5px);
    border-color: var(--accent);
}

.fixture-teams {
    display: flex;
    border-left: 3px solid var(--pos-4);
    padding-left: 8px;
}

.team-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.team-flag-sm {
    width: 20px;
    height: 15px;
    background-color: #333;
    /* Placeholder */
    border-radius: 2px;
    object-fit: cover;
}

/* Fixtures Layout */
.fixtures-layout {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.ongoing-section {
    width: 100%;
}

/* Lower Third Graphic Style */
.match-graphic {
    width: 100%;
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    border: 1px solid var(--border);
    border-radius: 0;
    /* Broadcast style often sharp or slightly rounded */
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    height: 120px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.match-graphic::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.team-side {
    flex: 1;
    display: flex;
    align-items: center;
    height: 100%;
    position: relative;
    transition: all 0.3s;
}

.team-side.home {
    justify-content: flex-start;
    padding-left: 40px;
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%);
}

.team-side.away {
    justify-content: flex-end;
    padding-right: 40px;
    background: linear-gradient(-90deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%);
}

.team-info {
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 2;
}

.team-side.away .team-info {
    flex-direction: row-reverse;
}

.team-name {
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* The Magic Image Container */
.team-asset-container {
    width: 80px;
    height: 80px;
    position: relative;
    cursor: pointer;
    perspective: 1000px;
}

.team-asset {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s;
    backface-visibility: hidden;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.team-asset.owner-photo {
    transform: rotateY(180deg);
    opacity: 0;
    border-radius: 0%;
    border: 0px solid var(--accent);
}

/* Hover effect to flip */
.team-asset-container:hover .team-logo {
    transform: rotateY(180deg);
    opacity: 0;
}

.team-asset-container:hover .team-asset.owner-photo {
    transform: rotateY(0deg);
    opacity: 1;
}

.score-board {
    background-color: #000;
    color: #fff;
    padding: 10px 30px;
    font-size: 2.5rem;
    font-weight: 800;
    font-family: monospace;
    /* Digital clock feel */
    border-radius: 4px;
    border: 1px solid var(--border);
    z-index: 10;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.match-time {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    background-color: rgba(15, 23, 42, 0.8);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Fixture Lists */
.fixtures-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.fixture-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fixture-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.fixture-card:hover {
    transform: translateX(5px);
    border-color: var(--accent);
}

.fixture-teams {
    flex-direction: column;
    gap: 5px;
    font-weight: 600;
}

.fixture-meta {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.fixture-score {
    font-weight: 800;
    color: var(--accent);
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .fixtures-lists {
        grid-template-columns: 1fr;
    }

    .match-graphic {
        height: auto;
        flex-direction: column;
        padding: 20px 0;
        gap: 15px;
    }

    .team-side {
        width: 100%;
        justify-content: center !important;
        padding: 0 !important;
        background: none !important;
    }

    .team-info {
        flex-direction: column;
        text-align: center;
    }

    .score-board {
        margin: 10px 0;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-card);
    margin: 0;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: var(--text-secondary);
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--accent);
    text-decoration: none;
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
    left: 0;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s;
    backface-visibility: hidden;
    border-radius: 50%;
    border: 2px solid var(--accent);
}

.team-asset.owner-photo {
    transform: rotateY(180deg);
    opacity: 0;
    border-radius: 0%;
    border: 0px solid var(--accent);
}

/* Hover effect to flip */
.team-asset-container:hover .team-logo {
    transform: rotateY(180deg);
    opacity: 0;
}

.team-asset-container:hover .team-asset.owner-photo {
    transform: rotateY(0deg);
    opacity: 1;
}

.score-board {
    background-color: #000;
    color: #fff;
    padding: 10px 30px;
    font-size: 2.5rem;
    font-weight: 800;
    font-family: monospace;
    /* Digital clock feel */
    border-radius: 4px;
    border: 1px solid var(--border);
    z-index: 10;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.match-time {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    background-color: rgba(15, 23, 42, 0.8);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Fixture Lists */
.fixtures-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.fixture-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.fixture-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: transform 0.2s;
}

.fixture-card:hover {
    transform: translateX(5px);
    border-color: var(--accent);
}

.fixture-teams {
    flex-direction: column;
    gap: 5px;
    font-weight: 600;
}

.fixture-meta {
    text-align: right;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.fixture-score {
    font-weight: 800;
    color: var(--accent);
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .fixtures-lists {
        grid-template-columns: 1fr;
    }

    .match-graphic {
        height: auto;
        flex-direction: column;
        padding: 20px 0;
        gap: 15px;
    }

    .team-side {
        width: 100%;
        justify-content: center !important;
        padding: 0 !important;
        background: none !important;
    }

    .team-info {
        flex-direction: column;
        text-align: center;
    }

    .score-board {
        margin: 10px 0;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-card);
    margin: 0;
    padding: 30px;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    color: var(--text-secondary);
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--accent);
    text-decoration: none;
}

.modal-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
    flex-shrink: 0;
}

#modal-title {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 5px;
    border: none;
    padding: 0;
}

.modal-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Timeline Styles */
.timeline-container {
    position: relative;
    padding: 10px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex-grow: 1;
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.timeline-container::-webkit-scrollbar {
    width: 6px;
}

.timeline-container::-webkit-scrollbar-track {
    background: var(--bg-card);
}

.timeline-container::-webkit-scrollbar-thumb {
    background-color: var(--accent);
    border-radius: 10px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 10px;
    bottom: 0;
    min-height: 100%;
    width: 2px;
    background: var(--border);
    transform: translateX(-50%);
}

.event-item {
    position: relative;
    display: flex;
    width: 100%;
    align-items: center;
}

.event-content {
    width: 45%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: transform 0.2s;
}

.event-content:hover {
    transform: scale(1.02);
    background: rgba(255, 255, 255, 0.05);
}

.event-home {
    justify-content: flex-start;
}

.event-home .event-content {
    margin-right: auto;
    flex-direction: row-reverse;
    text-align: right;
}

.event-away {
    justify-content: flex-end;
}

.event-away .event-content {
    margin-left: auto;
    flex-direction: row;
    text-align: left;
}

.event-min {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 2px solid var(--accent);
    color: var(--accent);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    z-index: 2;
}

.event-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.event-player {
    font-weight: 600;
    font-size: 0.9rem;
}

.timeline-final-score {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    background-color: var(--bg-card);
    position: relative;
    z-index: 2;
    width: 100%;
}

.final-score-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 5px;
}

.final-score-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}