/**
 * Virtualeagues Team Calendar v2 - Main Styles
 * Modern dark gaming theme with tabbed interface
 */

/* ==========================================================================
   CSS Custom Properties (Variables)
   ========================================================================== */

:root {
    --vtcd-primary: #8c52ff;
    --vtcd-primary-glow: rgba(140, 82, 255, 0.5);
    --vtcd-secondary: #450068;
    --vtcd-accent: #ffd700;
    --vtcd-accent-glow: rgba(255, 215, 0, 0.5);
    
    --vtcd-bg-dark: #161616;
    --vtcd-bg-card: rgba(25, 25, 35, 0.9);
    --vtcd-bg-header: rgba(40, 40, 60, 0.95);
    --vtcd-bg-hover: rgba(60, 60, 90, 0.5);
    
    --vtcd-text-primary: #ffffff;
    --vtcd-text-secondary: rgba(255, 255, 255, 0.7);
    --vtcd-text-muted: rgba(255, 255, 255, 0.5);
    
    --vtcd-border: rgba(80, 80, 120, 0.3);
    --vtcd-border-accent: var(--vtcd-secondary);
    
    --vtcd-success: #4caf50;
    --vtcd-warning: #ff9800;
    --vtcd-error: #f44336;
    --vtcd-live: #ff4757;
    
    --vtcd-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    --vtcd-shadow-hover: 0 8px 16px rgba(0, 0, 0, 0.6);
    
    --vtcd-radius: 8px;
    --vtcd-radius-large: 12px;
    
    --vtcd-transition: all 0.3s ease;
    --vtcd-transition-fast: all 0.15s ease;
}

/* ==========================================================================
   Base Container & Layout
   ========================================================================== */

.vtcd-modern-container {
    background: linear-gradient(135deg, var(--vtcd-bg-dark) 0%, #1a1a2e 100%);
    color: var(--vtcd-text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    padding: 0;
    border-radius: var(--vtcd-radius-large);
    margin: 2rem 0;
    box-shadow: var(--vtcd-shadow);
    position: relative;
    overflow: hidden;
}

.vtcd-modern-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 50%, var(--vtcd-primary-glow) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, var(--vtcd-secondary) 0%, transparent 50%);
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================================
   Tab Navigation
   ========================================================================== */

.vtcd-tab-navigation {
    display: flex;
    background: var(--vtcd-bg-header);
    border-radius: var(--vtcd-radius-large) var(--vtcd-radius-large) 0 0;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.vtcd-tab-btn {
    flex: 1;
    padding: 1.5rem 2rem;
    background: transparent;
    border: none;
    color: var(--vtcd-text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--vtcd-transition);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.vtcd-tab-btn:hover {
    color: var(--vtcd-text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.vtcd-tab-btn.active {
    color: var(--vtcd-primary);
    background: rgba(140, 82, 255, 0.1);
    text-shadow: 0 0 10px var(--vtcd-primary-glow);
}

.vtcd-tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, var(--vtcd-primary) 50%, transparent 100%);
}

.vtcd-tab-count {
    background: var(--vtcd-primary);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    min-width: 1.5rem;
    text-align: center;
    box-shadow: 0 0 10px var(--vtcd-primary-glow);
}

/* ==========================================================================
   Tab Content
   ========================================================================== */

.vtcd-tab-content-wrapper {
    position: relative;
    z-index: 1;
}

.vtcd-tab-content {
    display: none;
}

.vtcd-tab-content.active {
    display: block;
}

/* ==========================================================================
   Card Design
   ========================================================================== */

.vtcd-card {
    background: var(--vtcd-bg-card);
    border-radius: 0 0 var(--vtcd-radius-large) var(--vtcd-radius-large);
    border: 1px solid var(--vtcd-border);
    border-top: none;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

/* ==========================================================================
   Date Groups
   ========================================================================== */

.vtcd-date-section {
    margin-bottom: 0;
}

.vtcd-date-header {
    background: var(--vtcd-bg-header);
    color: var(--vtcd-text-primary);
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    border-bottom: 1px solid var(--vtcd-border);
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
}

.vtcd-league-name {
    color: var(--vtcd-accent);
    font-weight: 700;
}

.vtcd-formatted-date {
    color: var(--vtcd-text-primary);
}

.vtcd-date-separator {
    color: var(--vtcd-text-muted);
    margin: 0 0.5rem;
}

/* ==========================================================================
   Match Display
   ========================================================================== */

.vtcd-matches-content {
    background: var(--vtcd-bg-card);
}

.vtcd-matches-container {
    background: var(--vtcd-bg-card);
}

.vtcd-match-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: var(--vtcd-transition);
    position: relative;
}

.vtcd-match-link:hover {
    color: inherit;
    text-decoration: none;
    transform: translateY(-1px);
}

.vtcd-match-link:focus {
    outline: 2px solid var(--vtcd-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   Match Grid Layout
   ========================================================================== */

.vtcd-match-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--vtcd-border);
    transition: var(--vtcd-transition);
    min-height: 80px;
}

.vtcd-match-grid:last-child {
    border-bottom: none;
}

.vtcd-match-link:hover .vtcd-match-grid {
    background: var(--vtcd-bg-hover);
}

/* ==========================================================================
   Team Display
   ========================================================================== */

.vtcd-team {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.vtcd-team-left {
    justify-content: flex-start;
}

.vtcd-team-right {
    justify-content: flex-end;
    flex-direction: row-reverse;
}

.vtcd-team-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.vtcd-team-right .vtcd-team-content {
    flex-direction: row-reverse;
}

.vtcd-team-logo-wrapper {
    flex-shrink: 0;
    position: relative;
}

.vtcd-team-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: var(--vtcd-transition);
}

.vtcd-team-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.vtcd-team-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.vtcd-team-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--vtcd-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: var(--vtcd-transition);
}

.vtcd-team-name-short {
    display: none;
    font-size: 0.8rem;
    color: var(--vtcd-text-secondary);
    font-weight: 500;
}

.vtcd-team-score {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--vtcd-accent);
    text-shadow: 0 0 10px var(--vtcd-accent-glow);
    min-width: 2rem;
    text-align: center;
}

/* Current team highlighting */
.vtcd-current-team .vtcd-team-name {
    color: var(--vtcd-primary);
    font-weight: 700;
    text-shadow: 0 0 15px var(--vtcd-primary-glow);
}

.vtcd-current-team .vtcd-team-logo {
    border: 2px solid var(--vtcd-primary);
    box-shadow: 0 0 15px var(--vtcd-primary-glow);
}

/* ==========================================================================
   Match Center Content
   ========================================================================== */

.vtcd-match-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    text-align: center;
    padding: 0 1rem;
}

