/* Upcoming Games Container */
.upcoming-games-wrapper {
    position: relative;
    margin-bottom: 30px;
    font-family: 'Nunito Sans', sans-serif;
}

.upcoming-games-container {
    position: relative;
}

/* Filter Container */
.upcoming-games-filter-container {
    margin-bottom: 20px;
}

/* Type Container - holds tabs, period filters, etc */
.upcoming-games-type-container {
    display: flex;
    justify-content: flex-start;
    align-items: center; /* Vertically aligned to middle */
    position: relative;
    z-index: 5;
    flex-wrap: wrap;
    margin-bottom: 10px;
    gap: 15px; /* Space between elements */
}

/* League Info Container */
.upcoming-league-info-container {
    display: flex;
    flex-shrink: 0;
}

.upcoming-league-logo-img {
    height: 40px;
    width: auto;
    margin-right: 10px;
}

/* League Details - contains name and season dates */
.upcoming-league-details {
    display: flex;
    flex-direction: column;
    padding-left: 10px;
}

.upcoming-league-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #20242e;
}

.upcoming-season-dates {
    font-size: 12px;
    color: #65686f;
}

/* League Dropdown Container */
.upcoming-league-dropdown-container {
    margin-right: 15px;
    display: flex;
    align-items: center;
}

/* League Dropdown */
.upcoming-league-dropdown {
    position: relative;
    display: inline-block;
}

.upcoming-league-dropdown-btn {
    background-color: #17213e;
    color: white;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}

.upcoming-league-dropdown-btn i {
    font-size: 10px;
    margin-top: 2px;
}

.upcoming-league-dropdown-btn:hover {
    background-color: #138157;
}

.upcoming-league-dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    background-color: #f9f9f9;
    min-width: 240px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 10;
    max-height: 400px;
    overflow-y: auto;
    border-radius: 4px;
}

.upcoming-league-dropdown-content.show {
    display: block;
}

.upcoming-league-item {
    color: #20242e;
    padding: 8px 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.upcoming-league-item:hover {
    background-color: #f1f1f1;
}

.upcoming-league-item-logo {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    object-fit: contain;
}

.upcoming-league-item-name {
    font-size: 12px;
}

/* Filters container - flexible layout */
.upcoming-filters-container {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* Time Period Tabs */
.upcoming-time-period-tabs {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0;
    position: relative;
    z-index: 5;
    flex-wrap: wrap;
}

.upcoming-type-tab {
    padding: 4px 20px;
    background-color: #17213e;
    margin: 0px;
    font-weight: bold;
    cursor: pointer;
    font-size: 12px;
    color: #fff;
    border: none;
    transition: all 0.2s ease;
}

.upcoming-type-tab:hover {
    background-color: #138157;
}

.upcoming-type-tab.active {
    background-color: #2fb682;
    position: relative;
    color: white;
}

.upcoming-type-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background-color: #f8f8f8;
}

/* Grid Container */
.upcoming-games-grid-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-radius: 6px;
    color: #212529;
}

/* Games Section */
.upcoming-games-section {
    display: none;
    margin-bottom: 15px;
}

/* Grid Header */
.upcoming-grid-header {
    display: grid;
    grid-template-columns: 0.3fr 1.5fr 0.8fr 0.5fr;
    gap: 10px;
    align-items: center;
    font-weight: bold;
    background-color: #17213e;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
}

.upcoming-grid-header > div {
    display: flex;
    justify-content: center;
    text-align: center;
    padding: 0 5px;
}

.upcoming-teams-col {
    justify-content: start !important;
}

/* Grid Row */
.upcoming-grid-row {
    display: grid;
    grid-template-columns: 0.3fr 1.5fr 0.8fr 0.5fr;
    gap: 10px;
    align-items: center;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background-color 0.2s;
}

.upcoming-grid-row:hover {
    background-color: #f9f9f9;
}

/* Grid Cell */
.upcoming-grid-cell {
    display: flex;
    align-items: center;
    font-size: 12px;
    padding: 0 5px;
    font-weight: 600;
}

/* Date Cell */
.upcoming-date-cell {
    justify-content: center;
    text-align: center;
}

.upcoming-formatted-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.upcoming-date-display {
    font-weight: bold;
    font-size: 14px;
}

.upcoming-match-time {
    color: #555;
    margin-top: 2px;
    font-size: 12px;
}

/* Match Cell - Default vertical layout for all sizes */
.upcoming-match-cell {
    justify-content: flex-start;
}

.upcoming-match-teams {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    text-decoration: none;
    color: #20242e;
}

.upcoming-match-teams:hover {
    color: #2fb682;
}

.upcoming-team-home,
.upcoming-team-away {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    max-width: 100%;
    margin-bottom: 5px;
}

.upcoming-team-home span,
.upcoming-team-away span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upcoming-vs {
    margin: 5px 0;
    font-weight: bold;
    color: #999;
    padding-left: 6px;
    align-self: flex-start;
}

.upcoming-team-logo,
.upcoming-league-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* League Cell */
.upcoming-league-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* League cell link - makes the whole cell clickable */
.upcoming-league-cell-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: inherit;
    text-decoration: none;
    transition: color 0.2s;
}

