/* =====================================================
   छत्रपती शिवाजी महाराज चषक - Enhanced Mobile Styles
   Mobile-First, Touch-Optimized Design
   ===================================================== */

/* Mobile Base Improvements */
@media (max-width: 768px) {

    /* Better touch targets */
    button,
    .btn,
    a {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Larger, more readable text */
    body {
        font-size: 16px;
        /* Prevents zoom on iOS */
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    /* Better spacing */
    section {
        padding: 3rem 0;
    }

    .container {
        padding: 0 1rem;
    }
}

/* Mobile Navigation Enhancements */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 0;
    }

    .nav-brand {
        font-size: 1.2rem;
    }

    .nav-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-card);
        flex-direction: column;
        padding: 2rem 0;
        max-height: 0;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease, max-height 0.3s ease;
        box-shadow: var(--shadow-lg);
    }

    .nav-menu.active {
        max-height: calc(100vh - 60px);
        transform: translateX(0);
    }

    .nav-menu li {
        width: 100%;
        padding: 0 1rem;
        margin-bottom: 0.5rem;
    }

    .nav-menu a {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
        border-radius: var(--border-radius);
    }

    /* Hamburger animation */
    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }
}

/* Hero Section - Mobile */
@media (max-width: 768px) {
    .hero {
        height: 70vh;
        min-height: 500px;
    }

    .hero-title {
        font-size: 2rem;
        padding: 0 1rem;
    }

    .hero-subtitle {
        font-size: 1.1rem;
        padding: 0 1rem;
    }

    .hero-badge {
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
    }

    .hero-cta {
        flex-direction: column;
        width: 100%;
        padding: 0 1rem;
    }

    .hero-cta .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Cards - Mobile Optimized */
@media (max-width: 768px) {

    .stat-card,
    .feature-card,
    .team-card,
    .player-card {
        margin-bottom: 1rem;
    }

    /* Stack cards vertically */
    .stats-grid,
    .features-grid,
    .teams-grid,
    .players-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    /* Swipeable card hint */
    .card-container {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .card-container::-webkit-scrollbar {
        display: none;
    }

    .card-container>* {
        scroll-snap-align: start;
    }
}

/* Forms - Mobile Friendly */
@media (max-width: 768px) {

    input,
    select,
    textarea {
        font-size: 16px;
        /* Prevents iOS zoom */
        padding: 1rem;
        border-radius: var(--border-radius);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
        padding: 1rem 2rem;
        font-size: 1rem;
    }
}

/* Tables - Mobile Responsive */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.85rem;
    }

    th,
    td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Card-style table for mobile */
    .mobile-card-table {
        display: block;
    }

    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table tr {
        display: block;
        margin-bottom: 1rem;
        background: var(--bg-card);
        border-radius: var(--border-radius);
        padding: 1rem;
        box-shadow: var(--shadow-sm);
    }

    .mobile-card-table td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border-bottom: 1px solid var(--border-light);
    }

    .mobile-card-table td:last-child {
        border-bottom: none;
    }

    .mobile-card-table td::before {
        content: attr(data-label);
        font-weight: bold;
        color: var(--text-secondary);
    }
}

/* Footer - Mobile */
/* Footer rules removed - now handled centrally by contact-override.css */
/* This ensures consistent footer styling across all pages */
/* Footer component is loaded via footer-loader.js */

/* Touch Feedback */
@media (hover: none) and (pointer: coarse) {

    /* Active states for touch */
    button:active,
    .btn:active,
    a:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    /* Remove hover effects */
    *:hover {
        transform: none !important;
    }

    /* Add touch ripple effect */
    .touch-ripple {
        position: relative;
        overflow: hidden;
    }

    .touch-ripple::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.5);
        transform: translate(-50%, -50%);
        transition: width 0.3s, height 0.3s;
    }

    .touch-ripple:active::after {
        width: 200px;
        height: 200px;
    }
}

/* Landscape Mode - Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        height: 100vh;
    }

    .nav-menu {
        top: 50px;
    }

    .nav-menu.active {
        max-height: calc(100vh - 50px);
    }
}

/* Small Mobile (< 375px) */
@media (max-width: 374px) {
    .hero-title {
        font-size: 1.75rem;
    }

    .stat-number {
        font-size: 2rem;
    }

    .nav-brand span {
        font-size: 1rem;
    }
}

/* Large Mobile / Small Tablet (576px - 768px) */
@media (min-width: 576px) and (max-width: 768px) {

    .stats-grid,
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Tablet (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .features-grid,
    .teams-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-title {
        font-size: 3rem;
    }
}

/* PWA Support - Full Screen */
@media (display-mode: standalone) {
    .navbar {
        padding-top: env(safe-area-inset-top);
    }

    body {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* iOS Specific */
@supports (-webkit-touch-callout: none) {

    /* iOS safe area */
    .navbar {
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    /* Prevent iOS bounce */
    body {
        position: fixed;
        overflow: hidden;
        width: 100%;
        height: 100%;
    }

    .main-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        height: 100%;
    }
}

/* Android Specific */
@media (hover: none) and (pointer: coarse) {

    /* Smoother scrolling on Android */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* Better touch response */
    button,
    .btn,
    a {
        -webkit-user-select: none;
        user-select: none;
    }
}

/* Accessibility - Mobile */
@media (max-width: 768px) {

    /* Larger focus indicators */
    *:focus {
        outline: 3px solid var(--primary-color);
        outline-offset: 2px;
    }

    /* Skip to content link */
    .skip-link {
        position: absolute;
        top: -40px;
        left: 0;
        background: var(--primary-color);
        color: var(--text-inverse);
        padding: 8px;
        text-decoration: none;
        z-index: 100;
    }

    .skip-link:focus {
        top: 0;
    }
}

/* Loading States - Mobile */
.mobile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 2rem;
}

.mobile-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Pull to Refresh Indicator */
.ptr-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem;
    background: var(--bg-card);
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: opacity 0.3s;
}

.ptr-indicator.active {
    opacity: 1;
}

/* Bottom Sheet for Mobile */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-radius: var(--border-radius-xl) var(--border-radius-xl) 0 0;
    padding: 1.5rem;
    box-shadow: var(--shadow-xl);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.bottom-sheet.open {
    transform: translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    margin: 0 auto 1rem;
}

/* Swipe Gestures */
.swipeable {
    touch-action: pan-y;
}

.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity 0.3s;
}

.swipe-indicator.left {
    left: 1rem;
}

.swipe-indicator.right {
    right: 1rem;
}

.swiping .swipe-indicator {
    opacity: 1;
}

/* Mobile Scroll Fix - Only for non-home pages */
@media (max-width: 768px) {

    /* Ensure body can scroll vertically on mobile */
    html {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    body {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-y;
    }

    /* Ensure sections don't block scrolling */
    section,
    .fixtures-section,
    .format-section,
    .about-content {
        overflow-y: visible;
        overflow-x: hidden;
    }
}