/* 
 * Mobile-Only Responsiveness - CryptoAgent
 * Optimized exclusively for mobile devices (320px - 428px)
 * All desktop code removed - mobile-first architecture
 */

/* ===== BASE MOBILE SETTINGS ===== */
html {
    font-size: 16px;
    /* Good for accessibility, prevents iOS zoom on input focus */
    -webkit-text-size-adjust: 100%;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;
    /* Prevent pull-to-refresh on body */
    touch-action: pan-y pinch-zoom;
    /* Allow vertical scroll and pinch zoom */
}

/* ===== TOUCH OPTIMIZATIONS ===== */
/* All clickable elements have proper touch targets */
button,
a,
.clickable,
[onclick] {
    min-width: var(--touch-target-min);
    min-height: var(--touch-target-min);
    -webkit-tap-highlight-color: transparent;
}

/* Remove iOS input zoom */
input,
select,
textarea {
    font-size: 16px !important;
}

/* ===== RESPONSIVE BREAKPOINTS - MOBILE ONLY ===== */

/* Extra Small Devices (iPhone SE, older Android) - 320px - 374px */
@media (max-width: 374px) {
    html {
        font-size: 14px;
    }

    .view-container {
        padding: 12px;
    }

    .card {
        padding: 16px;
        margin-bottom: 12px;
    }

    .coin-row {
        padding: 12px;
        gap: 10px;
    }

    .stat-pill {
        min-width: 100px;
        padding: 8px 12px;
    }

    .logo-text {
        font-size: 16px;
    }

    .card-title {
        font-size: 18px;
    }
}

/* Small Devices (iPhone 13 mini, Pixel 5) - 375px - 389px */
@media (min-width: 375px) and (max-width: 389px) {
    html {
        font-size: 15px;
    }
}

/* Standard Devices (iPhone 13/14, most Android) - 390px - 413px */
@media (min-width: 390px) and (max-width: 413px) {
    html {
        font-size: 16px;
    }
}

/* Large Devices (iPhone 14 Plus, Android phablets) - 414px+ */
@media (min-width: 414px) {
    html {
        font-size: 17px;
    }

    .view-container {
        padding: 20px;
    }

    .card {
        padding: 24px;
    }
}

/* ===== LANDSCAPE MODE OPTIMIZATION ===== */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 8px 16px;
    }

    .bottom-nav {
        height: 60px;
    }

    body {
        padding-bottom: 60px;
    }

    .ai-drawer {
        top: 50px;
        bottom: 60px;
    }

    .modal-content {
        max-height: 85vh;
    }

    /* Reduce vertical spacing in landscape */
    .card {
        margin-bottom: 12px;
        padding: 16px;
    }

    .mobile-stats {
        margin-bottom: 16px;
    }
}

/* ===== FOLDABLE DEVICE SUPPORT ===== */
@media (min-width: 653px) and (max-width: 912px) {

    /* Galaxy Z Fold unfolded state */
    .view-container {
        max-width: 600px;
        margin: 0 auto;
    }
}

/* ===== SAFE AREA SUPPORT FOR NOTCHED DEVICES ===== */
@supports (padding: max(0px)) {
    body {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(70px, calc(70px + env(safe-area-inset-bottom)));
    }

    .header {
        padding-top: max(12px, calc(12px + env(safe-area-inset-top)));
    }

    .bottom-nav {
        height: max(70px, calc(70px + env(safe-area-inset-bottom)));
        padding-bottom: env(safe-area-inset-bottom);
    }

    .ai-drawer {
        top: max(60px, calc(60px + env(safe-area-inset-top)));
        bottom: max(70px, calc(70px + env(safe-area-inset-bottom)));
    }

    .modal-bottom-sheet .sheet-content {
        padding-bottom: max(20px, calc(20px + env(safe-area-inset-bottom)));
    }
}

/* ===== PULL-TO-REFRESH STYLING ===== */
.pull-to-refresh-container {
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

.pull-indicator {
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    transition: top var(--duration-fast) ease;
    z-index: 10;
}

.pull-indicator.active {
    top: 10px;
}

/* ===== MOBILE-SPECIFIC UTILITY CLASSES ===== */
.mobile-only {
    display: block;
}

.desktop-only {
    display: none !important;
}

/* Hide scrollbars but allow scrolling */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Touch feedback */
.touch-feedback {
    transition: transform var(--touch-feedback-duration) ease,
        opacity var(--touch-feedback-duration) ease;
}

.touch-feedback:active {
    transform: scale(var(--touch-scale-active));
    opacity: var(--touch-opacity-active);
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* GPU acceleration for smooth animations */
.gpu-accelerated {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    will-change: transform;
}

/* Optimize for scrolling performance */
.scroll-container {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
    overscroll-behavior-y: contain;
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {

    .card,
    .coin-row,
    .btn {
        border-width: 2px;
    }
}

/* Dark mode optimization (already dark, but ensure consistency) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: var(--bg-base);
    }
}

/* ===== PRINT STYLES (MOBILE) ===== */
@media print {

    .header,
    .bottom-nav,
    .ai-drawer,
    .modal-bottom-sheet {
        display: none !important;
    }

    body {
        padding: 0;
        background: white;
        color: black;
    }

    .card {
        break-inside: avoid;
        border: 1px solid #ccc;
        box-shadow: none;
    }
}