@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap');

/* Dark theme variables */
:root {
    --bg-color: #121212;
    --text-color: #ffffff;
    --card-bg: #1e1e1e;
    --card-header-bg: #2a2a2a;
    --border-color: #2a2a2a;
    --dropdown-bg: #2a2a2a;
    --dropdown-focus-bg: #3a3a3a;
}

/* Theme-based classes */
.theme-card {
    background-color: var(--card-bg);
}

.theme-card-header {
    background-color: var(--card-header-bg);
}

.theme-dropdown {
    background-color: var(--dropdown-bg);
    color: var(--text-color);
}

.theme-dropdown:focus {
    background-color: var(--dropdown-focus-bg);
}

/* Dark themed input used in manage-users invitations */
.theme-input {
    background-color: var(--dropdown-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.theme-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.theme-input:focus {
    outline: none;
    background-color: var(--dropdown-focus-bg);
    border-color: var(--dropdown-focus-bg);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Custom class for the "Watch live on" bar */
.watch-live-bar {
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
}

/* Style for active menu item */
.menu-item.active {
    background-color: #00b899;
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Expanded details section */
.expanded-details {
    display: none;
}

/* Connection status styles */
.connection-status {
    position: absolute;
    top: 10px;
    left: 20px;
    display: flex;
    align-items: center;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 20px;
    z-index: 10;
}

.connection-status.connected {
    background-color: rgba(0, 200, 0, 0.2);
    color: #00c800;
}

.connection-status.disconnected {
    background-color: rgba(255, 0, 0, 0.2);
    color: #ff0000;
}

.connection-status.connecting {
    background-color: rgba(255, 165, 0, 0.2);
    color: #ffa500;
}

/* Last data received styles */
.last-data-received {
    position: absolute;
    top: 10px;
    left: 24px;
    font-size: 12px;
    color: #888;
    visibility: hidden;
    z-index: 10;
}

/* Logo styles */
.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    margin-top: 20px;
}

.tv-icon {
    width: 300px;
    height: 200px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-body {
    width: 280px;
    height: 180px;
    background: linear-gradient(45deg, #000000 0%, #0a0a0a 30%, #1a1a1a 70%, #2a2a2a 100%);
    border-radius: 20px;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5),
    inset 0 2px 4px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    inset 2px 0 4px rgba(255, 255, 255, 0.2),
    inset -2px 0 4px rgba(0, 0, 0, 0.2);
}

.tv-screen {
    width: 240px;
    height: 140px;
    background: linear-gradient(45deg, #1a7373 0%, #008b8b 30%, #20b2aa 70%, #4dd0e1 100%);
    border-radius: 12px;
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    border: 3px solid #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 4px 4px 8px rgba(0, 0, 0, 0.8),
    inset -4px -4px 8px rgba(255, 255, 255, 0.1),
    inset 2px 2px 4px rgba(0, 0, 0, 0.9),
    inset -2px -2px 4px rgba(255, 255, 255, 0.15);
}

.tv-stand {
    width: 60px;
    height: 12px;
    background: linear-gradient(45deg, #000000, #0a0a0a, #1a1a1a, #2a2a2a);
    border-radius: 6px;
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5),
    inset 0 1px 2px rgba(255, 255, 255, 0.3),
    inset 0 -1px 2px rgba(0, 0, 0, 0.2);
}

.clutch-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #000000;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 700;
    text-transform: lowercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.clutch-badge.active {
    transform: scale(0.95);
}

.pulse-dot {
    width: 10px;
    height: 10px;
    background: #20b2aa;
    border-radius: 50%;
    animation: pulse-teal 1.5s infinite;
    box-shadow: 0 0 6px rgba(32, 178, 170, 0.6);
}

.clutch-badge.active .pulse-dot {
    background: #ff0000;
    box-shadow: 0 0 6px rgba(255, 0, 0, 0.6);
    animation: pulse-red 1.0s infinite;
}

/* Reusable red variant for pulse dot (for clutch games on cards) */
.pulse-dot.red {
    background: #ff0000;
    box-shadow: 0 0 6px rgba(255, 0, 0, 0.6);
    animation: pulse-red 1.0s infinite;
}

.badge-text {
    color: white;
    margin: 0;
}

/* Animation for the default teal pulse-dot */
@keyframes pulse-teal {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 6px rgba(32, 178, 170, 0.6);
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
        box-shadow: 0 0 12px rgba(32, 178, 170, 0.8);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 6px rgba(32, 178, 170, 0.6);
    }
}

/* Enhanced animation for the red pulse-dot when active */
@keyframes pulse-red {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 6px rgba(255, 0, 0, 0.6);
    }
    50% {
        transform: scale(1.2);
        opacity: 0.9;
        box-shadow: 0 0 12px rgba(255, 0, 0, 0.8);
    }
    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 6px rgba(255, 0, 0, 0.6);
    }
}

/* Active style for watch-live badge toggle */
#watchLiveBadge.active {
    box-shadow: 0 0 0 2px rgba(32, 178, 170, 0.9) inset, 0 0 8px rgba(32, 178, 170, 0.5);
}

/* Hide scrollbar in tabs row while preserving horizontal scroll */
.menu-options {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE 10+ */
}

.menu-options::-webkit-scrollbar {
    display: none; /* Chrome/Safari/WebKit */
}

/* ---- Match Details: Responsive tweaks and event styling ---- */
/* Squeeze top menu buttons on small screens and reduce spacing */
@media (max-width: 420px) {
    .menu-options {
        -webkit-overflow-scrolling: touch;
    }

    .menu-options .menu-item {
        font-size: 10px !important; /* smaller than Tailwind text-xs (12px) */
        padding: 2px 6px !important; /* tighter horizontal padding */
        margin-left: 2px !important; /* override Tailwind space-x-1 (4px) to 2px */
    }

    .menu-options .menu-item:first-child {
        margin-left: 0 !important;
    }
}

/* Event typography: player names at 10px */
.content-display .event-player {
    font-size: 10px; /* per requirement */
    font-weight: 700; /* keep bold for player names */
    line-height: 1.2;
}

/* Assist styling: white color, not bold */
.content-display .event-assist {
    font-size: 10px !important; /* match player names font size */
    line-height: 1.2;
    color: #ffffff !important; /* white */
    font-weight: 400 !important; /* not bold */
}

/* event-type line is no longer used but keep minimal style if present */
.content-display .event-type {
    display: none;
}

/* Reduce left/right padding of events container to ~4px while keeping vertical rhythm */
.content-display {
    padding-left: 4px !important;
    padding-right: 4px !important;
}

/* Event time centered column now auto width; keep small font via classes */
.content-display .event-time {
    width: auto !important;
    min-width: 0 !important;
}

.content-display .event-icon {
    margin-left: 4px !important;
    margin-right: 4px !important;
}

/* Slightly tighten event item horizontal padding */
.content-display .event-item {
    padding-left: 4px !important;
    padding-right: 4px !important;
}

/* Modal styles for Watch Live list */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    z-index: 51;
    width: 90%;
    max-width: 420px;
    border-radius: 0.75rem;
    padding: 1rem;
    background-color: var(--card-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: #ccc;
    font-size: 1.5rem;
    cursor: pointer;
}

body.modal-open {
    overflow: hidden;
}

/* Zebra striping for event rows */
.content-display .events-timeline .event-row {
    border-radius: 0;
    padding: 6px 6px;
}

.content-display .events-timeline .event-row:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.03); /* subtle dark */
}

