/* ============================================
   GROUP STAGE STYLES - SEPARATE FILE
   Does NOT affect bracket styling!
   ============================================ */

/* Group Stage Container */
.group-stage-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    padding: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.group-standings {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.group-header {
    border-bottom: 3px solid #667eea;
    padding-bottom: 12px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.group-header h2 {
    color: #667eea;
    font-size: 28px;
    font-weight: bold;
    margin: 0;
}

/* Group Standings Table */
.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 16px;
}

.standings-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.standings-table th {
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: #333;
    font-size: 18px;
    text-transform: uppercase;
}

.standings-table th:first-child {
    width: 40px;
    text-align: center;
}

.standings-table th:nth-child(3),
.standings-table th:nth-child(4),
.standings-table th:nth-child(5) {
    width: 50px;
    text-align: center;
}

.standings-table th:nth-child(6) {
    width: 100px;
    text-align: center;
}

.standings-table th:nth-child(7) {
    width: 70px;
    text-align: center;
}

.standings-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s;
}

.standings-table tbody tr:hover {
    background: #f8f9fa;
}

.standings-table tbody tr:first-child {
    background: #e8f5e9;
}

.standings-table tbody tr:nth-child(2) {
    background: #f1f8e9;
}

.standings-table td {
    padding: 12px 8px;
}

.standings-table td:first-child {
    text-align: center;
    font-weight: bold;
    color: #667eea;
    font-size: 20px;
}

.team-name {
    font-weight: 600;
    color: #333;
    min-width: 200px;
    position: relative;
    font-size: 19px;
}

.team-name-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-name-text {
    flex: 1;
}

.edit-team-name-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 6px;
    opacity: 0.4;
    transition: opacity 0.2s;
    color: #667eea;
}

.team-name:hover .edit-team-name-btn {
    opacity: 1;
}

.edit-team-name-btn:hover {
    transform: scale(1.2);
}

.edit-team-input {
    width: 100%;
    padding: 8px;
    border: 2px solid #667eea;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
}

.stat-input {
    width: 50px;
    padding: 6px;
    border: 2px solid #e0e0e0;
    border-radius: 5px;
    text-align: center;
    font-size: 20px;
    font-weight: 600;
}

.stat-input.goal-diff-input {
    width: 80px !important;
    min-width: 80px !important;
}

.stat-input:focus {
    outline: none;
    border-color: #667eea;
}

.points-display {
    background: #fff3cd;
    font-weight: bold;
    color: #856404;
    font-size: 24px;
    text-align: center;
    padding: 12px 8px;
}

.btn-save-stats {
    padding: 8px 16px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-save-stats:hover {
    background: #218838;
    transform: translateY(-1px);
}

.btn-save-stats:active {
    transform: translateY(0);
}

/* Sort Group Button */
.sort-group-btn {
    background: #4caf50;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.sort-group-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.sort-group-btn:active {
    transform: translateY(0);
}

/* Group Setup Modal */
.group-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.group-title {
    color: #667eea;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 8px;
}

/* Tournament View Tabs */
.tournament-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 15px 40px;
    background: rgba(255, 255, 255, 0.3);
    color: white;
    border: 2px solid white;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
}

.tab-button.active {
    background: white;
    color: #667eea;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.tournament-section {
    display: none;
}

.tournament-section.active {
    display: block;
}

/* Ensure bracket section maintains original perfect behavior */
#bracketSection.active {
    display: block;
}

/* DO NOT override bracketContainer - let original styles work! */

/* Mobile Responsive - Desktop to Tablet breakpoint */
@media (max-width: 1200px) {
    .group-stage-wrapper {
        grid-template-columns: 1fr;
        min-width: auto;
    }
}

