/* KBBCO Games Widget Styles */
.kbbco-games-widget {
    max-width: 1200px;
    margin: 0 auto;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Header Section */
.kbbco-games-header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    padding: 24px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.kbbco-games-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="20" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="50" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="20" cy="80" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="80" cy="80" r="2" fill="rgba(255,255,255,0.1)"/></svg>');
    opacity: 0.3;
}

.week-navigation {
    display: flex;
    gap: 8px;
    z-index: 1;
    position: relative;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

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

.nav-btn:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.week-title {
    color: white !important;
    font-size: 2.25rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1;
    position: relative;
    text-align: center;
    flex: 1;
}

.kbbco-games-header .week-title {
    color: white !important;
}

/* Games Content */
.games-content {
    padding: 32px;
    background: #f8fafc;
    min-height: 400px;
}

.week-games {
    display: none;
}

.week-games.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Game Cards */
.game-card {
    background: white;
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: visible;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.game-date-header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 16px 24px;
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.game-date-header .competition-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    backdrop-filter: blur(10px);
}

.game-content {
    padding: 24px;
}

.team-matchup {
    display: flex;
    align-items: stretch;
    gap: 24px;
}

.team-section {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    gap: 12px;
    flex: 1;
}

.team-section.home {
    align-items: flex-end;
    text-align: right;
}

.team-section.away {
    align-items: flex-start;
    text-align: left;
}

/* KBBC team alignment depends on home/away status */
.team-section.kbbc-team.away {
    align-items: flex-start !important;
    text-align: left !important;
}

.team-section.kbbc-team.away .team-name {
    justify-content: flex-start !important;
}

.team-section.kbbc-team.home {
    align-items: flex-end !important;
    text-align: right !important;
}

.team-section.kbbc-team.home .team-name {
    justify-content: flex-end !important;
}

.team-level {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
}

.team-level:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.team-level a {
    color: white !important;
    text-decoration: none;
}

/* Team level colors */
.team-level.seniors { 
    background: linear-gradient(135deg, #c0392b, #e74c3c); 
}
.team-level.u21 { 
    background: linear-gradient(135deg, #8e44ad, #9b59b6); 
}
.team-level.u18 { 
    background: linear-gradient(135deg, #d35400, #e67e22); 
}
.team-level.u16 { 
    background: linear-gradient(135deg, #e67e22, #f39c12); 
}
.team-level.u14 { 
    background: linear-gradient(135deg, #27ae60, #2ecc71); 
}
.team-level.u12 { 
    background: linear-gradient(135deg, #2980b9, #3498db); 
}
.team-level.u10 { 
    background: linear-gradient(135deg, #16a085, #1abc9c); 
}
.team-level.u8 { 
    background: linear-gradient(135deg, #2c3e50, #34495e); 
}

.team-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
    word-break: break-word;
    display: flex;
    align-items: center;
    justify-content: inherit;
    gap: 8px;
    min-height: 3.5rem;
    line-height: 1.3;
}

.team-level-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 45px;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Apply the same color scheme to inline team level badges */
.team-level-inline.seniors { 
    background: linear-gradient(135deg, #c0392b, #e74c3c); 
}
.team-level-inline.u21 { 
    background: linear-gradient(135deg, #8e44ad, #9b59b6); 
}
.team-level-inline.u18 { 
    background: linear-gradient(135deg, #d35400, #e67e22); 
}
.team-level-inline.u16 { 
    background: linear-gradient(135deg, #e67e22, #f39c12); 
}
.team-level-inline.u14 { 
    background: linear-gradient(135deg, #27ae60, #2ecc71); 
}
.team-level-inline.u12 { 
    background: linear-gradient(135deg, #2980b9, #3498db); 
}
.team-level-inline.u10 { 
    background: linear-gradient(135deg, #16a085, #1abc9c); 
}
.team-level-inline.u8 { 
    background: linear-gradient(135deg, #2c3e50, #34495e); 
}

.team-level-inline a {
    color: white !important;
    text-decoration: none;
}

.team-section.home .team-name {
    justify-content: flex-end;
}

.team-section.away .team-name {
    justify-content: flex-start;
}

.team-name a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.team-name a:hover {
    color: #e74c3c;
}

.team-score {
    font-size: 2.5rem;
    font-weight: 800;
    color: #2c3e50;
    margin: 0;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 3rem;
}

/* KBBC home team scores should be right-aligned */
.team-section.kbbc-team.home .team-score {
    justify-content: flex-end !important;
}

/* KBBC winner styling */
.team-section.kbbc-winner {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.12), rgba(255, 255, 255, 0.95));
    border-radius: 12px;
    padding: 16px;
    margin: -8px;
    position: relative;
}

.team-section.kbbc-winner::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-radius: 2px;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.team-section.kbbc-winner.home::before {
    right: 0;
}

.team-section.kbbc-winner.away::before {
    left: 0;
}

.team-section.kbbc-winner .team-score {
    color: #c0392b;
    text-shadow: 0 1px 3px rgba(231, 76, 60, 0.2);
    font-weight: 900;
    animation: victoryPulse 2s ease-in-out infinite alternate;
}

@keyframes victoryPulse {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.02);
    }
}

.vs-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-shrink: 0;
}

.vs-divider {
    background: linear-gradient(135deg, #bdc3c7, #95a5a6);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.4s ease;
    cursor: pointer;
}

.vs-divider:hover {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    transform: rotate(360deg) scale(1.15);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.3);
}

.game-status {
    font-size: 0.9rem;
    color: #7f8c8d;
    font-weight: 500;
}

/* Clickable VS divider for calendar */
.vs-divider.clickable {
    cursor: pointer;
    position: relative;
}

.vs-section {
    position: relative;
    overflow: visible;
}

.vs-section:hover .calendar-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.game-content {
    overflow: visible;
}

.calendar-dropdown {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    min-width: 140px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: visible;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.3s ease;
}

.calendar-dropdown a {
    display: block;
    padding: 8px 12px;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.calendar-dropdown a:hover {
    background: #f8f9fa;
    color: #e74c3c;
}

.calendar-dropdown a:first-child {
    border-radius: 8px 8px 0 0;
}

.calendar-dropdown a:last-child {
    border-radius: 0 0 8px 8px;
}

/* Loading and Error States */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #ecf0f1;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.error-message {
    text-align: center;
    padding: 60px 20px;
    color: #e74c3c;
}

.error-message p {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

.retry-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.retry-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.retry-btn:focus {
    outline: 2px solid #e74c3c;
    outline-offset: 2px;
}

/* No games message */
.no-games-message {
    text-align: center;
    padding: 60px 20px;
    color: #7f8c8d;
}

.no-games-message h3 {
    margin-bottom: 16px;
    color: #2c3e50;
    font-size: 1.5rem;
}

.no-games-message p {
    font-size: 1.1rem;
}

/* Game dividers */
.game-divider {
    margin: 24px 0;
    border: none;
    border-top: 1px solid #ecf0f1;
}

/* Calendar instruction between header and games */
.calendar-instruction-container {
    background: #f8fafc;
    padding: 12px 24px;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.calendar-instruction {
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    font-style: italic;
}

/* Team Filter Footer */
.team-filter-footer {
    background: #f8fafc;
    border-top: 1px solid #ecf0f1;
    padding: 0;
}

.filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.filter-header:hover {
    background: #eef2f7;
}

.filter-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-toggle {
    background: none;
    border: 2px solid #e74c3c;
    color: #e74c3c;
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.filter-toggle:hover {
    background: #e74c3c;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.filter-arrow {
    transition: transform 0.3s ease;
}

.filter-content {
    display: none;
    padding: 0 24px 20px 24px;
    background: white;
    border-top: 1px solid #ecf0f1;
    animation: filterSlideDown 0.3s ease;
}

@keyframes filterSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-action-btn {
    background: linear-gradient(135deg, #ecf0f1, #d5dbdb);
    border: 1px solid #bdc3c7;
    color: #2c3e50;
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-action-btn:hover {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border-color: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.2);
}

.team-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.team-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.team-checkbox:hover {
    border-color: #e74c3c;
    background: #fdf2f2;
    transform: translateY(-1px);
}

.team-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.team-checkbox input[type="checkbox"]:checked + .checkbox-custom {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border-color: #c0392b;
}

.team-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.team-label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9rem;
}

/* Team level colors for checkboxes */
.team-checkbox.seniors {
    border-left: 4px solid #e74c3c;
}

.team-checkbox.u21 {
    border-left: 4px solid #9b59b6;
}

.team-checkbox.u18 {
    border-left: 4px solid #e67e22;
}

.team-checkbox.u16 {
    border-left: 4px solid #f39c12;
}

.team-checkbox.u14 {
    border-left: 4px solid #2ecc71;
}

.team-checkbox.u12 {
    border-left: 4px solid #3498db;
}

.team-checkbox.u10 {
    border-left: 4px solid #1abc9c;
}

.team-checkbox.u8 {
    border-left: 4px solid #34495e;
}


/* Responsive Design */
@media (max-width: 768px) {
    .kbbco-games-header {
        padding: 20px;
        flex-direction: column;
        gap: 16px;
    }
    
    .week-title {
        font-size: 1.75rem;
        order: -1;
    }
    
    .games-content {
        padding: 20px;
    }
    
    .game-content {
        padding: 16px;
    }
    
    .team-matchup {
        grid-template-columns: 1fr;
        gap: 16px;
        text-align: center;
    }
    
    .team-section.home,
    .team-section.away {
        align-items: center;
        text-align: center;
    }
    
    .vs-section {
        order: -1;
    }
    
    .team-level {
        font-size: 1.2rem;
        min-width: 60px;
        padding: 6px 12px;
    }
    
    .team-score {
        font-size: 2rem;
    }
    
    .vs-divider {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .kbbco-games-header {
        padding: 16px;
    }
    
    .week-title {
        font-size: 1.5rem;
    }
    
    .nav-btn {
        width: 56px;
        height: 56px;
    }
    
    .games-content {
        padding: 16px;
    }
    
    .game-date-header {
        padding: 12px 16px;
        font-size: 1rem;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }
    
    .competition-badge {
        margin-top: 4px;
    }
    
    .team-level {
        font-size: 1rem;
        padding: 4px 8px;
        min-width: 50px;
    }
    
    .team-name {
        font-size: 1rem;
    }
    
    .team-score {
        font-size: 1.8rem;
    }
    
    .vs-divider {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }
}

/* Print styles */
@media print {
    .kbbco-games-widget {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .week-navigation {
        display: none;
    }
    
    .kbbco-games-header {
        background: #f8f9fa !important;
        color: #000 !important;
    }
    
    .week-title {
        color: #000 !important;
        text-shadow: none;
    }
    
    .game-card:hover {
        transform: none;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }
    
    .team-level:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .kbbco-games-widget {
        border: 2px solid #000;
    }
    
    .game-card {
        border: 1px solid #000;
    }
    
    .nav-btn {
        border: 2px solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .game-card,
    .team-level,
    .nav-btn,
    .retry-btn {
        transition: none;
    }
    
    .week-games.active {
        animation: none;
    }
    
    .spinner {
        animation: none;
    }
    
    .game-card:hover,
    .team-level:hover,
    .nav-btn:hover,
    .retry-btn:hover {
        transform: none;
    }
}