/**
 * Stats Layout CSS - İstatistik Kartları Layout
 * 3 lig kartı: Süper Lig, Premier League, Bundesliga
 * Modüler sistem - Anasayfa için sabit modül
 */

/* ========================================
   MAIN CONTAINER
   ======================================== */
.category-stats-layout {
    margin: 20px 0;
    padding: 0;
    overflow: hidden;
    background: #fff;
}

.category-stats-layout .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ========================================
   STATS GRID - 3 COLUMN LAYOUT
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 0;
}

/* ========================================
   STATS CARD
   ======================================== */
.stats-card {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* ========================================
   STATS HEADER
   ======================================== */
.stats-header {
    padding: 20px;
    /* Background color dinamik CSS'ten gelecek (functions.php) */
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid rgba(255, 255, 255, 0.2);
}

/* Premier League - Purple */
.stats-card:nth-child(2) .stats-header {
    background: linear-gradient(135deg, #6B46C1 0%, #553C9A 100%);
}

/* Bundesliga - Blue */
.stats-card:nth-child(3) .stats-header {
    background: linear-gradient(135deg, #3182CE 0%, #2C5AA0 100%);
}

.stats-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stats-icon {
    font-size: 32px;
    line-height: 1;
}

.stats-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stats-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
    color: #ffffff;
}

.stats-weeks {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    color: #ffffff;
}

/* ========================================
   TAB NAVIGATION
   ======================================== */
.stats-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.stats-tab {
    flex: 1;
    padding: 14px 10px;
    background: transparent;
    border: none;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-tab:hover {
    background: rgba(0, 0, 0, 0.03);
    color: #495057;
}

.stats-tab.active {
    background: #ffffff;
    /* Color ve border dinamik CSS'ten gelecek */
}

/* ========================================
   TAB CONTENT
   ======================================== */
.stats-content {
    min-height: 400px;
    max-height: 500px;
    overflow: hidden;
}

.stats-tab-content {
    display: none;
    padding: 0;
}

.stats-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   STATS LISTS
   ======================================== */
.stats-scorers-list,
.stats-assists-list,
.stats-standings-list {
    padding: 0;
}

/* ========================================
   STATS TABLE - MINI
   ======================================== */
.stats-mini-table {
    width: 100%;
    font-size: 12px;
    display: block;
    max-height: 450px;
    overflow-y: auto;
    overflow-x: hidden;
}

.stats-mini-table::-webkit-scrollbar {
    width: 6px;
}

.stats-mini-table::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.stats-mini-table::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.stats-mini-table::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.stats-mini-table tr {
    border-bottom: 1px solid #f0f0f0;
    display: table;
    width: 100%;
    table-layout: fixed;
    transition: background-color 0.2s ease;
}

.stats-mini-table tr:hover {
    background-color: rgba(229, 57, 53, 0.05);
}

.stats-mini-table tr:last-child {
    border-bottom: none;
}

.stats-mini-table td {
    padding: 10px 8px;
    vertical-align: middle;
}

/* ========================================
   TABLE CELLS
   ======================================== */
.stats-pos {
    width: 35px;
    text-align: center;
    font-weight: 700;
    color: #718096;
    font-size: 12px;
}

.stats-player-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    padding-left: 12px;
}

.stats-team-name {
    font-size: 11px;
    color: #718096;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    font-weight: 500;
}

.stats-team-cell {
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    font-size: 12px;
    padding-left: 12px;
}

.stats-value {
    width: 45px;
    text-align: center;
    font-weight: 800;
    font-size: 14px;
    /* Color dinamik CSS'ten gelecek */
}

.stats-small {
    width: 35px;
    text-align: center;
    font-size: 11px;
    color: #718096;
    font-weight: 500;
}

/* Horizontal Table - Oyuncu ve Takım Yan Yana */
.stats-horizontal-table .stats-player-name {
    font-weight: 600;
    color: #2d3748;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    padding-left: 12px;
}

.stats-horizontal-table .stats-team-name {
    font-size: 11px;
    color: #718096;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    font-weight: 500;
}

/* ========================================
   STANDINGS TABLE SPECIFIC
   ======================================== */
.stats-standings-table {
    max-height: 500px;
}

.stats-standings-table td {
    padding: 8px 6px;
    font-size: 11px;
}

.stats-standings-table .stats-team-cell {
    font-size: 12px;
    font-weight: 600;
}

.stats-standings-table .stats-value {
    font-size: 13px;
    font-weight: 800;
}

.stats-standings-table .stats-pos {
    font-size: 11px;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.stats-empty {
    padding: 60px 20px;
    text-align: center;
    color: #a0aec0;
    font-size: 14px;
}

.stats-empty p {
    margin: 0;
    color: #718096;
}

/* ========================================
   LOADING STATE
   ======================================== */
.stats-loading {
    padding: 60px 20px;
    text-align: center;
}

.stats-loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    /* border-top color dinamik CSS'ten gelecek */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================
   DARK MODE
   ======================================== */
.dark-mode .category-stats-layout {
    background: var(--dark-bg-primary, #121212);
}

.dark-mode .stats-card {
    background: #1a1a1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.dark-mode .stats-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Dark mode header colors remain the same - already perfect */
.dark-mode .stats-header {
    border-bottom-color: rgba(255, 255, 255, 0.15);
}

.dark-mode .stats-tabs {
    background: #0d0d0d;
    border-bottom-color: #333;
}

.dark-mode .stats-tab {
    color: #999;
}

.dark-mode .stats-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #d0d0d0;
}

.dark-mode .stats-tab.active {
    background: #1a1a1a;
    /* Color dinamik CSS'ten gelecek */
    border-bottom-color: var(--primary-color, #e74c3c);
}

/* Premier League active tab */
.dark-mode .stats-card:nth-child(2) .stats-tab.active {
    color: #9F7AEA;
    border-bottom-color: #9F7AEA;
}

/* Bundesliga active tab */
.dark-mode .stats-card:nth-child(3) .stats-tab.active {
    color: #4299E1;
    border-bottom-color: #4299E1;
}

.dark-mode .stats-mini-table tr {
    border-bottom-color: #2a2a2a;
}

.dark-mode .stats-mini-table tr:hover {
    background-color: rgba(231, 76, 60, 0.08);
}

/* Premier League row hover */
.dark-mode .stats-card:nth-child(2) .stats-mini-table tr:hover {
    background-color: rgba(159, 122, 234, 0.08);
}

/* Bundesliga row hover */
.dark-mode .stats-card:nth-child(3) .stats-mini-table tr:hover {
    background-color: rgba(66, 153, 225, 0.08);
}

.dark-mode .stats-mini-table::-webkit-scrollbar-track {
    background: #0d0d0d;
}

.dark-mode .stats-mini-table::-webkit-scrollbar-thumb {
    background: #333;
}

.dark-mode .stats-mini-table::-webkit-scrollbar-thumb:hover {
    background: #444;
}

.dark-mode .stats-player-name,
.dark-mode .stats-team-cell,
.dark-mode .stats-horizontal-table .stats-player-name {
    color: #ffffff;
}

.dark-mode .stats-team-name,
.dark-mode .stats-small,
.dark-mode .stats-pos,
.dark-mode .stats-horizontal-table .stats-team-name {
    color: #999;
}

.dark-mode .stats-value {
    color: #e74c3c;
}

/* Premier League stats value */
.dark-mode .stats-card:nth-child(2) .stats-value {
    color: #9F7AEA;
}

/* Bundesliga stats value */
.dark-mode .stats-card:nth-child(3) .stats-value {
    color: #4299E1;
}

.dark-mode .stats-empty p {
    color: #666;
}

.dark-mode .stats-loading::after {
    border-color: #2a2a2a;
    border-top-color: #e74c3c;
}

/* Premier League loading */
.dark-mode .stats-card:nth-child(2) .stats-loading::after {
    border-top-color: #9F7AEA;
}

/* Bundesliga loading */
.dark-mode .stats-card:nth-child(3) .stats-loading::after {
    border-top-color: #4299E1;
}

/* ========================================
   RESPONSIVE - PROFESYONEL MOBİL UYUMLULUK
   ======================================== */

/* Tablet - 1024px */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .stats-card:nth-child(3) {
        grid-column: 1 / -1;
        max-width: 650px;
        margin: 0 auto;
    }
}

/* Tablet Small - 768px */
@media (max-width: 768px) {
    /* MOBİLDE TÜMÜYLE GİZLE */
    .category-stats-layout {
        display: none !important;
    }
    
    /* Header - Mobil Optimize */
    .stats-header {
        padding: 14px 15px;
        flex-wrap: nowrap;
    }
    
    .stats-header-left {
        gap: 10px;
        flex-shrink: 1;
        min-width: 0;
    }
    
    .stats-icon {
        font-size: 26px;
        flex-shrink: 0;
    }
    
    .stats-title-group {
        gap: 3px;
        min-width: 0;
        flex: 1;
    }
    
    .stats-title {
        font-size: 17px;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .stats-weeks {
        font-size: 11px;
        opacity: 0.95;
        white-space: nowrap;
    }
    
    /* Tabs - Mobil Optimize */
    .stats-tabs {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .stats-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .stats-tab {
        padding: 12px 10px;
        font-size: 11px;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: auto;
        letter-spacing: 0.4px;
    }
    
    /* Content - Mobil Optimize */
    .stats-content {
        min-height: 320px;
        max-height: 420px;
        overflow: hidden;
    }
    
    /* Table - Mobil Optimize */
    .stats-mini-table {
        width: 100%;
        max-height: 380px;
        overflow-y: auto;
        overflow-x: hidden;
        display: block;
    }
    
    .stats-mini-table tr {
        display: table !important;
        width: 100% !important;
        table-layout: fixed !important;
    }
    
    .stats-mini-table td {
        display: table-cell !important;
        padding: 6px 3px !important;
        overflow: hidden !important;
        vertical-align: middle !important;
    }
    
    /* Sütun Genişlikleri - Kompakt Mobil */
    .stats-pos {
        width: 30px !important;
        font-size: 11px !important;
        text-align: center !important;
        padding: 6px 2px !important;
    }
    
    .stats-player-name,
    .stats-team-cell {
        font-size: 11px !important;
        padding: 6px 4px !important;
        max-width: none !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        text-align: left !important;
    }
    
    .stats-team-name {
        font-size: 9px !important;
        display: inline !important;
        margin-left: 4px !important;
        opacity: 0.7 !important;
    }
    
    .stats-value {
        width: 38px !important;
        font-size: 13px !important;
        font-weight: 700 !important;
        text-align: center !important;
        padding: 6px 3px !important;
    }
    
    .stats-small {
        width: 30px !important;
        font-size: 10px !important;
        text-align: center !important;
        padding: 6px 2px !important;
    }
}

/* Mobile - 600px */
@media (max-width: 600px) {
    .category-stats-layout {
        display: none !important;
    }
}

/* Mobile Small - 480px */
@media (max-width: 480px) {
    .category-stats-layout {
        display: none !important;
    }
}

/* Landscape Orientation - Özel Durum */
@media (max-width: 768px) and (orientation: landscape) {
    .stats-content {
        min-height: 260px;
        max-height: 350px;
    }
    
    .stats-mini-table {
        max-height: 310px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .stats-tab {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .stats-mini-table tr {
        min-height: 44px !important;
    }
}