/* Mobile-First CSS for Marketplace */

/* Mobile-specific variables */
:root {
    --mobile-header-height: 60px;
    --mobile-sidebar-width: 100%;
    --mobile-card-padding: 1rem;
    --mobile-font-size-base: 16px;
    --mobile-font-size-small: 14px;
    --mobile-font-size-large: 18px;
    --mobile-border-radius: 12px;
    --mobile-spacing: 0.75rem;
}

/* Mobile-specific base styles */
@media (max-width: 768px) {
    * {
        box-sizing: border-box;
    }
    
    body {
        font-size: var(--mobile-font-size-base);
        line-height: 1.5;
        -webkit-text-size-adjust: 100%;
        -webkit-font-smoothing: antialiased;
    }
    
    /* Mobile header optimizations */
    .header {
        padding: 0.5rem 0;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: linear-gradient(135deg, #A220E8 0%, #8B1FD9 100%);
        box-shadow: 0 4px 20px rgba(162, 32, 232, 0.3);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
    }
    
    .header .container {
        padding: 0 1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        min-height: 60px;
    }
    
    .logo-placeholder {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }
    
    .logo-text {
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    /* Mobile search optimization */
    .search-container {
        flex: 1;
        margin: 0 0.5rem;
        max-width: 200px;
    }
    
    .search-bar {
        font-size: var(--mobile-font-size-small);
        padding: 0.5rem 0.75rem;
        height: 36px;
    }
    
    .search-btn {
        width: 36px;
        height: 36px;
        padding: 0;
    }
    
    /* Mobile menu toggle */
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        width: 30px;
        height: 30px;
        background: transparent;
        border: none;
        cursor: pointer;
        padding: 0;
        z-index: 1001;
    }
    
    .mobile-menu-toggle span {
        width: 100%;
        height: 3px;
        background: white;
        border-radius: 2px;
        transition: all 0.3s ease;
        transform-origin: center;
    }
    
    .mobile-menu-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }
    
    .mobile-menu-toggle.active span:nth-child(2) {
        opacity: 0;
    }
    
    .mobile-menu-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }
    
    /* Mobile navigation */
    .nav {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #A220E8 0%, #8B1FD9 100%);
        flex-direction: column;
        padding: 1rem;
        gap: 0.5rem;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        box-shadow: 0 4px 20px rgba(162, 32, 232, 0.3);
    }
    
    .nav.active {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .nav-main,
    .nav-user {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .nav-user {
        border-top: 1px solid rgba(255, 255, 255, 0.2);
        padding-top: 1rem;
        margin-top: 0.5rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        border-radius: 6px;
        white-space: nowrap;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Hide some nav links on very small screens */
    .nav-link:not(.logo-placeholder):nth-child(n+4) {
        display: none;
    }
    
    /* Mobile main content adjustments */
    .main-content {
        padding: 1rem 0;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    /* Mobile layout adjustments */
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Mobile sidebar */
    .sidebar {
        order: 2;
        position: static;
        margin-bottom: 1rem;
        padding: 1rem;
        border-radius: var(--mobile-border-radius);
    }
    
    .sidebar-title {
        font-size: var(--mobile-font-size-large);
        margin-bottom: 1rem;
    }
    
    .category-list {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .category-item {
        margin-bottom: 0;
        flex: 1;
        min-width: 120px;
    }
    
    .category-link {
        padding: 0.75rem;
        font-size: var(--mobile-font-size-small);
        text-align: center;
        justify-content: center;
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .category-icon {
        font-size: 1.5rem;
    }
    
    /* Mobile products section */
    .products-section {
        order: 1;
        padding: 1rem;
        border-radius: var(--mobile-border-radius);
    }
    
    .section-title {
        font-size: var(--mobile-font-size-large);
        margin-bottom: 1.5rem;
    }
    
    /* Mobile product grid */
    .products-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Mobile product cards */
    .product-card {
        margin: 0 auto;
        max-width: 100%;
        border-radius: var(--mobile-border-radius);
    }
    
    .product-image {
        width: 100%;
        height: 200px;
        margin: 0;
        border-radius: var(--mobile-border-radius) var(--mobile-border-radius) 0 0;
    }
    
    .image-placeholder {
        font-size: 3rem;
    }
    
    .product-info {
        padding: var(--mobile-card-padding);
    }
    
    .product-name {
        font-size: var(--mobile-font-size-large);
        margin-bottom: 0.5rem;
    }
    
    .product-description {
        font-size: var(--mobile-font-size-small);
        margin-bottom: 0.75rem;
    }
    
    .product-price {
        font-size: var(--mobile-font-size-large);
        margin-bottom: 0.75rem;
    }
    
    .add-to-cart-btn {
        padding: 0.875rem;
        font-size: var(--mobile-font-size-base);
        border-radius: var(--mobile-border-radius);
    }
    
    /* Mobile footer */
    .footer {
        margin-top: 2rem;
        padding: 1.5rem 0;
    }
    
    .footer p {
        font-size: var(--mobile-font-size-small);
        padding: 0 1rem;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .header .container {
        padding: 0 0.75rem;
        gap: 0.25rem;
    }
    
    .logo-text {
        display: none; /* Hide logo text on very small screens */
    }
    
    .search-container {
        max-width: 150px;
        margin: 0 0.25rem;
    }
    
    .search-bar {
        font-size: 0.8rem;
        padding: 0.4rem 0.6rem;
        height: 32px;
    }
    
    .search-btn {
        width: 32px;
        height: 32px;
    }
    
    .nav-link {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
        min-height: 28px;
    }
    
    /* Show only essential nav links */
    .nav-link:nth-child(n+3) {
        display: none;
    }
    
    .container {
        padding: 0 0.75rem;
    }
    
    .sidebar {
        padding: 0.75rem;
    }
    
    .products-section {
        padding: 0.75rem;
    }
    
    .product-info {
        padding: 0.75rem;
    }
    
    .category-item {
        min-width: 100px;
    }
    
    .category-link {
        padding: 0.5rem;
        font-size: 12px;
    }
    
    .category-icon {
        font-size: 1.2rem;
    }
}

/* Mobile touch optimizations */
@media (max-width: 768px) {
    /* Touch-friendly button sizes */
    .add-to-cart-btn,
    .auth-btn,
    .search-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Touch-friendly navigation */
    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Touch-friendly form inputs */
    .form-input {
        min-height: 44px;
        font-size: var(--mobile-font-size-base);
    }
    
    /* Touch-friendly checkboxes */
    .checkmark {
        min-width: 24px;
        min-height: 24px;
    }
    
    /* Improved mobile scrolling */
    .main-content {
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }
    
    /* Mobile-specific animations */
    .product-card:hover {
        transform: none;
    }
    
    .product-card:active {
        transform: scale(0.98);
    }
    
    /* Mobile search improvements */
    .search-container:focus-within {
        box-shadow: 0 0 0 3px rgba(162, 32, 232, 0.3);
    }
    
    /* Mobile category improvements */
    .category-link:active {
        transform: scale(0.95);
    }
}

/* Mobile landscape orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        height: auto;
        padding: 0.5rem 0;
    }
    
    .main-content {
        padding-top: 1rem;
    }
    
    .content-wrapper {
        grid-template-columns: 200px 1fr;
        gap: 1rem;
    }
    
    .sidebar {
        order: 1;
        position: sticky;
        top: 80px;
    }
    
    .products-section {
        order: 2;
    }
}

/* Mobile performance optimizations */
@media (max-width: 768px) {
    /* Reduce animations on mobile for better performance */
    .product-card,
    .category-link,
    .nav-link {
        transition: all 0.2s ease;
    }
    
    /* Optimize shadows for mobile */
    .product-card {
        box-shadow: 0 2px 8px rgba(162, 32, 232, 0.15);
    }
    
    .product-card:active {
        box-shadow: 0 1px 4px rgba(162, 32, 232, 0.2);
    }
    
    /* Mobile-specific loading states */
    .loading {
        pointer-events: none;
        opacity: 0.7;
    }
}

/* Mobile accessibility improvements */
@media (max-width: 768px) {
    /* Better focus indicators for mobile */
    .form-input:focus,
    .add-to-cart-btn:focus,
    .nav-link:focus {
        outline: 2px solid #A220E8;
        outline-offset: 2px;
    }
    
    /* Improved contrast for mobile */
    .product-description {
        color: #ddd;
    }
    
    .form-label {
        color: #f5f5f5;
    }
    
    /* Better touch targets */
    .category-link,
    .nav-link {
        touch-action: manipulation;
    }
} 