/**
 * Responsive Styles - iOS-Inspired Mobile Design
 */

/* ===== Tablet (1024px and below) ===== */
@media (max-width: 1024px) {
    :root {
        --header-height: 70px;
    }

    body {
        padding-top: 90px;
    }

    .main-header {
        top: 12px;
        width: calc(100% - 32px);
    }

    .main-header.scrolled {
        top: 8px;
        width: calc(100% - 24px);
    }

    .header-content {
        padding: 10px 16px;
    }

    .logo svg {
        height: 36px;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 24px;
    }

    .stats-section {
        margin: 60px 20px;
        padding: 80px 40px;
        border-radius: 40px;
    }

    .stats-grid {
        gap: 40px;
    }

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

/* ===== Mobile (768px and below) ===== */
@media (max-width: 768px) {
    body {
        padding-top: 80px;
    }

    .container {
        padding: 0 var(--spacing-lg);
    }

    /* Header - Mobile */
    .main-header {
        top: 8px;
        width: calc(100% - 16px);
        border-radius: 20px;
    }

    .main-header.scrolled {
        top: 4px;
        width: calc(100% - 12px);
    }

    .header-content {
        padding: 8px 12px;
    }

    .logo svg {
        height: 32px;
    }

    /* Hide desktop nav, show mobile toggle */
    .main-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 32px;
        height: 32px;
        padding: 4px;
        background: rgba(246, 245, 242, 0.5);
        border: none;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.3s;
    }

    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }

    .mobile-menu-toggle span {
        width: 100%;
        height: 2.5px;
        background: var(--text-primary);
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
        transform: translateX(-20px);
    }

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

    /* Mobile Navigation */
    .mobile-nav {
        position: fixed;
        top: 72px;
        left: 8px;
        right: 8px;
        max-height: calc(100vh - 88px);
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(40px) saturate(180%);
        border: 1px solid rgba(255, 255, 255, 0.8);
        border-radius: 24px;
        box-shadow:
                0 20px 60px rgba(0, 0, 0, 0.15),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
        overflow-y: auto;
        z-index: var(--z-dropdown);
        animation: mobileNavSlide 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        transform-origin: top;
    }

    @keyframes mobileNavSlide {
        from {
            opacity: 0;
            transform: translateY(-20px) scale(0.95);
        }
        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }

    .mobile-nav.show {
        display: block;
    }

    .mobile-nav ul {
        list-style: none;
        padding: 20px;
    }

    .mobile-nav li {
        margin-bottom: 8px;
    }

    .mobile-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
        color: var(--text-primary);
        font-weight: var(--font-weight-medium);
        font-size: 16px;
        border-radius: 14px;
        transition: all 0.2s;
        background: transparent;
    }

    .mobile-nav a:active {
        transform: scale(0.98);
    }

    .mobile-nav a:hover,
    .mobile-nav a.active {
        background: rgba(77, 97, 244, 0.08);
        color: var(--primary-color);
    }

    .mobile-nav hr {
        margin: 16px 0;
        border: 0;
        height: 1px;
        background: var(--border-color);
    }

    .mobile-nav .btn {
        width: 100%;
        margin-top: 12px;
        justify-content: center;
    }

    .header-actions .btn-login,
    .header-actions .btn-signup {
        display: none;
    }

    .user-name {
        display: none;
    }

    /* Hero Section - Mobile */
    .hero-section {
        padding: 60px 0 80px;
    }

    .hero-badge {
        font-size: 13px;
        padding: 6px 16px;
    }

    .hero-title {
        font-size: clamp(32px, 8vw, 48px);
        margin-bottom: 20px;
    }

    .hero-description {
        font-size: 17px;
        margin-bottom: 32px;
    }

    .hero-actions {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 60px;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .hero-stat {
        padding: 20px 16px;
        border-radius: 20px;
    }

    .hero-stat-number {
        font-size: 36px;
    }

    .hero-stat-label {
        font-size: 13px;
    }

    /* Sections - Mobile */
    .features-section,
    .cta-section {
        padding: 60px 0;
    }

    .section-header {
        margin-bottom: 48px;
    }

    .section-badge {
        font-size: 11px;
        padding: 6px 16px;
    }

    .section-title {
        font-size: clamp(28px, 6vw, 40px);
    }

    .section-description {
        font-size: 17px;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .feature-card {
        padding: 28px 24px;
        border-radius: 24px;
    }

    .feature-icon {
        width: 60px;
        height: 60px;
        border-radius: 16px;
        margin-bottom: 20px;
    }

    .feature-icon svg {
        width: 28px;
        height: 28px;
    }

    .feature-title {
        font-size: 20px;
    }

    .feature-description {
        font-size: 15px;
    }

    /* Stats Section - Mobile */
    .stats-section {
        margin: 40px 12px;
        padding: 60px 24px;
        border-radius: 32px;
    }

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

    .stat-number {
        font-size: 40px;
    }

    .stat-label {
        font-size: 14px;
    }

    /* CTA Section - Mobile */
    .cta-container {
        padding: 48px 28px;
        border-radius: 32px;
    }

    .cta-title {
        font-size: clamp(24px, 5vw, 36px);
    }

    .cta-description {
        font-size: 16px;
        margin-bottom: 32px;
    }

    .cta-actions {
        flex-direction: column;
        gap: 12px;
    }

    .cta-actions .btn {
        width: 100%;
    }

    /* Footer - Mobile */
    .main-footer {
        padding: 60px 0 32px;
        margin-top: 60px;
        border-radius: 32px 32px 0 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 40px;
        margin-bottom: 40px;
        padding-bottom: 40px;
    }

    .footer-logo {
        font-size: 24px;
    }

    .footer-section h3 {
        font-size: 16px;
    }

    .footer-section a {
        font-size: 14px;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 16px;
    }

    /* Flash Messages - Mobile */
    .flash-message {
        top: 88px;
        left: 12px;
        right: 12px;
        min-width: auto;
        max-width: calc(100% - 24px);
        transform: none;
        border-radius: 16px;
    }

    /* Testimonials - Mobile */
    .testimonial-rating {
        font-size: 18px;
    }

    .testimonial-text {
        font-size: 15px;
        margin: 20px 0;
    }
}

/* ===== Small Mobile (480px and below) ===== */
@media (max-width: 480px) {
    .container {
        padding: 0 var(--spacing-md);
    }

    .main-header {
        width: calc(100% - 12px);
    }

    .header-content {
        padding: 6px 10px;
    }

    .logo svg {
        height: 28px;
    }

    .cart-icon {
        width: 36px;
        height: 36px;
    }

    .cart-count {
        min-width: 18px;
        height: 18px;
        font-size: 10px;
    }

    .user-menu-btn {
        padding: 4px 8px 4px 4px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 14px;
    }

    .btn-lg {
        padding: 14px 24px;
        font-size: 15px;
    }

    .hero-section {
        padding: 40px 0 60px;
    }

    .hero-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .hero-stat {
        padding: 16px;
    }

    .hero-stat-number {
        font-size: 32px;
    }

    .stats-section {
        padding: 48px 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .stat-number {
        font-size: 36px;
    }

    .feature-card {
        padding: 24px 20px;
    }

    .feature-icon {
        width: 56px;
        height: 56px;
    }

    .cta-container {
        padding: 36px 24px;
    }

    .social-links {
        justify-content: center;
    }
}

/* ===== Landscape Mobile ===== */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding-top: 70px;
    }

    .main-header {
        top: 6px;
    }

    .mobile-nav {
        top: 60px;
        max-height: calc(100vh - 72px);
    }

    .hero-section {
        padding: 40px 0;
    }
}

