/* Search Icon Fix */
.search-icon-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 10;
    font-size: 16px;
}

.search-input-with-icon {
    padding-left: 40px !important;
}

/* Custom Game Title Styling */
.game-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-size: 1.75rem;
    line-height: 1.2;
    color: white;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.8);
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.2);
}

.game-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: currentColor;
    margin-top: 5px;
    box-shadow: 0 0 8px currentColor;
}

/* Section Title Styling */
.section-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 2.5rem;
    line-height: 1.2;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.section-title span {
    display: inline-block;
}

.section-title span.text-neon-purple {
    color: #9d00ff;
    text-shadow: 0 0 10px rgba(157, 0, 255, 0.7), 0 0 20px rgba(157, 0, 255, 0.5);
}

/* View Tournaments Button Styling */
.view-tournaments-btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    color: white;
    background-color: transparent;
    border: none;
    text-align: center;
}

.view-tournaments-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: currentColor;
    opacity: 0.2;
    z-index: -1;
}

.view-tournaments-btn:hover::before {
    opacity: 0.3;
}

.view-tournaments-btn.bg-neon-blue {
    color: #00f3ff;
    text-shadow: 0 0 5px rgba(0, 243, 255, 0.7);
}

.view-tournaments-btn.bg-neon-green {
    color: #39ff14;
    text-shadow: 0 0 5px rgba(57, 255, 20, 0.7);
}

.view-tournaments-btn.bg-neon-red {
    color: #ff003c;
    text-shadow: 0 0 5px rgba(255, 0, 60, 0.7);
}

.view-tournaments-btn.bg-neon-purple {
    color: #9d00ff;
    text-shadow: 0 0 5px rgba(157, 0, 255, 0.7);
}

/* ===== ENHANCED MOBILE RESPONSIVENESS ===== */