.vtcd-score-display {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.vtcd-vs {
    color: var(--vtcd-text-secondary);
    font-size: 1rem;
    font-weight: 600;
}

.vtcd-score-display .vtcd-vs {
    font-size: 1.1rem;
}

.vtcd-match-day {
    font-size: 0.85rem;
    color: var(--vtcd-accent);
    font-weight: 500;
    background: rgba(255, 215, 0, 0.1);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.vtcd-match-season {
    font-size: 0.75rem;
    color: var(--vtcd-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* ==========================================================================
   Match Status & Live Indicators
   ========================================================================== */

.vtcd-live {
    color: var(--vtcd-live) !important;
    font-weight: 700;
    animation: vtcd-live-pulse 2s infinite;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.6);
}

.vtcd-live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--vtcd-live);
    font-weight: 700;
    background: rgba(255, 71, 87, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 71, 87, 0.3);
    animation: vtcd-live-glow 2s infinite;
}

.vtcd-live-dot {
    width: 6px;
    height: 6px;
    background: var(--vtcd-live);
    border-radius: 50%;
    animation: vtcd-live-blink 1s infinite;
}

/* Match status classes */
.vtcd-match-completed {
    opacity: 1;
}

.vtcd-match-upcoming {
    opacity: 0.95;
}

.vtcd-match-live {
    background: linear-gradient(135deg, rgba(255, 71, 87, 0.05) 0%, transparent 100%);
    border-left-color: var(--vtcd-live);
}

/* Winner highlighting */
.vtcd-team-1-winner .vtcd-team-left .vtcd-team-score,
.vtcd-team-2-winner .vtcd-team-right .vtcd-team-score {
    color: var(--vtcd-success);
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.6);
}

/* ==========================================================================
   Empty States
   ========================================================================== */