/* ===== Touch Device Optimizations ===== */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .btn {
        min-height: 44px;
    }

    .cart-icon,
    .user-menu-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .nav-menu a,
    .mobile-nav a {
        min-height: 44px;
    }

    /* Remove hover effects on touch */
    .feature-card:hover {
        transform: none;
    }

    /* Use active states instead */
    .btn:active {
        transform: scale(0.98);
    }

    .feature-card:active {
        transform: translateY(-4px);
    }
}

/* ===== Dark Mode Support (Optional) ===== */
@media (prefers-color-scheme: dark) {
    /* Keep light theme for now, but prepared for dark mode */
}

/* ===== Reduced Motion ===== */
@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;
    }

    .hero-badge,
    .feature-card {
        animation: none !important;
    }
}

/* ===== Print Styles ===== */
@media print {
    .main-header,
    .main-footer,
    .mobile-menu-toggle,
    .mobile-nav,
    .flash-message,
    .cta-section {
        display: none !important;
    }

    body {
        padding-top: 0;
        background: white;
    }

    .hero-section,
    .features-section,
    .stats-section {
        page-break-inside: avoid;
    }
}

/* ===== High Resolution Displays ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    .logo svg,
    .feature-icon svg {
        image-rendering: -webkit-optimize-contrast;
    }
}