/* iPad 9-13 inch Optimization - Override to 2 columns */
@media (min-width: 769px) and (max-width: 1366px) {
    .group-stage-wrapper {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
        padding: 15px 10px;
        max-width: 100%;
    }
    
    .group-standings {
        padding: 15px;
    }
    
    .group-header {
        margin-bottom: 12px;
        padding-bottom: 10px;
    }
    
    .group-header h2 {
        font-size: 22px;
    }
    
    .sort-group-btn {
        font-size: 12px !important;
        padding: 8px 12px !important;
    }
    
    .standings-table {
        font-size: 14px;
    }
    
    .standings-table th {
        padding: 8px 4px;
        font-size: 12px;
    }
    
    .standings-table td {
        padding: 10px 4px;
    }
    
    .standings-table td:first-child {
        font-size: 16px;
    }
    
    .team-name {
        font-size: 14px;
        min-width: 140px;
    }
    
    .stat-input {
        width: 40px;
        font-size: 16px;
        padding: 5px 3px;
    }
    
    .stat-input.goal-diff-input {
        width: 45px !important;
    }
    
    .points-display {
        font-size: 20px;
        padding: 8px 4px;
    }
    
    .edit-team-name-btn {
        font-size: 11px;
        padding: 2px 3px;
    }
    
    .btn-save-stats {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .tournament-tabs {
        gap: 8px;
        margin-bottom: 20px;
    }
    
    .tab-button {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 768px) {
    .group-stage-wrapper {
        padding: 10px;
        gap: 15px;
    }
    
    .group-standings {
        padding: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .group-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .group-header h2 {
        font-size: 20px;
        text-align: left;
    }
    
    .sort-group-btn {
        font-size: 14px !important;
        padding: 10px !important;
        width: 100%;
    }
    
    .standings-table {
        font-size: 14px;
        display: block;
        overflow-x: auto;
    }
    
    .standings-table thead,
    .standings-table tbody,
    .standings-table tr {
        display: block;
    }
    
    .standings-table thead {
        position: sticky;
        top: 0;
        background: #f8f9fa;
        z-index: 1;
    }
    
    .standings-table thead tr {
        display: flex;
        border-bottom: 2px solid #dee2e6;
    }
    
    .standings-table tbody tr {
        display: flex;
        border-bottom: 1px solid #e9ecef;
        align-items: center;
    }
    
    .standings-table th,
    .standings-table td {
        flex-shrink: 0;
        padding: 10px 6px;
        text-align: center;
    }
    
    .standings-table th:first-child,
    .standings-table td:first-child {
        width: 40px;
        flex-shrink: 0;
    }
    
    .standings-table th:nth-child(2),
    .standings-table td:nth-child(2) {
        flex: 1;
        min-width: 150px;
        text-align: left;
    }
    
    .standings-table th:nth-child(3),
    .standings-table th:nth-child(4),
    .standings-table th:nth-child(5),
    .standings-table th:nth-child(6),
    .standings-table td:nth-child(3),
    .standings-table td:nth-child(4),
    .standings-table td:nth-child(5),
    .standings-table td:nth-child(6) {
        width: 50px;
        flex-shrink: 0;
    }
    
    .standings-table th:nth-child(7),
    .standings-table td:nth-child(7) {
        width: 60px;
        flex-shrink: 0;
    }
    
    .standings-table th {
        font-size: 14px;
        font-weight: 700;
    }
    
    .stat-input {
        width: 45px;
        padding: 8px 4px;
        font-size: 16px;
    }

    .team-name {
        min-width: auto;
        font-size: 15px;
    }
    
    .edit-team-name-btn {
        font-size: 14px;
        padding: 4px 6px;
    }
    
    .points-display {
        font-size: 18px;
        padding: 10px 6px;
    }

    .tab-button {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .tournament-tabs {
        gap: 8px;
        margin-bottom: 20px;
        flex-wrap: wrap;
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .group-stage-wrapper {
        padding: 8px;
    }
    
    .group-standings {
        padding: 10px;
        border-radius: 8px;
    }
    
    .group-header h2 {
        font-size: 18px;
    }
    
    .sort-group-btn {
        font-size: 13px !important;
        padding: 10px !important;
    }
    
    .standings-table th,
    .standings-table td {
        padding: 8px 4px;
    }
    
    .standings-table th:nth-child(2),
    .standings-table td:nth-child(2) {
        min-width: 130px;
    }
    
    .standings-table th:nth-child(3),
    .standings-table th:nth-child(4),
    .standings-table th:nth-child(5),
    .standings-table th:nth-child(6),
    .standings-table td:nth-child(3),
    .standings-table td:nth-child(4),
    .standings-table td:nth-child(5),
    .standings-table td:nth-child(6) {
        width: 45px;
    }
    
    .standings-table th:nth-child(7),
    .standings-table td:nth-child(7) {
        width: 55px;
    }
    
    .standings-table th {
        font-size: 13px;
    }
    
    .stat-input {
        width: 40px;
        padding: 6px 2px;
        font-size: 15px;
    }
    
    .team-name {
        font-size: 14px;
    }
    
    .points-display {
        font-size: 16px;
    }
    
    .tab-button {
        padding: 10px 15px;
        font-size: 14px;
        flex: 1;
    }
    
    .tournament-tabs {
        flex-direction: row;
        width: 100%;
        padding: 0 8px;
    }
}