.upcoming-league-cell-link:hover {
    color: #2fb682;
}

.upcoming-league-cell-link span {
    margin-top: 5px;
    font-size: 11px;
}

/* Standings Cell */
.upcoming-standings-cell {
    justify-content: center;
    text-align: center;
}

.upcoming-standings-link {
    color: #aeaeae;
    text-decoration: none;
    transition: color 0.2s;
}

.upcoming-standings-link:hover {
    color: #20242e;
}

/* Pagination */
.upcoming-pagination {
    display: flex;
    justify-content: center;
    margin-top: 15px;
    gap: 5px;
    flex-wrap: wrap;
}

.upcoming-pagination-button {
    padding: 5px 10px;
    background-color: #f6f7f8;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #65686f;
    transition: all 0.2s;
}

.upcoming-pagination-button:hover {
    background-color: #e9ecef;
}

.upcoming-pagination-button.active {
    background-color: #2fb682;
    color: white;
    border-color: #2fb682;
}

/* No Games Message */
.upcoming-no-games-message {
    padding: 15px;
    text-align: center;
    background-color: #f8f9fa;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    color: #6c757d;
    margin-top: 10px;
}

/* Loading Indicator */
.upcoming-games-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 10px;
}

.upcoming-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(47, 182, 130, 0.2);
    border-radius: 50%;
    border-top-color: #2fb682;
    animation: spin 1s linear infinite;
}

.upcoming-loading-text {
    margin-top: 10px;
    font-size: 14px;
    color: #20242e;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.upcoming-error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
    text-align: center;
}

/* Only switch to horizontal when there's truly enough space (at least 500px for the column) */
@media (min-width: 1200px) {
    .upcoming-match-teams {
        flex-direction: row;
        align-items: center;
    }
    
    .upcoming-team-home {
        max-width: 45%;
        margin-bottom: 0;
    }
    
    .upcoming-team-away {
        max-width: 45%;
        margin-bottom: 0;
    }
    
    .upcoming-vs {
        margin: auto 16px;
        padding: 0;
        flex-shrink: 0;
    }
}

/* Responsive Styles */
@media (max-width: 1024px) and (min-width: 768px) {
    .upcoming-grid-header,
    .upcoming-grid-row {
        grid-template-columns: 80px 1.5fr 0.8fr 0.5fr;
        gap: 5px;
    }
    
    .upcoming-team-logo,
    .upcoming-league-logo {
        width: 20px;
        height: 20px;
    }
    
    .upcoming-grid-cell {
        font-size: 11px;
        padding: 0 3px;
    }
    
    .upcoming-date-display {
        font-size: 12px;
    }
    
    .upcoming-match-time {
        font-size: 10px;
    }
}

/* Mobile Styles */
@media (max-width: 767px) {
    .upcoming-games-type-container {
        flex-direction: column;
        padding: 0 5px;
        align-items: flex-start;
        gap: 10px;
    }
    
    .upcoming-league-info-container {
        width: 100%;
        justify-content: center;
    }
    
    .upcoming-league-dropdown-container {
        width: 100%;
        margin-right: 0;
    }
    
    .upcoming-league-dropdown {
        width: 100%;
    }
    
    .upcoming-league-dropdown-btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Filters on mobile */
    .upcoming-filters-container {
        width: 100%;
        justify-content: center;
    }
    
    .upcoming-time-period-tabs {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
    }
    
    .upcoming-grid-header {
        display: none; /* Hide header on mobile */
    }
    
    /* Card-style layout for mobile */
    .upcoming-grid-row {
        display: flex;
        flex-direction: column;
        padding: 15px;
        gap: 10px;
    }
    
    /* Style for all cells in mobile */
    .upcoming-grid-cell {
        width: 100%;
        padding: 8px 0;
        border-bottom: 1px solid #eee;
        justify-content: flex-start;
    }
    
    /* Last cell without border */
    .upcoming-grid-cell:last-child {
        border-bottom: none;
    }
    
    /* Show labels on mobile */
    .upcoming-grid-cell:before {
        content: attr(data-label);
        font-weight: bold;
        width: 100px;
        min-width: 100px;
        text-align: left;
        margin-right: 10px;
    }
    
    /* Custom styling for specific cells on mobile */
    .upcoming-league-cell {
        flex-direction: row;
        align-items: center;
    }
    
    .upcoming-league-cell-link {
        flex-direction: row;
        align-items: center;
        width: 100%;
    }
    
    .upcoming-league-cell-link img {
        margin-right: 10px;
    }
    
    .upcoming-league-cell-link span {
        margin-top: 0;
    }
    
    .upcoming-date-cell {
        justify-content: flex-start;
    }
    
    .upcoming-formatted-date {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }
    
    .upcoming-date-display {
        margin-right: 10px;
    }
    
    /* Pagination for mobile */
    .upcoming-pagination {
        margin-top: 10px;
    }
    
    .upcoming-pagination-button {
        padding: 4px 8px;
        font-size: 11px;
    }
}