/* =========================================
   RESET & BASE STYLES
   ========================================= */
.wc2026-sim * {
    box-sizing: border-box;
}

.wc2026-sim {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    color: #333;
    line-height: 1.5;
}

.wc2026-sim h2 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 30px;
    color: #1a1a2e;
    font-weight: 800;
}

.wc2026-sim h3 {
    color: #1a1a2e;
    font-weight: 700;
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    text-align: center;
}

/* =========================================
   LOADING & MESSAGES
   ========================================= */
.wc2026-loading {
    text-align: center;
    padding: 60px;
    font-size: 1.2em;
    color: #666;
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.wc2026-msg {
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 25px;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.wc2026-msg.success {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.wc2026-msg.error {
    background: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

/* =========================================
   ACTION BUTTONS
   ========================================= */
.wc2026-actions {
    text-align: center;
    margin: 30px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.sticky-actions {
    position: sticky;
    top: 20px;
}

.wc2026-divider {
    width: 1px;
    background: #dee2e6;
    margin: 0 10px;
}

.wc2026-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all .2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wc2026-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.wc2026-btn:active {
    transform: translateY(0);
}

.wc2026-btn-primary {
    background: #0d6efd;
    color: #fff !important;
}

.wc2026-btn-secondary {
    background: #6c757d;
    color: #fff !important;
}

.wc2026-btn-success {
    background: #198754;
    color: #fff !important;
}

.wc2026-btn-warning {
    background: #ffc107;
    color: #000 !important;
}

.wc2026-btn-danger {
    background: #dc3545;
    color: #fff !important;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(13, 110, 253, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(13, 110, 253, 0);
    }
}

.pulse-animation {
    animation: pulse 2s infinite;
}

/* =========================================
   GROUPS GRID
   ========================================= */
.wc2026-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}

.wc2026-group {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}

.wc2026-group-header {
    background: #1a1a2e;
    color: #fff;
    padding: 12px;
    text-align: center;
    font-weight: 800;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* =========================================
   TABLES
   ========================================= */
table.wc2026-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    table-layout: fixed;
    /* Ensures columns respect widths */
}

.wc2026-table th {
    background: #f8f9fa;
    color: #6c757d;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    padding: 10px 4px;
    border-bottom: 2px solid #e9ecef;
}

.wc2026-table td {
    padding: 10px 4px;
    text-align: center;
    font-size: 13px;
    border-bottom: 1px solid #f1f3f5;
    color: #495057;
}

.wc2026-table td:first-child {
    text-align: left;
    padding-left: 15px;
    font-weight: 500;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wc2026-table td:last-child {
    font-weight: 800;
    color: #1a1a2e;
    background: #f8f9fa;
}

/* Column Widths Configuration */
.wc2026-table th:nth-child(1) {
    width: 40%;
}

/* Team Name */
.wc2026-table th:nth-child(2),
/* J */
.wc2026-table th:nth-child(3),
/* V */
.wc2026-table th:nth-child(4),
/* N */
.wc2026-table th:nth-child(5) {
    width: 7%;
}

/* D */
.wc2026-table th:nth-child(6),
/* BP */
.wc2026-table th:nth-child(7) {
    width: 8%;
}

/* BC */
.wc2026-table th:nth-child(8) {
    width: 10%;
}

/* Diff */
.wc2026-table th:nth-child(9) {
    width: 10%;
}

/* Pts */

/* Qualification Highlighting */
.wc2026-qualified td:first-child {
    box-shadow: inset 4px 0 0 #198754;
    background-color: #f8fff9;
    font-weight: 700;
}

/* =========================================
   MATCHES LIST (Inside Group)
   ========================================= */
.wc2026-matches {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-grow: 1;
    /* Pushes content to fill height */
}

.wc2026-match {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.wc2026-match:last-child {
    border-bottom: none;
}

.wc2026-match-teams {
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 10px;
    flex: 1;
}

.wc2026-match-inputs {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* =========================================
   INPUTS
   ========================================= */
input[type="number"].score-input {
    width: 35px;
    height: 28px;
    padding: 0;
    text-align: center !important;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    color: #212529;
    background: #fff;
    transition: border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    -moz-appearance: textfield;
    z-index: 10;
    /* Ensure clickable */
}

input[type="number"].score-input:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

input[type="number"].score-input::-webkit-inner-spin-button,
input[type="number"].score-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =========================================
   BRACKET (Knockout Phase) - TABLE LAYOUT
   ========================================= */
.wc2026-sim .wc2026-bracket-container {
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #d5d8dc;
    margin-top: 20px;
    padding: 20px;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.wc2026-sim table.wc2026-bracket-table {
    width: auto !important;
    min-width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 24px 0 !important;
    display: table !important;
    table-layout: auto !important;
}

.wc2026-sim .wc2026-bracket-table thead,
.wc2026-sim .wc2026-bracket-table tbody {
    display: table-header-group !important;
}

.wc2026-sim .wc2026-bracket-table tr {
    display: table-row !important;
}

.wc2026-sim .wc2026-bracket-table th {
    padding-bottom: 20px;
    vertical-align: top;
    display: table-cell !important;
}

.wc2026-sim .wc2026-bracket-table td.wc2026-round-cell {
    width: 260px !important;
    min-width: 260px !important;
    vertical-align: top !important;
    display: table-cell !important;
    padding: 0 6px !important;
}

.wc2026-sim .wc2026-round-matches {
    display: flex !important;
    flex-direction: column !important;
    gap: 18px !important;
}

.wc2026-sim .wc2026-round-title {
    text-align: center;
    font-weight: 800;
    padding: 10px;
    background: #1a1a2e;
    color: #fff;
    border-radius: 6px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.wc2026-sim .wc2026-bracket-match {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    border: 2px solid #dfe3e8;
    overflow: hidden;
    position: relative;
    margin-bottom: 0;
    display: block !important;
    padding: 2px;
}

.wc2026-sim .wc2026-bracket-team {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 12px !important;
    border-bottom: 1px solid #e6eaef;
    font-size: 13px;
    height: 44px;
    background: linear-gradient(90deg, #ffffff 0%, #f9fbfd 100%);
}

.wc2026-sim .wc2026-bracket-team:last-child {
    border-bottom: none;
}

.wc2026-sim .wc2026-bracket-team.winner {
    background-color: #dff3e5;
    color: #0f5132;
    font-weight: 700;
    border-left: 4px solid #198754;
    padding-left: 14px !important;
}

.wc2026-sim .wc2026-bracket-team span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.wc2026-sim .wc2026-bracket-team input.score-input {
    width: 42px;
    height: 30px;
    font-size: 13px;
    font-weight: 700;
    background: #fff;
    border: 1px solid #cfd6de;
    border-radius: 6px;
}

.wc2026-sim .wc2026-bracket-team input.score-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .wc2026-groups {
        grid-template-columns: 1fr;
    }

    .wc2026-table th:nth-child(n+6),
    .wc2026-table td:nth-child(n+6) {
        /* Hide less important columns on very small screens if needed */
        /* display: none; */
    }

    .wc2026-match {
        /* On mobile, stack inputs below name if needed, but flex row usually works */
    }
}