.content-display .events-timeline .event-row:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.06); /* slightly brighter */
}


/* Streams modal styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: flex-start; /* place content near top with margin */
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 0;
}

/* Ensure page behind modal does not scroll */
.modal-open {
    overflow: hidden;
}

.modal-content {
    position: relative;
    margin: 64px 16px; /* top/bottom margin for tappable outside area */
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 128px); /* account for top/bottom margins */
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* clip inner scroll area corners */
    z-index: 1; /* above backdrop */
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 24px;
    line-height: 1;
    background: transparent;
    border: none;
    color: #cccccc;
    cursor: pointer;
}

.modal-close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 16px;
    overflow-y: auto; /* scroll list if too long */
    flex: 1; /* take remaining height within modal-content */
    min-height: 0; /* allow flex child to shrink for scrolling */
}


/* Desktop-only dark scrollbar styling for streams modal */
@media (hover: hover) and (pointer: fine) {
    /* Firefox */
    .modal-body {
        scrollbar-width: thin; /* auto | thin | none */
        scrollbar-color: #3a3a3a rgba(255, 255, 255, 0.06); /* thumb | track */
    }

    /* WebKit/Blink */
    .modal-body::-webkit-scrollbar {
        width: 10px;
    }

    .modal-body::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.06);
        border-radius: 8px;
    }

    .modal-body::-webkit-scrollbar-thumb {
        background-color: #3a3a3a; /* dark thumb */
        background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.2));
        border-radius: 8px;
        border: 2px solid transparent; /* creates padding for thumb */
        background-clip: padding-box;
    }

    .modal-body::-webkit-scrollbar-thumb:hover {
        background-color: #4a4a4a;
    }
}

