/*
 * TapNex Arena - Mobile Responsive Styles
 * Comprehensive mobile optimization for all screen sizes
 * Ensures the website looks fantastic on mobile devices
 */

/* ============================================
   MOBILE-FIRST BASE STYLES
   ============================================ */

/* Ensure all images are responsive by default */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Prevent horizontal scrolling on mobile */
body {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Better touch targets for mobile */
button,
a,
input,
select,
textarea {
    min-height: 44px;
    /* iOS recommended touch target */
    min-width: 44px;
}

/* ============================================
   MOBILE NAVIGATION (< 768px)
   ============================================ */
@media (max-width: 767px) {

    /* Navbar adjustments */
    .navbar {
        padding: 0.75rem 1rem !important;
    }

    .navbar .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Logo sizing for mobile */
    .navbar .logo-text {
        font-size: 0.9rem !important;
        margin-left: 0.4rem !important;
    }

    .navbar img {
        height: 1.5rem !important;
        max-height: 1.5rem !important;
    }

    /* Ensure header doesn't look cramped */
    .navbar .flex.justify-between {
        min-height: 3.5rem !important;
    }

    /* Hide desktop navigation on mobile */
    .navbar .hidden.lg\:flex,
    .nav-items {
        display: none !important;
    }

    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: block !important;
    }

    /* Mobile menu improvements */
    .mobile-menu {
        width: 85vw !important;
        max-width: 320px;
    }
}

/* ============================================
   TYPOGRAPHY RESPONSIVE SCALING
   ============================================ */

/* Mobile (< 640px) */
@media (max-width: 639px) {
    html {
        font-size: 14px;
        /* Base font size for mobile */
    }

    h1,
    .text-6xl,
    .text-7xl,
    .text-8xl {
        font-size: 2rem !important;
        /* 32px */
        line-height: 1.2 !important;
    }

    h2,
    .text-5xl {
        font-size: 1.75rem !important;
        /* 28px */
        line-height: 1.25 !important;
    }

    h3,
    .text-4xl {
        font-size: 1.5rem !important;
        /* 24px */
        line-height: 1.3 !important;
    }

    h4,
    .text-3xl {
        font-size: 1.25rem !important;
        /* 20px */
        line-height: 1.35 !important;
    }

    h5,
    .text-2xl {
        font-size: 1.125rem !important;
        /* 18px */
        line-height: 1.4 !important;
    }

    h6,
    .text-xl {
        font-size: 1rem !important;
        /* 16px */
        line-height: 1.5 !important;
    }

    p,
    .text-base {
        font-size: 0.875rem !important;
        /* 14px */
        line-height: 1.6 !important;
    }

    .text-sm {
        font-size: 0.8125rem !important;
        /* 13px */
    }

    .text-xs {
        font-size: 0.75rem !important;
        /* 12px */
    }
}

/* Tablet (640px - 1023px) */
@media (min-width: 640px) and (max-width: 1023px) {
    html {
        font-size: 15px;
    }

    h1,
    .text-7xl,
    .text-8xl {
        font-size: 2.5rem !important;
    }

    h2,
    .text-6xl {
        font-size: 2.25rem !important;
    }

    h3,
    .text-5xl {
        font-size: 2rem !important;
    }
}

/* ============================================
   CONTAINER & LAYOUT RESPONSIVE
   ============================================ */
@media (max-width: 767px) {
    .container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    /* Stack grid layouts on mobile */
    .grid:not([class*="sm:grid-cols"]):not([class*="lg:grid-cols"]) {
        grid-template-columns: 1fr !important;
    }

    /* Reduce gaps on mobile */
    .gap-8,
    .gap-10,
    .gap-12 {
        gap: 1.5rem !important;
    }

    .gap-6 {
        gap: 1rem !important;
    }

    /* Padding adjustments */
    .p-8,
    .p-10,
    .p-12 {
        padding: 1.5rem !important;
    }

    .px-8,
    .px-10,
    .px-12 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .py-8,
    .py-10,
    .py-12 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Margin adjustments */
    .mt-12,
    .mt-16,
    .mt-20 {
        margin-top: 2rem !important;
    }

    .mb-12,
    .mb-16,
    .mb-20 {
        margin-bottom: 2rem !important;
    }
}

