/* Cards (Sofascore Style: Simple, flat, light border) */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.card-title {
    font-size: var(--fs-md);
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.card-desc {
    color: var(--text-secondary);
    font-size: var(--fs-sm);
    margin-bottom: 10px;
    line-height: 1.3;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: var(--fs-xs);
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1;
}

.badge-primary { background: var(--primary-glow); color: var(--primary); border: 1px solid var(--primary); }
.badge-secondary { background: var(--secondary-glow); color: var(--secondary); border: 1px solid var(--secondary); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }

/* Tables (Highly Dense Classifica) */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    font-size: var(--fs-sm);
}

th {
    background-color: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

.table-standings {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
}

/* Custom styling for standings table to prevent overflow */
.table-standings th,
.table-standings td {
    padding: 6px 4px;
    font-size: 11px;
}

.team-name-cell {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    vertical-align: middle;
}

@media (max-width: 380px) {
    .table-standings th,
    .table-standings td {
        padding: 6px 3px;
        font-size: 10.5px;
    }
}

@media (max-width: 340px) {
    .table-standings th,
    .table-standings td {
        padding: 5px 2px;
        font-size: 10px;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: var(--fs-sm);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background: var(--primary);
    color: var(--text-primary);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-primary);
}

/* Form Elements */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    margin-bottom: 4px;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* Submenu / Tabs Navigation */
.submenu {
    display: flex;
    gap: 2px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0;
    margin-bottom: 12px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
}

.submenu::-webkit-scrollbar {
    height: 3px;
}

.submenu-item {
    text-decoration: none;
    padding: 8px 12px;
    font-weight: 600;
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.submenu-item:hover {
    color: var(--text-primary);
}

.submenu-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* --- SOFASCORE MATCH LIST GROUPS --- */
.match-list-group {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 10px;
    box-shadow: var(--shadow-sm);
}

.match-list-header {
    background-color: rgba(255, 255, 255, 0.02);
    padding: 6px 10px;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.match-list-header a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 10px;
}

.match-list-header a:hover {
    color: var(--text-secondary);
}

/* --- SOFASCORE COMPACT MATCH ROW --- */
.match-row {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-top: 1px solid var(--border-color);
    text-decoration: none;
    color: inherit;
    transition: var(--transition-fast);
}

.match-row:first-child,
.match-list-header + .match-row {
    border-top: none;
}

.match-row:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

.match-status {
    width: 48px;
    min-width: 48px;
    text-align: center;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-muted);
    border-right: 1px solid var(--border-color);
    padding-right: 8px;
    margin-right: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    line-height: 1.1;
}

.match-status.live {
    color: var(--danger);
    animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
    0% { opacity: 1; }
    50% { opacity: 0.4; }
    100% { opacity: 1; }
}

.match-teams {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow: hidden;
}

.team-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--fs-md);
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-row.winner {
    color: var(--text-primary);
    font-weight: 600;
}