.vtcd-empty-message {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--vtcd-text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    background: var(--vtcd-bg-card);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.vtcd-pagination-wrapper {
    margin-top: 0;
    padding: 1.5rem 2rem;
    background: var(--vtcd-bg-header);
    border-top: 1px solid var(--vtcd-border);
}

.vtcd-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.vtcd-page-btn {
    background: var(--vtcd-bg-card);
    border: 1px solid var(--vtcd-border);
    color: var(--vtcd-text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--vtcd-radius);
    cursor: pointer;
    transition: var(--vtcd-transition);
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 40px;
    justify-content: center;
}

.vtcd-page-btn:hover:not(.disabled) {
    background: var(--vtcd-primary);
    border-color: var(--vtcd-primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(140, 82, 255, 0.3);
}

.vtcd-page-btn.active {
    background: var(--vtcd-primary);
    border-color: var(--vtcd-primary);
    color: white;
    box-shadow: 0 0 10px var(--vtcd-primary-glow);
}

.vtcd-page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.vtcd-page-numbers {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.vtcd-page-ellipsis {
    color: var(--vtcd-text-muted);
    padding: 0 0.5rem;
}

.vtcd-prev-btn,
.vtcd-next-btn {
    padding: 0.5rem 1rem;
}

.vtcd-btn-text {
    display: none;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.vtcd-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--vtcd-text-secondary);
    background: var(--vtcd-bg-card);
}

.vtcd-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--vtcd-border);
    border-top: 3px solid var(--vtcd-primary);
    border-radius: 50%;
    animation: vtcd-spin 1s linear infinite;
}

/* ==========================================================================
   Error States
   ========================================================================== */

.vtcd-error-state {
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: var(--vtcd-radius);
    padding: 2rem;
    text-align: center;
    margin: 1rem;
}

.vtcd-error-container {
    max-width: 400px;
    margin: 0 auto;
}

.vtcd-error-icon {
    color: var(--vtcd-error);
    margin-bottom: 1rem;
}

.vtcd-error-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--vtcd-text-primary);
    margin-bottom: 0.5rem;
}