/* ============================================
   BUTTONS & FORMS MOBILE OPTIMIZATION
   ============================================ */
@media (max-width: 767px) {

    /* Full-width buttons on mobile */
    .btn-block-mobile {
        width: 100% !important;
        display: block !important;
    }

    /* Button sizing */
    .btn {
        padding: 0.75rem 1.25rem !important;
        font-size: 0.9375rem !important;
    }

    .btn-sm {
        padding: 0.5rem 1rem !important;
        font-size: 0.875rem !important;
    }

    .btn-lg {
        padding: 1rem 1.5rem !important;
        font-size: 1rem !important;
    }

    /* Form inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    select,
    textarea {
        font-size: 16px !important;
        /* Prevents zoom on iOS */
        padding: 0.75rem !important;
    }

    /* Form groups */
    .form-group {
        margin-bottom: 1rem !important;
    }
}

/* ============================================
   CARDS & COMPONENTS MOBILE
   ============================================ */
@media (max-width: 767px) {

    /* Card adjustments */
    .card {
        padding: 1rem !important;
        margin-bottom: 1rem !important;
    }

    /* Modal adjustments */
    .modal-dialog {
        margin: 0.5rem !important;
        max-width: calc(100% - 1rem) !important;
    }

    .modal-content {
        border-radius: 1rem !important;
    }

    /* Alert messages */
    .alert {
        padding: 0.875rem !important;
        font-size: 0.875rem !important;
    }
}

/* ============================================
   FOOTER MOBILE OPTIMIZATION
   ============================================ */