/* Mobile-first table responsiveness */
@media (max-width: 1024px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        border: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    .table-container table {
        min-width: 800px;
    }
    
    /* Better mobile pagination */
    .pagination-mobile {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
    }
    
    .pagination-mobile a {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Improve mobile performance */
@media (max-width: 768px) {
    /* Reduce motion for users who prefer it */
    @media (prefers-reduced-motion: reduce) {
        *, *::before, *::after {
            animation-duration: 0.01ms !important;
            animation-iteration-count: 1 !important;
            transition-duration: 0.01ms !important;
            scroll-behavior: auto !important;
        }
    }
    
    /* Focus styles for keyboard navigation on mobile */
    .touch-friendly:focus {
        outline: 2px solid #00E5FF;
        outline-offset: 2px;
    }
    
    /* Mobile table responsiveness */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Keep table content on a single line and enable horizontal scroll */
    .table-responsive th,
    .table-responsive td {
        white-space: nowrap !important;
        word-break: normal !important;
        hyphens: manual !important;
    }
    
    /* Fallback: apply nowrap to all table cells (covers pages without wrapper) */
    table th,
    table td {
        white-space: nowrap !important;
        word-break: normal !important;
        hyphens: manual !important;
    }
    
    /* Keep button labels in one line across the app */
    button,
    .btn,
    .neon-button,
    .view-tournaments-btn,
    .btn-primary,
    .btn-secondary,
    .btn-success,
    .btn-danger,
    a.button,
    a.btn {
        white-space: nowrap;
    }
    
    /* Mobile modal adjustments */
    .modal {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Enhanced mobile form improvements */
    select, input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        min-height: 48px;
        padding: 12px 16px;
        border-radius: 8px;
        transition: all 0.2s ease;
    }
    
    /* Mobile button improvements */
    .btn, button, .button, input[type="submit"] {
        min-height: 48px;
        padding: 12px 24px;
        font-size: 16px;
        border-radius: 8px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: rgba(0, 243, 255, 0.2);
    }
    
    /* Mobile card improvements */
    .mobile-card-stack {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }
    
    .mobile-info-card {
        background: rgba(31, 41, 55, 0.8);
        border: 1px solid rgba(75, 85, 99, 0.3);
        border-radius: 12px;
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Better mobile stats display */
    .stats-grid-mobile {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin: 1rem 0;
    }
    
    .stat-item-mobile {
        text-align: center;
        padding: 1rem;
        background: rgba(17, 24, 39, 0.6);
        border-radius: 8px;
        border: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    /* Enhanced mobile spacing adjustments */
    .section-padding {
        padding: 2rem 1rem;
    }
    
    .card-padding {
        padding: 1rem;
    }
    
    /* Mobile dashboard improvements */
    .dashboard-mobile {
        gap: 1rem;
    }
    
    .dashboard-section-mobile {
        padding: 1.5rem;
        margin-bottom: 1rem;
        border-radius: 12px;
        background: rgba(31, 41, 55, 0.8);
        border: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    /* Mobile tournament card improvements */
    .tournament-card-mobile {
        padding: 1.5rem;
        margin-bottom: 1rem;
        border-radius: 12px;
        background: rgba(31, 41, 55, 0.8);
        border: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    .tournament-card-mobile .tournament-image {
        width: 100%;
        height: 200px;
        object-fit: cover;
        border-radius: 8px;
        margin-bottom: 1rem;
    }
    
    /* Mobile filter improvements */
    .filter-mobile {
        background: rgba(17, 24, 39, 0.8);
        padding: 1.5rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
        border: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    .filter-grid-mobile {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Very small mobile devices (320px and below) */
@media (max-width: 320px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .mobile-card {
        min-height: 260px;
    }
    
    .mobile-badge {
        max-width: 60px;
        font-size: 8px !important;
        padding: 2px 6px !important;
    }
    
    h1 {
        font-size: 1.5rem !important;
    }
    
    h2 {
        font-size: 1.25rem !important;
    }
    
    h3 {
        font-size: 1.125rem !important;
    }
}

/* ===== END MOBILE RESPONSIVE STYLES ===== */

/* Base Mobile Optimizations */
@media (max-width: 1024px) {
    /* Reduce font sizes for smaller screens */
    .section-title {
        font-size: 2rem;
        letter-spacing: 1px;
    }
    
    .game-title {
        font-size: 1.5rem;
    }
}

/* Tablet Styles */
@media (max-width: 768px) {
    /* Typography adjustments */
    .section-title {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }
    
    .game-title {
        font-size: 1.25rem;
    }
    
    /* Touch-friendly buttons */
    .view-tournaments-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
        min-height: 44px;
        min-width: 120px;
    }
    
    /* Enhanced mobile menu */
    #mobile-menu {
        background: rgba(5, 5, 5, 0.98);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(0, 243, 255, 0.3);
    }
    
    #mobile-menu a {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

/* Enhanced Mobile Phones */
@media (max-width: 480px) {
    /* Container improvements */
    .container-mobile {
        padding-left: 1rem;
        padding-right: 1rem;
        max-width: 100%;
    }
    /* Typography for phones */
    .section-title {
        font-size: 1.5rem;
        letter-spacing: 0.5px;
        margin-bottom: 1rem;
    }
    
    .game-title {
        font-size: 1.125rem;
    }
    
    /* Touch-friendly elements */
    .view-tournaments-btn {
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 48px;
        width: 100%;
        text-align: center;
    }
    
    /* Mobile spacing */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Enhanced mobile cards */
    .game-card, .tournament-card, .player-card {
        margin-bottom: 1.5rem;
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    /* Mobile action buttons */
    .action-buttons-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
    }
    
    .action-buttons-mobile .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Mobile table alternative - card view */
    .table-card-mobile {
        display: block;
        background: rgba(31, 41, 55, 0.8);
        border: 1px solid rgba(75, 85, 99, 0.3);
        border-radius: 12px;
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    .table-card-mobile .card-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid rgba(75, 85, 99, 0.3);
    }
    
    .table-card-mobile .card-content {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        font-size: 0.875rem;
    }
    
    .table-card-mobile .card-actions {
        margin-top: 1rem;
        padding-top: 0.75rem;
        border-top: 1px solid rgba(75, 85, 99, 0.3);
        display: flex;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    /* Mobile navbar logo */
    .font-orbitron {
        font-size: 0.875rem;
    }
}

/* Small Phones */
@media (max-width: 320px) {
    /* Ultra-compact typography */
    .section-title {
        font-size: 1.25rem;
        margin-bottom: 0.75rem;
    }
    
    .game-title {
        font-size: 1rem;
    }
    
    /* Ultra-compact spacing */
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Compact buttons */
    .view-tournaments-btn {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Ultra-compact navbar */
    .font-orbitron {
        font-size: 0.75rem;
    }
}

/* ===== RESPONSIVE UTILITIES ===== */

/* Responsive Images */
.responsive-img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

@media (max-width: 480px) {
    .responsive-img {
        max-height: 200px;
    }
}

/* Tournament card images */
.mobile-card .responsive-img {
    transition: transform 0.3s ease;
}

.mobile-card:hover .responsive-img {
    transform: scale(1.05);
}

/* Mobile badges */
.mobile-badge {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

@media (max-width: 480px) {
    .mobile-badge {
        max-width: 80px;
        font-size: 10px !important;
        padding: 4px 8px !important;
    }
}

/* Mobile text wrapping */
.mobile-text-wrap {
    word-break: break-word;
    hyphens: auto;
}

@media (max-width: 480px) {
    .mobile-text-wrap {
        font-size: 12px;
        line-height: 1.3;
    }
}

/* Responsive Video */
.responsive-video {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
}

.responsive-video iframe,
.responsive-video video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

@media (max-width: 480px) {
    .responsive-video {
        padding-bottom: 75%; /* 4:3 aspect ratio for mobile */
    }
}

/* Touch-friendly Links */
.touch-friendly {
    min-height: 44px;
    min-width: 44px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Grid responsiveness */
@media (max-width: 768px) {
    .responsive-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .mobile-grid-1 {
        grid-template-columns: 1fr !important;
    }
    
    .mobile-grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    .responsive-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 768px) {
    .responsive-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

/* Tournament card specific responsiveness */
.mobile-card {
    min-height: 320px;
    display: flex;
    flex-direction: column;
}

.mobile-card > div:last-child {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media (max-width: 480px) {
    .mobile-card {
        min-height: 280px;
    }
}

/* Mobile Grid */
@media (max-width: 768px) {
    .mobile-grid-1 {
        grid-template-columns: 1fr;
    }
    
    .mobile-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mobile-stack {
        flex-direction: column;
    }
    
    .mobile-full-width {
        width: 100%;
    }
    
    .mobile-text-center {
        text-align: center;
    }
    
    .mobile-hidden {
        display: none;
    }
    
    .mobile-block {
        display: block;
    }
}

/* Prevent horizontal scroll */
body {
    /* Allow horizontal scrolling for wide tables/content on small screens */
    overflow-x: auto; /* was hidden */
    width: 100%;
    max-width: 100%;
}

* {
    box-sizing: border-box;
}

/* Enhanced Mobile Menu Animation */
#mobile-menu {
    transform-origin: top;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#mobile-menu.hidden {
    transform: scaleY(0) translateY(-10px);
    opacity: 0;
}

#mobile-menu:not(.hidden) {
    transform: scaleY(1) translateY(0);
    opacity: 1;
}

/* Mobile-specific hover states */
@media (hover: none) and (pointer: coarse) {
    .mobile-tap-highlight {
        -webkit-tap-highlight-color: rgba(0, 243, 255, 0.2);
    }
    
    /* Remove hover effects on touch devices */
    .game-card:hover {
        transform: none;
    }
    
    .neon-button:hover::before {
        left: -100%;
    }
    
    /* Add active states for touch */
    .game-card:active {
        transform: scale(0.98);
        transition: transform 0.1s;
    }
    
    .neon-button:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
}