/* ---- Lineups (Soccer field) ---- */
.lineups-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 480px) {
    .lineups-container {
        grid-template-columns: 1fr 1fr; /* home and away side by side on larger screens */
    }
}

.lineup-block {
}

.lineup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.lineup-team-name {
    font-weight: 700;
}

.lineup-formation {
    font-size: 12px;
    color: #9ca3af; /* gray-400 */
}

.soccer-field {
    position: relative;
    width: 100%;
    padding-top: 55%; /* make the field shorter (was 62.5%) */
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 0, rgba(0, 0, 0, 0.06) 1px, transparent 1px), #121212;
    background-size: 20% 100%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

.field-center-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
}

.field-goal {
    position: absolute;
    top: 50%;
    width: 3.5%;
    height: 18%;
    transform: translateY(-50%);
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3);
}

.field-goal-left {
    left: 0;
}

.field-goal-right {
    right: 0;
}

.field-center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18%;
    aspect-ratio: 1 / 1; /* ensures perfect circle regardless of field aspect */
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.player {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
}

.player-dot {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1px auto;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.player-dot.home {
    background: #1e90ff;
}

.player-dot.away {
    background: #ff6347;
}

.player-num {
    font-size: 12px;
    font-weight: 700;
    color: white;
    line-height: 1;
}

/* tiny card indicator */
.player-dot {
    position: relative;
}

.card-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 8px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.card-badge.yellow {
    background: #facc15; /* yellow-400 */
}

.card-badge.red {
    background: #dc2626; /* red-600 */
}

.player-name {
    font-size: 10px;
    color: white;
    max-width: 76px; /* slightly tighter to better fit last names on mobile */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Lineups (Soccer field) ---- */
.lineups-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 480px) {
    .lineups-container {
        grid-template-columns: 1fr 1fr; /* home and away side by side on larger screens */
    }
}

.lineup-block {
}

.lineup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.lineup-team-name {
    font-weight: 700;
}

.lineup-formation {
    font-size: 12px;
    color: #9ca3af; /* gray-400 */
}

.soccer-field {
    position: relative;
    width: 100%;
    padding-top: 55%; /* make the field shorter (was 62.5%) */
    background-size: 20% 100%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
}

.field-center-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
}

.field-goal {
    position: absolute;
    top: 50%;
    width: 3.5%;
    height: 18%;
    transform: translateY(-50%);
    border: 2px solid rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.3);
}

.field-goal-left {
    left: 0;
}

.field-goal-right {
    right: 0;
}

.field-center-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18%;
    aspect-ratio: 1 / 1; /* ensures perfect circle regardless of field aspect */
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
}

.player {
    position: absolute;
    transform: translate(-50%, -50%);
    text-align: center;
}

.player-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1px auto;
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.4);
}

.player-dot.home {
    background: #1e90ff;
}

.player-dot.away {
    background: #ff6347;
}

.player-num {
    font-size: 12px;
    font-weight: 700;
    color: white;
    line-height: 1;
}

/* tiny card indicator */
.player-dot {
    position: relative;
}

.card-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.35);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
}

.card-badge.yellow {
    background: #facc15; /* yellow-400 */
}

.card-badge.red {
    background: #dc2626; /* red-600 */
}