@media (max-width: 767px) {
    footer {
        padding: 2rem 0 !important;
    }

    footer .grid {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    footer h3 {
        font-size: 1.125rem !important;
        margin-bottom: 0.75rem !important;
    }

    footer ul li {
        margin-bottom: 0.5rem !important;
    }

    footer .flex:not(.flex-wrap):not(.flex-row) {
        flex-direction: column !important;
        text-align: center !important;
        gap: 1rem !important;
    }
}

/* ============================================
   HERO SECTIONS MOBILE
   ============================================ */
@media (max-width: 767px) {

    /* Hero section adjustments */
    .hero,
    [class*="hero"] {
        padding: 3rem 1rem !important;
        min-height: auto !important;
    }

    .hero h1 {
        font-size: 2rem !important;
        margin-bottom: 1rem !important;
    }

    .hero p {
        font-size: 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* Hero buttons */
    .hero .btn {
        width: 100% !important;
        margin-bottom: 0.75rem !important;
    }

    .hero .flex {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    /* Fix game card layout on mobile */
    .game-card {
        display: block !important;
        min-height: 350px !important;
        overflow: hidden !important;
        position: relative !important;
    }

    .game-card-image {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 350px !important;
        object-fit: cover !important;
        z-index: 1 !important;
    }

    .game-card-content {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 1.25rem !important;
        z-index: 10 !important;
        background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.4) 30%, rgba(0, 0, 0, 0.75) 100%) !important;
        margin-top: 0 !important;
    }

    /* Prevent image overflow on hover */
    .game-card:hover .game-card-image {
        transform: none !important;
    }
}

/* ============================================
   TABLE RESPONSIVE
   ============================================ */
@media (max-width: 767px) {

    /* Make tables scrollable */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    table {
        min-width: 600px !important;
        font-size: 0.875rem !important;
    }

    th,
    td {
        padding: 0.5rem !important;
    }
}

/* ============================================
   UTILITY CLASSES FOR MOBILE
   ============================================ */

/* Hide on mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none !important;
}

@media (max-width: 767px) {
    .show-mobile {
        display: block !important;
    }

    .show-mobile-flex {
        display: flex !important;
    }

    .show-mobile-inline {
        display: inline !important;
    }
}

/* Text alignment on mobile */
@media (max-width: 767px) {
    .text-center-mobile {
        text-align: center !important;
    }

    .text-left-mobile {
        text-align: left !important;
    }
}

/* ============================================
   FLEXBOX MOBILE ADJUSTMENTS
   ============================================ */
@media (max-width: 767px) {

    /* Stack flex items on mobile */
    .flex-mobile-col {
        flex-direction: column !important;
    }

    /* Full width flex items */
    .flex-mobile-col>* {
        width: 100% !important;
    }

    /* Center items on mobile */
    .items-center-mobile {
        align-items: center !important;
    }

    .justify-center-mobile {
        justify-content: center !important;
    }
}

/* ============================================
   SPACING UTILITIES MOBILE
   ============================================ */
@media (max-width: 767px) {

    /* Margin utilities */
    .m-mobile-0 {
        margin: 0 !important;
    }

    .m-mobile-2 {
        margin: 0.5rem !important;
    }

    .m-mobile-4 {
        margin: 1rem !important;
    }

    .mt-mobile-0 {
        margin-top: 0 !important;
    }

    .mt-mobile-2 {
        margin-top: 0.5rem !important;
    }

    .mt-mobile-4 {
        margin-top: 1rem !important;
    }

    .mb-mobile-0 {
        margin-bottom: 0 !important;
    }

    .mb-mobile-2 {
        margin-bottom: 0.5rem !important;
    }

    .mb-mobile-4 {
        margin-bottom: 1rem !important;
    }

    /* Padding utilities */
    .p-mobile-0 {
        padding: 0 !important;
    }

    .p-mobile-2 {
        padding: 0.5rem !important;
    }

    .p-mobile-4 {
        padding: 1rem !important;
    }

    .px-mobile-2 {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    .px-mobile-4 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .py-mobile-2 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }

    .py-mobile-4 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

/* Reduce animations on mobile for better performance */
@media (max-width: 767px) {
    * {
        animation-duration: 0.3s !important;
        transition-duration: 0.2s !important;
    }

    /* Disable complex animations on mobile */
    .animate-pulse,
    .animate-bounce,
    .animate-spin {
        animation: none !important;
    }
}

/* Reduce motion for accessibility */
@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;
    }
}

/* ============================================
   LANDSCAPE MOBILE OPTIMIZATION
   ============================================ */
@media (max-width: 767px) and (orientation: landscape) {

    /* Reduce vertical padding in landscape */
    .hero,
    section {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }

    /* Adjust navbar height */
    .navbar {
        min-height: 3.5rem !important;
    }
}

/* ============================================
   SMALL MOBILE (< 375px)
   ============================================ */
@media (max-width: 374px) {
    html {
        font-size: 13px;
    }

    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    h1 {
        font-size: 1.75rem !important;
    }

    .btn {
        padding: 0.625rem 1rem !important;
        font-size: 0.875rem !important;
    }
}

/* ============================================
   TABLET SPECIFIC (768px - 1023px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }

    /* 2-column grid on tablet */
    .grid-tablet-2 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Adjust spacing */
    .gap-8 {
        gap: 2rem !important;
    }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {

    /* Remove hover effects on touch devices */
    .hover\:scale-105:hover,
    .hover\:scale-110:hover,
    .hover\:-translate-y-2:hover {
        transform: none !important;
    }

    /* Increase tap targets */
    a,
    button,
    input,
    select {
        min-height: 48px;
        min-width: 48px;
    }

    /* Better touch feedback */
    button:active,
    a:active {
        opacity: 0.7;
        transform: scale(0.98);
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {

    /* Hide navigation and footer when printing */
    .navbar,
    footer,
    .mobile-menu,
    .btn,
    .alert {
        display: none !important;
    }

    /* Optimize for print */
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
        background: #fff;
    }

    a {
        text-decoration: underline;
    }

    /* Show URLs after links */
    a[href]:after {
        content: " (" attr(href) ")";
    }
}