.vtcd-error-message {
    color: var(--vtcd-text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.vtcd-error-debug {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.vtcd-error-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

.vtcd-retry-btn {
    background: var(--vtcd-bg-card);
    border: 1px solid var(--vtcd-border);
    color: var(--vtcd-text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--vtcd-radius);
    cursor: pointer;
    transition: var(--vtcd-transition);
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.vtcd-retry-btn:hover {
    background: var(--vtcd-primary);
    border-color: var(--vtcd-primary);
    color: white;
}

.vtcd-error-message {
    text-align: center;
    padding: 2rem;
    color: var(--vtcd-text-secondary);
    background: var(--vtcd-bg-card);
}

.vtcd-error-message p {
    margin-bottom: 1rem;
    font-size: 1rem;
}

.vtcd-error-message .vtcd-retry-btn {
    margin-top: 1rem;
}

/* ==========================================================================
   Match Info
   ========================================================================== */

.vtcd-match-info {
    text-align: center;
    font-size: 0.85rem;
    color: var(--vtcd-text-muted);
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--vtcd-border);
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes vtcd-live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

@keyframes vtcd-live-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

@keyframes vtcd-live-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(255, 71, 87, 0.3); }
    50% { box-shadow: 0 0 15px rgba(255, 71, 87, 0.6); }
}

@keyframes vtcd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes vtcd-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Responsive Design - FIXED FOR MOBILE
   ========================================================================== */

@media (max-width: 1024px) {
    .vtcd-modern-container {
        margin: 1.5rem 0;
    }
    
    .vtcd-tab-btn {
        padding: 1.25rem 1.5rem;
        font-size: 1rem;
    }
    
    .vtcd-match-grid {
        gap: 0.75rem;
        padding: 1rem 1.25rem;
        min-height: 70px;
    }
    
    .vtcd-team-logo {
        width: 40px;
        height: 40px;
    }
    
    .vtcd-match-center {
        min-width: 90px;
        padding: 0 0.75rem;
    }
    
    .vtcd-team-score {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    .vtcd-modern-container {
        margin: 1rem 0;
        border-radius: var(--vtcd-radius);
    }
    
    .vtcd-tab-navigation {
        border-radius: var(--vtcd-radius) var(--vtcd-radius) 0 0;
    }
    
    .vtcd-tab-btn {
        padding: 1rem;
        font-size: 0.9rem;
        letter-spacing: 0.5px;
    }
    
    .vtcd-tab-count {
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
    }
    
    .vtcd-date-header {
        padding: 0.75rem 1rem;
        font-size: 0.8rem;
        line-height: 1.3;
    }
    
    /* FIXED: Keep horizontal grid but make more compact */
    .vtcd-match-grid {
        grid-template-columns: 1fr auto 1fr; /* Keep horizontal layout */
        gap: 0.5rem;
        padding: 0.75rem 1rem;
        min-height: 60px;
    }
    
    .vtcd-team-content {
        gap: 0.5rem; /* Reduce gap but keep horizontal */
    }
    
    .vtcd-team-logo {
        width: 32px;
        height: 32px;
        padding: 2px;
    }
    
    .vtcd-team-name {
        font-size: 0.85rem;
    }
    
    .vtcd-team-name-short {
        display: none; /* Keep full names but smaller */
    }
    
    .vtcd-match-center {
        min-width: 80px;
        padding: 0 0.5rem;
        gap: 0.25rem;
    }
    
    .vtcd-score-display {
        font-size: 0.95rem;
    }
    
    .vtcd-match-day {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .vtcd-match-season {
        font-size: 0.65rem;
    }
    
    .vtcd-team-score {
        font-size: 1rem;
    }
    
    .vtcd-pagination {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .vtcd-btn-text {
        display: inline;
    }
    
    .vtcd-page-numbers {
        order: 2;
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
    
    .vtcd-pagination-wrapper {
       padding: 1rem;
   }
   
   .vtcd-empty-message {
       padding: 2rem 1rem;
       font-size: 1rem;
   }
}

@media (max-width: 480px) {
   .vtcd-modern-container {
       margin: 0.75rem 0;
   }
   
   .vtcd-tab-btn {
       padding: 0.75rem 0.5rem;
       font-size: 0.8rem;
       flex-direction: column;
       gap: 0.25rem;
   }
   
   .vtcd-date-header {
       padding: 0.5rem 0.75rem;
       font-size: 0.75rem;
   }
   
   /* FIXED: Even more compact for very small screens */
   .vtcd-match-grid {
       grid-template-columns: 1fr auto 1fr; /* Still keep horizontal */
       gap: 0.4rem;
       padding: 0.6rem 0.75rem;
       min-height: 55px;
   }
   
   .vtcd-team-content {
       gap: 0.4rem;
   }
   
   .vtcd-team-logo {
       width: 28px;
       height: 28px;
       padding: 2px;
   }
   
   .vtcd-team-name {
       font-size: 0.8rem;
       max-width: 80px; /* Limit width for very small screens */
   }
   
   .vtcd-match-center {
       min-width: 70px;
       padding: 0 0.4rem;
       gap: 0.2rem;
   }
   
   .vtcd-score-display {
       font-size: 0.9rem;
   }
   
   .vtcd-match-day {
       font-size: 0.65rem;
       padding: 0.15rem 0.3rem;
   }
   
   .vtcd-match-season {
       font-size: 0.6rem;
   }
   
   .vtcd-team-score {
       font-size: 0.95rem;
   }
   
   .vtcd-error-actions {
       flex-direction: column;
       gap: 0.5rem;
   }
   
   .vtcd-empty-message {
       padding: 1.5rem 0.75rem;
       font-size: 0.9rem;
   }
}

/* ==========================================================================
  Print Styles
  ========================================================================== */

@media print {
   .vtcd-modern-container {
       background: white !important;
       color: black !important;
       box-shadow: none !important;
       border: 1px solid #ccc !important;
   }
   
   .vtcd-tab-navigation {
       background: #f5f5f5 !important;
   }
   
   .vtcd-tab-btn {
       color: black !important;
       text-shadow: none !important;
   }
   
   .vtcd-card {
       background: white !important;
       border: 1px solid #ddd !important;
       box-shadow: none !important;
   }
   
   .vtcd-date-header {
       background: #f9f9f9 !important;
       color: black !important;
   }
   
   .vtcd-team-name,
   .vtcd-team-name-short {
       color: black !important;
       text-shadow: none !important;
   }
   
   .vtcd-pagination-wrapper,
   .vtcd-live-indicator,
   .vtcd-error-actions {
       display: none !important;
   }
   
   .vtcd-match-link:hover {
       transform: none !important;
   }
   
   .vtcd-match-grid:hover {
       background: transparent !important;
   }
   
   .vtcd-tab-content {
       display: block !important;
   }
}

/* ==========================================================================
  Accessibility & Motion Preferences
  ========================================================================== */

@media (prefers-reduced-motion: reduce) {
   * {
       animation-duration: 0.01ms !important;
       animation-iteration-count: 1 !important;
       transition-duration: 0.01ms !important;
   }
   
   .vtcd-live-indicator,
   .vtcd-live-dot,
   .vtcd-live {
       animation: none !important;
   }
}

@media (prefers-color-scheme: light) {
   .vtcd-modern-container {
       /* Keep dark theme regardless of system preference */
       /* Gaming aesthetic works best with dark colors */
   }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
   :root {
       --vtcd-border: rgba(255, 255, 255, 0.8);
       --vtcd-text-secondary: rgba(255, 255, 255, 0.9);
       --vtcd-text-muted: rgba(255, 255, 255, 0.7);
   }
   
   .vtcd-team-logo {
       border: 2px solid var(--vtcd-text-primary);
   }
   
   .vtcd-page-btn {
       border-width: 2px;
   }
   
   .vtcd-tab-btn {
       border: 1px solid var(--vtcd-border);
   }
}