.player-name {
    font-size: 10px;
    color: white;
    max-width: 76px; /* slightly tighter to better fit last names on mobile */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* Mobile-specific tweaks: reduce player circle size to avoid overlap */
@media (max-width: 480px) {
    .player-dot {
        width: 20px;
        height: 20px;
    }

    .card-badge {
        top: -2px;
        right: -2px;
        width: 7px;
        height: 9px;
    }

    .player-name {
        font-size: 6px;
    }
}

/* Fine-tuning: bring card badges closer to the top-right corner and tighten name spacing */
.player-dot {
    margin: 0 auto 0 auto; /* reduce gap between circle and name */
}

.card-badge {
    top: -2px; /* was -3px */
    right: -2px; /* was -3px */
}

@media (max-width: 480px) {
    .card-badge {
        top: -3px; /* was -2px */
        right: -6px; /* was -2px */
    }
}


/* Mobile: zoom player photos inside circles a bit without changing circle size */
@media (max-width: 480px) {
    .player-dot[style*="background-image"] {
        background-size: 140% !important; /* slightly more zoomed than cover */
        background-position: center center !important;
        background-repeat: no-repeat !important;
    }
}


/* Tighten player name spacing under circle */
.player-name {
    margin-top: -6px;
}


/* === Generic Game Card styles === */
.game-card {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #3A3A3C;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  margin: 16px 0;
  color: #FFFFFF;
}

.game-card__header,
.game-card__footer {
  background-color: #2C2C2E; /* Header/Footer background */
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* When footer contains an expandable stats panel, stack toggle and panel vertically */
.game-card__footer.has-panel { flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 0; }

.game-card__body {
  background-color: #1E1E1E; /* Main section background */
  padding: 16px;
  border-top: 1px solid #3A3A3C;
  border-bottom: 1px solid #3A3A3C;
}

/* Typography helpers for header content created by gamecard.js */
.game-card__title { font-weight: 700; font-size: 1rem; line-height: 1.25rem; }
.game-card__subtitle { color: #CFD0D3; font-size: 0.875rem; line-height: 1.125rem; }
.game-card__meta { color: #A1A1A6; font-size: 0.75rem; margin-left: auto; }

/* Ensure images/icons in header/footer stay aligned */
.game-card__header img,
.game-card__footer img { height: 20px; width: 20px; object-fit: contain; }


/* === Game Card header enhancements === */
.game-card__header-left { display: flex; align-items: center; gap: 8px; }
.game-card__header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.game-card__league-icon { height: 20px; width: 20px; border-radius: 4px; background: #1E1E1E; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem; color: #CFD0D3; text-transform: uppercase; }
.game-card__league-icon.placeholder { border: 1px solid #3A3A3C; }
.game-card__league-name { font-weight: 600; font-size: 0.95rem; }
.game-card__icon-button { display: inline-flex; align-items: center; justify-content: center; height: 28px; width: 28px; border-radius: 6px; background: transparent; color: #CFD0D3; border: 1px solid transparent; cursor: pointer; transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease; }
.game-card__icon-button:hover { background: #1E1E1E; color: #FFFFFF; border-color: #3A3A3C; }
.gc-icon { height: 18px; width: 18px; }

/* === Expandable footer (Game Stats) === */
.game-card__footer-toggle { display: flex; align-items: center; justify-content: space-between; width: 100%; font-weight: 600; color: #E2E8F0; cursor: pointer; user-select: none; }
.game-card__chevron { margin-left: 8px; transition: transform 0.2s ease; }
.game-card__footer.is-expanded .game-card__chevron { transform: rotate(180deg); }

/* Collapsible stats panel with small animation */
.game-card__stats-panel { background-color: inherit; padding: 0; border-top: 0; }
.collapsible { max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.25s ease, opacity 0.25s ease, padding 0.25s ease; }
.collapsible.expanded { max-height: 500px; opacity: 1; padding: 12px 16px; }
/* Override padding and divider for game card stats panel so it aligns with footer padding and only shows divider when expanded */
.game-card__stats-panel.collapsible.expanded { padding: 12px 0 0 0; border-top: 1px solid #3A3A3C; }
