/* TRCodex E-Sport Management - Unified Sports Layout (v2) - Corrected Colors */
:root {
    --es-primary: #e31e24;
    /* Red - Official Primary */
    --es-primary-dark: #b91318;
    --es-secondary: #0f172a;
    /* Dark Navy - Official Secondary */
    --es-accent: #e31e24;
    /* Accent matches Primary Red */
    --es-white: #ffffff;
    --es-border: #e2e8f0;
    --es-text-main: #334155;
    --es-text-muted: #64748b;
    --es-light-bg: #f8fafc;
}

/* Base Wrapper */
.trcodex-es-wrapper {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--es-text-main);
}

/* Tabs Navigation - Standardized */
.trcodex-es-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
}

.trcodex-es-tab-btn {
    background: #f1f5f9;
    border: none;
    padding: 12px 24px;
    font-weight: 700;
    color: var(--es-text-muted);
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px;
    font-size: 14px;
    text-transform: uppercase;
}

.trcodex-es-tab-btn:hover {
    background: #e2e8f0;
    color: var(--es-secondary);
}

.trcodex-es-tab-btn.active {
    background: var(--es-primary);
    color: #fff;
    box-shadow: 0 4px 6px -1px rgba(227, 30, 36, 0.3);
}

/* Group Badges */
.trcodex-es-group-badges {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.trcodex-es-group-badge {
    background: #f8fafc;
    border: 1px solid var(--es-border);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.trcodex-es-group-badge.active {
    background: var(--es-primary);
    color: #fff;
    border-color: var(--es-primary);
}

/* Standings Table - Professional Grid */
.trcodex-es-standings-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.trcodex-es-standings-table thead {
    background: var(--es-secondary);
    color: #fff !important;
}

.trcodex-es-standings-table th {
    padding: 16px 12px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    text-align: center;
    color: #fff !important;
    /* Ensure white text on dark background */
}

.trcodex-es-standings-table th.team {
    text-align: left;
}

.trcodex-es-standings-table td {
    padding: 14px 12px;
    border-bottom: 1px solid var(--es-border);
    text-align: center;
    font-size: 14px;
    color: #1a1a1a;
}

.trcodex-es-standings-table td.team {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.trcodex-es-standings-table .pos {
    width: 40px;
    font-weight: 800;
    background: #f8fafc;
}

.trcodex-es-standings-table tr:hover {
    background: #f1f5f9;
}

/* Pos Ranking Styles */
.trcodex-es-standings-table tr:nth-child(1) .pos {
    color: var(--es-primary);
    border-left: 4px solid var(--es-primary);
}

.trcodex-es-standings-table tr:nth-child(2) .pos {
    color: var(--es-primary);
    border-left: 4px solid var(--es-primary);
}

/* Match Grid */
.trcodex-es-match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

.trcodex-es-match-card {
    background: #fff;
    border: 1px solid var(--es-border);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.trcodex-es-match-card .card-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 11px;
    font-weight: 800;
    color: var(--es-text-muted);
}

.trcodex-es-score-box {
    margin: 0 15px;
    padding: 5px 15px;
    background: var(--es-secondary);
    color: #fff;
    border-radius: 6px;
    font-weight: 800;
}

/* Team Grid / Cards */
.trcodex-es-teams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.trcodex-es-team-card {
    background: #fff;
    border: 1px solid var(--es-border);
    border-radius: 12px;
    padding: 25px 15px;
    text-align: center;
    transition: 0.3s;
    cursor: pointer;
}

.trcodex-es-team-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
    border-color: var(--es-primary);
}

.trcodex-es-team-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
}

.trcodex-es-team-card .name {
    font-weight: 800;
    font-size: 15px;
    color: var(--es-secondary);
}

/* Sidebar Mode (Score Ticker) */
.trcodex-es-ticker-outer {
    background: var(--es-secondary);
    padding: 10px 0;
    overflow: hidden;
    position: relative;
}

.trcodex-es-ticker-inner {
    display: inline-block;
    white-space: nowrap;
    animation: es-ticker-scroll 40s linear infinite;
}

.trcodex-es-ticker-item {
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 0 40px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block;
}

@keyframes es-ticker-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.trcodex-es-ticker-outer:hover .trcodex-es-ticker-inner {
    animation-play-state: paused;
}

/* Phygital Cards - Premium Grid */
.trcodex-es-phygital-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.trcodex-es-phygital-card {
    background: #fff;
    border: 1px solid var(--es-border);
    border-radius: 16px;
    overflow: hidden;
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.trcodex-es-phygital-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    border-color: var(--es-primary);
}

.trcodex-es-phygital-card .thumb {
    position: relative;
    height: 220px;
    overflow: hidden;
}

.trcodex-es-phygital-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.6s;
}

.trcodex-es-phygital-card:hover .thumb img {
    transform: scale(1.1);
}

.trcodex-es-phygital-card .card-body {
    padding: 24px;
}

.trcodex-es-phygital-card .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.trcodex-es-phygital-card .type-badge {
    background: var(--es-primary);
    color: #fff;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.trcodex-es-phygital-card .title {
    font-size: 18px;
    font-weight: 800;
    color: var(--es-secondary);
    margin-bottom: 15px;
    line-height: 1.4;
}

/* Organizations - List View */
.trcodex-es-org-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.trcodex-es-org-card {
    display: flex;
    background: #fff;
    border: 1px solid var(--es-border);
    border-radius: 12px;
    padding: 20px;
    align-items: center;
    gap: 25px;
    transition: 0.3s;
}

.trcodex-es-org-card:hover {
    border-color: var(--es-primary);
}

.trcodex-es-org-card .game-tag {
    color: var(--es-primary);
    font-weight: 800;
    font-size: 12px;
    text-transform: uppercase;
}

.trcodex-es-org-card .org-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--es-secondary);
    margin-bottom: 12px;
}

/* Modal Styles */
.trcodex-es-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}

.trcodex-es-modal-content {
    background: #fff;
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    position: relative;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: es-modal-in 0.3s ease-out;
}

@keyframes es-modal-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.trcodex-es-modal-close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--es-text-muted);
    transition: 0.2s;
}

.trcodex-es-modal-close:hover {
    color: var(--es-primary);
}

.trcodex-es-modal-body {
    text-align: center;
}

.trcodex-es-modal-body img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    margin-bottom: 20px;
}

.trcodex-es-modal-body h2 {
    color: var(--es-secondary);
    font-weight: 900;
    margin-bottom: 10px;
}

.trcodex-es-modal-body .team-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
    text-align: left;
}

.trcodex-es-modal-body .info-item {
    background: #f8fafc;
    padding: 15px;
    border-radius: 8px;
}

.trcodex-es-modal-body .info-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--es-text-muted);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.trcodex-es-modal-body .info-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--es-secondary);
}