/* ============================================
   BEASTSTORE MOBILE OPTIMIZATION
   Phone-First Design Improvements
   ============================================ */

/* ========== BASE MOBILE FIXES ========== */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Improve touch response */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }
}

/* ========== NAVBAR MOBILE ========== */
@media (max-width: 768px) {
    .navbar {
        padding: 12px 16px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
    }

    .nav-brand .brand-text {
        font-size: 22px;
    }

    .nav-brand .logo {
        font-size: 32px;
    }

    /* Mobile menu improvements */
    .nav-links {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: rgba(254, 252, 250, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 12px 16px;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 0;
        font-size: 20px;
    }
}

/* ========== HERO SECTION MOBILE ========== */
@media (max-width: 768px) {
    .hero {
        padding: 80px 16px 40px;
        min-height: auto;
    }

    .hero-title {
        font-size: 1.75rem;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 24px;
    }

    .hero-actions {
        flex-direction: column;
        gap: 10px;
    }

    .hero-actions .btn {
        width: 100%;
        padding: 14px 20px;
    }

    .hero-stats {
        flex-wrap: wrap;
        gap: 12px;
        margin-top: 30px;
    }

    .stat-item {
        min-width: 70px;
    }

    .stat-num {
        font-size: 1.5rem;
    }

    .stat-label {
        font-size: 0.75rem;
    }
}

/* ========== PRODUCTS GRID MOBILE ========== */
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0 12px;
    }

    .product-card {
        border-radius: 16px;
    }

    .product-image {
        height: 140px;
    }

    .product-emoji {
        font-size: 50px;
    }

    .product-info {
        padding: 12px;
    }

    .product-name {
        font-size: 0.9rem;
        margin-bottom: 4px;
    }

    .product-personality {
        font-size: 0.75rem;
        margin-bottom: 6px;
    }

    .product-desc {
        font-size: 0.75rem;
        line-height: 1.4;
        margin-bottom: 8px;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .btn-add-cart {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .btn-favorite,
    .btn-share {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
}

/* Single column on very small screens */
@media (max-width: 360px) {
    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-image {
        height: 180px;
    }
}

/* ========== CATEGORY TABS MOBILE ========== */
@media (max-width: 768px) {
    .category-tabs {
        padding: 0 12px 24px;
        gap: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .category-tabs::-webkit-scrollbar {
        display: none;
    }

    .cat-tab {
        padding: 10px 16px;
        font-size: 0.875rem;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ========== CART SIDEBAR MOBILE ========== */
@media (max-width: 768px) {
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    .cart-header {
        padding: 16px 20px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
    }

    .cart-items {
        padding: 12px;
        padding-bottom: 180px;
    }

    .cart-item {
        gap: 10px;
        padding: 10px;
    }

    .cart-item-image {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }

    .cart-footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px 20px;
        background: white;
        box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
    }
}

/* ========== PRODUCT MODAL MOBILE ========== */
@media (max-width: 768px) {
    .product-modal {
        padding: 0;
        align-items: flex-end;
    }

    .product-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
        margin: 0;
        padding: 0;
        border-radius: 20px 20px 0 0;
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .modal-close {
        top: 12px;
        right: 12px;
        width: 44px;
        height: 44px;
        background: rgba(255,255,255,0.9);
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }

    .modal-product {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .modal-product-image {
        min-height: 240px;
        padding: 40px 20px;
        border-radius: 20px 20px 0 0;
    }

    .product-emoji-large {
        font-size: 120px;
    }

    .modal-product-info {
        padding: 20px;
        max-height: 50vh;
        overflow-y: auto;
    }

    .modal-product-info h2 {
        font-size: 1.5rem;
    }

    .modal-ai-personality {
        font-size: 0.9rem;
        padding: 10px 12px;
    }

    .modal-desc {
        font-size: 0.9rem;
    }

    .modal-specs {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .spec-item {
        padding: 10px 12px;
    }

    .modal-actions {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 16px 0;
        margin-top: 16px;
        border-top: 1px solid var(--border);
    }

    .modal-actions .btn-primary {
        padding: 14px;
        font-size: 1rem;
    }
}

/* ========== CHECKOUT MODAL MOBILE ========== */
@media (max-width: 768px) {
    .checkout-modal {
        align-items: flex-end;
        padding: 0;
    }

    .checkout-content {
        width: 100%;
        max-height: 90vh;
        margin: 0;
        border-radius: 20px 20px 0 0;
        animation: slideUp 0.3s ease;
    }

    .checkout-header {
        padding: 16px 20px;
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        border-radius: 20px 20px 0 0;
    }

    .checkout-body {
        padding: 16px 20px 100px;
        max-height: calc(90vh - 70px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 12px;
    }

    .payment-options {
        flex-direction: column;
        gap: 8px;
    }

    .payment-option {
        padding: 14px 16px;
        border-radius: 12px;
    }
}

/* ========== AI FEATURES MOBILE ========== */
@media (max-width: 768px) {
    .ai-features {
        padding: 0 12px 40px;
    }

    .ai-features-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .ai-feature-card {
        padding: 20px 12px;
    }

    .ai-feature-icon {
        font-size: 32px;
    }

    .ai-feature-card h4 {
        font-size: 0.9rem;
    }

    .ai-feature-card p {
        font-size: 0.75rem;
    }
}

/* ========== SCENARIOS MOBILE ========== */
@media (max-width: 768px) {
    .scenarios {
        padding: 0 12px 40px;
    }

    .scenarios-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .scenario-image-placeholder {
        height: 180px;
    }

    .scenario-content {
        padding: 16px;
    }
}

/* ========== FOOTER MOBILE ========== */
@media (max-width: 768px) {
    .footer {
        padding: 40px 16px 30px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .footer-links {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .footer-col h4 {
        font-size: 1rem;
        margin-bottom: 12px;
    }

    .footer-col a {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .trust-badges {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .trust-item {
        font-size: 0.85rem;
    }
}

/* ========== TOUCH DEVICE OPTIMIZATIONS ========== */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .product-card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }

    .btn:hover {
        transform: none;
    }

    /* Increase touch targets */
    .nav-link,
    .btn,
    .cat-tab {
        min-height: 44px;
    }

    /* Prevent text selection on buttons */
    button, .btn, .product-card {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
}

/* ========== IOS SPECIFIC FIXES ========== */
@supports (-webkit-touch-callout: none) {
    /* iOS input zoom fix */
    input, textarea, select {
        font-size: 16px !important;
    }

    /* iOS safe area */
    .navbar {
        padding-top: max(12px, env(safe-area-inset-top));
        padding-left: max(16px, env(safe-area-inset-left));
        padding-right: max(16px, env(safe-area-inset-right));
    }

    .cart-sidebar,
    .checkout-modal,
    .product-modal {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ========== ANIMATION REDUCE FOR PERFORMANCE ========== */
@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;
    }
}

/* ========== DARK MODE SUPPORT ========== */
@media (prefers-color-scheme: dark) {
    @media (max-width: 768px) {
        :root {
            --bg: #1a1a1a;
            --bg-card: #2d2d2d;
            --bg-warm: #2a1f1f;
            --text: #e0e0e0;
            --text-light: #b0b0b0;
            --border: #3d3d3d;
        }
    }
}
