/* AIBetSync Mobile Optimization for Android & iOS */
/* Responsive Design and Touch-Friendly Interface */

/* Mobile Viewport and Base Settings */
@viewport {
    width: device-width;
    initial-scale: 1.0;
    maximum-scale: 1.0;
    user-scalable: no;
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Android Chrome specific optimizations */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Mobile-First Responsive Breakpoints */
/* Small phones (320px - 480px) */
@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
        line-height: 1.4;
        overflow-x: hidden;
    }
    
    .container {
        padding: 10px;
        max-width: 100%;
    }
    
    /* Terminal Container Mobile Optimization */
    .terminal-container {
        width: 95%;
        max-width: none;
        margin: 10px;
        transform: translate(-50%, -50%);
        min-height: auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .terminal-content {
        padding: 15px;
        min-height: auto;
    }
    
    /* Header Mobile Optimization */
    header {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .header-top {
        position: relative;
        flex-direction: column;
        gap: 10px;
        padding: 0;
    }
    
    .user-info-left {
        justify-content: center;
        font-size: 11px;
    }
    
    .language-toggle {
        justify-content: center;
    }
    
    .lang-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    /* Logo Mobile Optimization */
    .logo {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo i {
        font-size: 2rem;
    }
    
    .logo h1 {
        font-size: 1.5rem;
        text-align: center;
    }
    
    /* ASCII Art Mobile Optimization */
    .ascii-art {
        font-size: 0.5rem;
        line-height: 0.8;
        overflow-x: auto;
        white-space: nowrap;
        padding: 10px 0;
    }
    
    /* Form Elements Mobile Optimization */
    .input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        margin-bottom: 15px;
    }
    
    .terminal-label {
        min-width: auto;
        text-align: left;
        font-size: 0.9rem;
    }
    
    .terminal-input {
        padding: 12px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
        border-radius: 8px;
        min-height: 44px; /* iOS touch target minimum */
    }
    
    /* Button Mobile Optimization */
    .hack-btn, .analyze-btn, .back-btn {
        width: 100%;
        padding: 15px 20px;
        font-size: 1rem;
        margin: 10px 0;
        min-height: 44px;
        border-radius: 8px;
        touch-action: manipulation;
    }
    
    .logout-btn-fixed {
        bottom: 10px;
        right: 10px;
        padding: 10px 15px;
        font-size: 12px;
    }
    
    /* Cards and Grid Mobile Optimization */
    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .game-info {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .game-provider, .game-volatility, .game-rtp {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    /* Action Buttons Mobile */
    .action-buttons {
        flex-direction: column;
        gap: 10px;
        margin-top: 20px;
    }
    
    /* System Info Mobile */
    .system-info {
        padding: 10px;
        margin: 15px 0;
    }
    
    .info-line {
        font-size: 0.8rem;
        word-break: break-word;
    }
}

/* Medium phones (481px - 768px) */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .terminal-container {
        width: 90%;
        max-width: 600px;
    }
    
    .terminal-content {
        padding: 20px;
    }
    
    .ascii-art {
        font-size: 0.6rem;
    }
    
    .input-group {
        flex-direction: row;
        align-items: center;
    }
    
    .terminal-input {
        font-size: 15px;
    }
    
    .hack-btn, .analyze-btn, .back-btn {
        width: auto;
        min-width: 200px;
    }
}

/* Tablets (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .terminal-container {
        width: 80%;
        max-width: 700px;
    }
    
    .analysis-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Touch-Friendly Enhancements */
.touch-friendly {
    min-height: 44px;
    min-width: 44px;
    padding: 12px;
    border-radius: 8px;
    touch-action: manipulation;
}

/* iOS Specific Optimizations */
@supports (-webkit-appearance: none) {
    .terminal-input {
        -webkit-appearance: none;
        border-radius: 8px;
    }
    
    .hack-btn, .analyze-btn, .back-btn {
        -webkit-appearance: none;
        border-radius: 8px;
    }
}

/* Android Specific Optimizations */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    .terminal-input:focus {
        outline: none;
        border: 2px solid #00ff00;
    }
    
    .hack-btn:active, .analyze-btn:active, .back-btn:active {
        transform: scale(0.98);
    }
}

/* Landscape Orientation Optimizations */
@media screen and (orientation: landscape) and (max-height: 500px) {
    .terminal-container {
        max-height: 95vh;
        overflow-y: auto;
    }
    
    .terminal-content {
        padding: 10px 20px;
    }
    
    .ascii-art {
        margin: 10px 0;
    }
    
    .system-info {
        margin: 10px 0;
    }
    
    .boot-sequence {
        margin-bottom: 10px;
    }
}

/* High DPI Display Optimizations */
@media screen and (-webkit-min-device-pixel-ratio: 2) {
    .logo i {
        text-shadow: 0 0 10px #00bfff, 0 0 20px #8a2be2;
    }
    
    .terminal-title {
        text-shadow: 0 0 8px rgba(0, 191, 255, 0.5);
    }
    
    .ascii-art {
        text-shadow: 0 0 5px #00ff00;
    }
}

/* Dark Mode Enhancements for Mobile */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #000000 0%, #0a0a1a 50%, #0f0f2e 100%);
    }
    
    .terminal-container {
        background: rgba(5, 5, 15, 0.98);
        border-color: #00bfff;
    }
}

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .matrix-bg::before {
        animation: none;
    }
    
    .glitch-overlay {
        animation: none;
    }
}

/* Focus Indicators for Accessibility */
.terminal-input:focus,
.hack-btn:focus,
.analyze-btn:focus,
.back-btn:focus,
.lang-btn:focus {
    outline: 2px solid #00bfff;
    outline-offset: 2px;
}

/* Loading States for Mobile */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #00bfff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Swipe Gestures Support */
.swipe-container {
    touch-action: pan-x pan-y;
    overflow: hidden;
}

/* Mobile Menu Optimizations */
.mobile-menu {
    display: none;
}

@media screen and (max-width: 768px) {
    .mobile-menu {
        display: block;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 1001;
        background: rgba(0, 191, 255, 0.1);
        border: 1px solid rgba(0, 191, 255, 0.3);
        border-radius: 8px;
        padding: 8px;
        color: #00bfff;
        font-size: 18px;
        cursor: pointer;
        touch-action: manipulation;
    }
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    .terminal-container {
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
}

/* Android Navigation Bar Support */
@media screen and (max-height: 600px) {
    .logout-btn-fixed {
        bottom: max(10px, env(safe-area-inset-bottom));
    }
}