.team-logo-small {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.match-scores {
    width: 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    font-size: var(--fs-md);
    font-weight: 700;
}

.score-row {
    color: var(--text-muted);
    height: 18px;
    display: flex;
    align-items: center;
}

.score-row.winner {
    color: var(--text-primary);
    font-weight: 700;
}

/* Knockout Bracket Visuals (Super Compact for Mobile) */
.bracket-wrapper {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 6px 0;
    -webkit-overflow-scrolling: touch;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 160px;
    width: 160px;
}

.bracket-round-title {
    text-align: center;
    font-size: var(--fs-xs);
    font-weight: 700;
    color: var(--secondary);
    text-transform: uppercase;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.bracket-match {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: var(--shadow-sm);
}

.bracket-team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--fs-xs);
    padding: 2px 4px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.bracket-team.winner {
    font-weight: 700;
    color: var(--text-primary);
    background: var(--success-bg);
}

.bracket-team .team-score {
    font-weight: 700;
}

.bracket-match-info {
    font-size: 9px;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    padding-top: 2px;
    margin-top: 2px;
}

/* Team Stats Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px 4px;
    text-align: center;
}

.stat-card-title {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
}

.stat-card-value {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

.stat-card-value.highlight {
    color: var(--secondary);
}

/* --- LOGO & HERO BANNER ANIMATIONS --- */

/* Hero Banner Logo floating */
@keyframes float-hero {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-6px) rotate(2.5deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

/* Header brand logo hover rotate effect */
.nav-brand:hover .header-logo-svg {
    transform: rotate(360deg) scale(1.1);
}

/* Navbar brand text hover transitions */
.nav-brand:hover .nav-brand-text {
    color: var(--secondary) !important;
}

/* Make sure container content stays above background particles */
.container {
    position: relative;
    z-index: 10;
}

/* Dynamic shield badges styling */
.team-shield-small {
    width: 14px;
    height: 16px;
    border-radius: 0 0 6px 6px;
    border: 1px solid rgba(255,255,255,0.25);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 7px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 1.5px rgba(0,0,0,0.9);
    flex-shrink: 0;
    overflow: hidden;
    line-height: 1;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
    vertical-align: middle;
}

.team-shield-medium {
    width: 28px;
    height: 32px;
    border-radius: 0 0 10px 10px;
    border: 1.5px solid rgba(255,255,255,0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.25);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
    flex-shrink: 0;
    overflow: hidden;
    line-height: 1;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
}

.team-shield-large {
    width: 44px;
    height: 50px;
    border-radius: 0 0 18px 18px;
    border: 2px solid rgba(255,255,255,0.3);
    box-shadow: 0 3px 6px rgba(0,0,0,0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 1.5px 3px rgba(0,0,0,0.95);
    flex-shrink: 0;
    overflow: hidden;
    line-height: 1;
    text-transform: uppercase;
    font-family: 'Outfit', sans-serif;
}

/* Contrast helper classes for team shields with light backgrounds */
.team-shield-char-dark {
    color: #120e0f !important;
    text-shadow: none !important;
}

.team-shield-char-light {
    color: #ffffff !important;
}

.team-shield-light-bg {
    border-color: rgba(0, 0, 0, 0.15) !important;
}

/* --- SPONSOR LOGO TICKER BANNER --- */

.logo-ticker-banner {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    height: 52px;
    background: #ffffff; /* Solid white background to blend PNG white backgrounds */
    border-top: 1px solid rgba(0, 0, 0, 0.12); /* Subtle dark border for contrast on light background */
    border-left: 1px solid rgba(0, 0, 0, 0.12);
    border-right: 1px solid rgba(0, 0, 0, 0.12);
    display: flex;
    align-items: center;
    overflow: hidden;
    z-index: 999;
    box-sizing: border-box;
}

.logo-ticker-track {
    display: flex;
    width: max-content;
    animation: logo-ticker 30s linear infinite; /* Very slow and smooth ribbon */
}

/* Pause animation on hover to allow users to inspect/interact with a sponsor logo */
.logo-ticker-track:hover {
    animation-play-state: paused;
}

.logo-ticker-list {
    display: flex;
    align-items: center;
    gap: 36px;
    padding-right: 36px;
}

.ticker-image-wrapper {
    height: 22px; /* Balanced height for mobile screens */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Ensures dimensions are strictly respected */
}

@media (min-width: 480px) {
    .ticker-image-wrapper {
        height: 28px;
    }
}

.logo-ticker-list img {
    display: block;
    height: 100%;
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply; /* Blends away solid white backgrounds of images */
    transition: transform var(--transition-normal);
}

.logo-ticker-list img:hover {
    transform: scale(1.08);
}

/* Push the body up to make room for the fixed banner so footer content isn't obscured */
body:has(.logo-ticker-banner) {
    padding-bottom: 52px;
}

@keyframes logo-ticker {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

/* ==========================================================================
   Graphical Tournament Bracket (Tabellone Fase Finale)
   ========================================================================== */

.bracket-container {
    width: 100%;
    padding: 16px 12px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.bracket-header-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px dashed var(--border-color);
}

.bracket-title {
    font-size: var(--fs-md);
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.bracket-tree-wrapper {
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    gap: 32px;
    min-width: 720px; /* Ensures horizontal scrollability on narrow mobile screens */
    padding: 10px 4px;
}

.bracket-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    min-width: 210px;
}

.bracket-round-header {
    text-align: center;
    font-size: var(--fs-xs);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: rgba(60, 114, 230, 0.08);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid rgba(60, 114, 230, 0.15);
}

.bracket-matches-list {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
    gap: 24px;
}

/* Bracket Match Card */
.bracket-node {
    background: var(--bg-surface, #ffffff);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.bracket-node:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(60, 114, 230, 0.15);
}

.bracket-node.live-match {
    border-color: #dc3545;
    box-shadow: 0 0 12px rgba(220, 53, 69, 0.2);
}

.bracket-node-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    padding-bottom: 4px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.bracket-node-time {
    font-weight: 700;
    color: var(--text-secondary);
}

.bracket-node-live-badge {
    color: #dc3545;
    font-weight: 800;
    animation: blink-live 1.2s infinite;
}

.bracket-node-team {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease;
}

.bracket-node-team.winner {
    background: rgba(40, 167, 69, 0.1);
    font-weight: 800;
}

.bracket-node-team-info {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: var(--fs-xs);
    font-weight: 600;
    color: var(--text-primary);
}

.bracket-node-team-info.tbd-team {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 500;
}

.bracket-node-score {
    font-size: var(--fs-xs);
    font-weight: 800;
    color: var(--text-primary);
    min-width: 16px;
    text-align: right;
}

.bracket-node-team.winner .bracket-node-score {
    color: var(--success, #28a745);
}

/* ==========================================================================
   Poster Diagram Bracket (Visual Image-Style Bracket)
   ========================================================================== */

.sf-bracket-card {
    background: radial-gradient(circle at top center, #1e1115 0%, #0d0e12 100%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(225, 29, 72, 0.25);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    padding: 24px 16px;
    color: #ffffff;
    overflow: hidden;
    position: relative;
}

.sf-bracket-header {
    text-align: center;
    margin-bottom: 24px;
}

.sf-bracket-subtitle {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #e11d48;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.sf-bracket-title {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 1px;
    color: #ffffff;
    text-transform: uppercase;
    text-shadow: 0 0 15px rgba(225, 29, 72, 0.4);
    margin: 0;
}

.sf-bracket-diagram {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    max-width: 540px;
    margin: 0 auto;
}

.sf-bracket-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sf-bracket-pair {
    display: grid;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
    width: 100%;
}

.sf-match-box {
    background: rgba(22, 24, 34, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.sf-match-box:hover {
    border-color: #e11d48;
    background: rgba(225, 29, 72, 0.12);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25);
}

.sf-match-date {
    font-size: 11px;
    font-weight: 700;
    color: #e11d48;
    text-align: center;
    margin-bottom: 6px;
}

.sf-match-team {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #e2e8f0;
}

.sf-match-team.winner {
    background: rgba(225, 29, 72, 0.25);
    color: #ffffff;
}

.sf-match-team-name {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.sf-match-score {
    font-size: 13px;
    font-weight: 900;
    color: #ffffff;
    min-width: 18px;
    text-align: right;
}

.sf-stage-badge {
    text-align: center;
    padding: 4px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 2px 0;
}

.sf-stage-name {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #ffffff;
    text-transform: uppercase;
    background: #e11d48;
    padding: 3px 14px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(225, 29, 72, 0.4);
}

.sf-stage-name.finale {
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    padding: 4px 18px;
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.5);
}

.sf-connector-v {
    width: 2px;
    height: 16px;
    background: #e11d48;
    margin: 0 auto;
    box-shadow: 0 0 6px #e11d48;
}




