/* ============================================
   IMPROVED MOBILE TABLE STYLING
   Enhanced mobile experience for stats and player tables
   ============================================ */

/* Mobile Table Improvements (480px and below) */
@media (max-width: 480px) {
    /* ===== BETTER SCROLL INDICATOR ===== */
    .roster-table-wrapper,
    .stats-table-wrapper {
        position: relative;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    /* Prominent scroll hint banner */
    .roster-table-wrapper::before,
    .stats-table-wrapper::before {
        content: '← Swipe to see all stats →';
        display: block;
        text-align: center;
        padding: 10px 16px;
        background: linear-gradient(135deg, #FFB81C 0%, #ffa500 100%);
        color: #041E42;
        font-size: 13px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        position: sticky;
        left: 0;
        z-index: 20;
        box-shadow: 0 2px 8px rgba(255, 184, 28, 0.3);
        animation: pulse 2s ease-in-out infinite;
    }

    @keyframes pulse {
        0%, 100% { opacity: 1; transform: scale(1); }
        50% { opacity: 0.9; transform: scale(0.98); }
    }

    /* Remove after first scroll */
    .roster-table-wrapper.scrolled::before,
    .stats-table-wrapper.scrolled::before {
        display: none;
    }

    /* ===== IMPROVED TABLE SPACING ===== */
    .roster-table,
    .stats-table {
        min-width: 650px; /* Slightly less aggressive than 700px */
        border-collapse: separate;
        border-spacing: 0;
    }

    .roster-table th,
    .roster-table td,
    .stats-table th,
    .stats-table td {
        padding: 12px 8px; /* More comfortable padding */
        font-size: 13px; /* Slightly larger for readability */
        white-space: nowrap;
    }

    /* ===== STICKY FIRST COLUMN - IMPROVED ===== */
    .roster-table th:first-child,
    .roster-table td:first-child,
    .stats-table th:first-child,
    .stats-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 10;
        background-color: #ffffff;
        box-shadow: 3px 0 6px rgba(0, 0, 0, 0.12); /* Stronger shadow */
        max-width: 140px; /* More space for names */
        min-width: 140px;
        width: 140px;
        padding: 12px 8px !important;
    }

    /* Better header styling */
    .roster-table thead th:first-child,
    .stats-table thead th:first-child {
        z-index: 11;
        background-color: #041E42;
        box-shadow: 3px 0 6px rgba(0, 0, 0, 0.2);
    }

    /* Hover states for sticky column */
    .roster-table tbody tr:hover td:first-child,
    .stats-table tbody tr:hover td:first-child {
        background-color: #f8f9fa;
    }

    /* ===== PLAYER NAME CELL IMPROVEMENTS ===== */
    .player-name-cell {
        display: flex;
        align-items: center;
        gap: 6px; /* Better spacing */
        min-width: 140px;
        max-width: 140px;
    }

    .player-headshot-small,
    .player-headshot-tiny {
        width: 32px !important;
        height: 32px !important;
        border-radius: 50%;
        flex-shrink: 0;
        border: 2px solid #FFB81C;
    }

    .player-name,
    .player-name-text {
        font-size: 12px !important;
        line-height: 1.3;
        font-weight: 600;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .player-number {
        font-size: 11px;
        color: #666;
        font-weight: 500;
    }

    /* ===== SECTION HEADERS ===== */
    .roster-table tbody tr.section-header td:first-child {
        background: linear-gradient(90deg, #FFB81C 0%, #ffd580 100%);
        color: #041E42;
        font-weight: 800;
        box-shadow: 3px 0 6px rgba(255, 184, 28, 0.3);
    }

    /* ===== STANDINGS TABLES ===== */
    .standings-mini-table {
        font-size: 13px;
    }

    .standings-mini-table th:first-child,
    .standings-mini-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 10;
        background-color: #ffffff;
        box-shadow: 3px 0 6px rgba(0, 0, 0, 0.12);
        min-width: 100px;
        padding: 12px 8px;
    }

    .standings-mini-table thead th:first-child {
        z-index: 11;
        background-color: #f8f9fa;
        font-weight: 700;
    }

    .standings-mini-table tbody tr.predators-row td:first-child {
        background-color: #041E42;
        color: #FFB81C;
        font-weight: 700;
        box-shadow: 3px 0 6px rgba(4, 30, 66, 0.3);
    }

    /* ===== OVERVIEW CARDS ON MOBILE ===== */
    .overview-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns instead of 1 */
        gap: 12px;
    }

    .overview-stat-card {
        padding: 14px;
    }

    .overview-stat-label {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .overview-stat-value {
        font-size: 20px;
        font-weight: 800;
    }

    /* ===== WITH SIDEBAR LAYOUT ===== */
    .roster-with-sidebar,
    .stats-with-sidebar {
        grid-template-columns: 1fr; /* Stack on mobile */
        gap: 24px;
    }

    .roster-sidebar,
    .stats-sidebar {
        position: static; /* Remove sticky on mobile */
        order: -1; /* Move to top */
    }

    .roster-card,
    .stats-card {
        padding: 16px;
    }

    /* ===== BETTER LOADING STATES ===== */
    .loading-spinner {
        padding: 40px 20px;
    }

    .loading-spinner .spinner {
        width: 40px;
        height: 40px;
    }

    /* ===== SCROLLBAR STYLING ===== */
    .roster-table-wrapper::-webkit-scrollbar,
    .stats-table-wrapper::-webkit-scrollbar {
        height: 8px;
    }

    .roster-table-wrapper::-webkit-scrollbar-track,
    .stats-table-wrapper::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 4px;
    }

    .roster-table-wrapper::-webkit-scrollbar-thumb,
    .stats-table-wrapper::-webkit-scrollbar-thumb {
        background: #FFB81C;
        border-radius: 4px;
    }

    .roster-table-wrapper::-webkit-scrollbar-thumb:hover,
    .stats-table-wrapper::-webkit-scrollbar-thumb:hover {
        background: #041E42;
    }
}

/* Tablet improvements (481px to 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .overview-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .roster-table th:first-child,
    .roster-table td:first-child,
    .stats-table th:first-child,
    .stats-table td:first-child {
        max-width: 160px;
        min-width: 160px;
        width: 160px;
    }
}
