/**
 * Enhanced Mobile Styles for Souq Marketplace
 * Advanced mobile optimizations and responsive design
 */

/* Mobile-first approach */
:root {
    --mobile-padding: 1rem;
    --mobile-margin: 0.5rem;
    --mobile-border-radius: 8px;
    --mobile-shadow: 0 2px 8px rgba(0,0,0,0.1);
    --mobile-transition: all 0.3s ease;
    --touch-target-size: 44px;
}

/* Enhanced mobile typography */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        line-height: 1.5;
        -webkit-text-size-adjust: 100%;
        -ms-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }
    
    h1, h2, h3, h4, h5, h6 {
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }
    
    p {
        margin-bottom: 1rem;
        line-height: 1.6;
    }
}

/* Enhanced mobile navigation */
@media (max-width: 768px) {
    .navbar-collapse {
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(10px);
        border-radius: 0 0 var(--mobile-border-radius) var(--mobile-border-radius);
        box-shadow: var(--mobile-shadow);
        margin-top: 0.5rem;
        padding: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.75rem 1rem;
        border-radius: var(--mobile-border-radius);
        margin-bottom: 0.25rem;
        transition: var(--mobile-transition);
        min-height: var(--touch-target-size);
        display: flex;
        align-items: center;
    }
    
    .navbar-nav .nav-link:hover,
    .navbar-nav .nav-link:focus {
        background-color: rgba(0, 123, 255, 0.1);
        color: #007bff;
    }
    
    .navbar-nav .nav-link.active {
        background-color: #007bff;
        color: white;
    }
}

/* Enhanced mobile hero section */
@media (max-width: 768px) {
    .hero-section {
        min-height: 40vh;
        padding: 2rem 0;
        position: relative;
        overflow: hidden;
    }
    
    .hero-title {
        font-size: 1.75rem;
        font-weight: 700;
        margin-bottom: 1rem;
        text-shadow: 0 2px 4px rgba(0,0,0,0.1);
        animation: slideInUp 0.8s ease-out;
    }
    
    .hero-tagline {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        opacity: 0.95;
        animation: slideInUp 0.8s ease-out 0.2s both;
    }
    
    .stats-container {
        animation: slideInUp 0.8s ease-out 0.4s both;
    }
    
    .hero-actions {
        animation: slideInUp 0.8s ease-out 0.6s both;
    }
}

/* Enhanced mobile product grid */
@media (max-width: 768px) {
    .product-grid-mobile {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0 0.5rem;
    }
    
    .product-card {
        border-radius: var(--mobile-border-radius);
        overflow: hidden;
        box-shadow: var(--mobile-shadow);
        transition: var(--mobile-transition);
        background: white;
        position: relative;
    }
    
    .product-card:active {
        transform: scale(0.98);
        box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    }
    
    .product-img {
        height: 160px;
        object-fit: cover;
        width: 100%;
        transition: transform 0.3s ease;
    }
    
    .product-card:hover .product-img {
        transform: scale(1.05);
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .product-title {
        font-size: 0.85rem;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 0.5rem;
        color: #333;
    }
    
    .store-info {
        font-size: 0.7rem;
        color: #666;
        margin-bottom: 0.5rem;
    }
    
    .price-current {
        font-size: 0.9rem;
        font-weight: 700;
        color: #007bff;
    }
    
    .price-old {
        font-size: 0.75rem;
        color: #999;
        text-decoration: line-through;
    }
}

/* Enhanced mobile forms */
@media (max-width: 768px) {
    .form-control {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 0.75rem 1rem;
        border-radius: var(--mobile-border-radius);
        border: 2px solid #e9ecef;
        transition: var(--mobile-transition);
        min-height: var(--touch-target-size);
    }
    
    .form-control:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        outline: none;
    }
    
    .btn {
        min-height: var(--touch-target-size);
        padding: 0.75rem 1.5rem;
        border-radius: var(--mobile-border-radius);
        font-weight: 600;
        transition: var(--mobile-transition);
        border: none;
        cursor: pointer;
    }
    
    .btn:active {
        transform: scale(0.98);
    }
    
    .btn-primary {
        background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
        color: white;
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    }
    
    .btn-primary:hover,
    .btn-primary:focus {
        background: linear-gradient(135deg, #0056b3 0%, #004085 100%);
        box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
    }
}

/* Enhanced mobile cards */
@media (max-width: 768px) {
    .card {
        border-radius: var(--mobile-border-radius);
        border: none;
        box-shadow: var(--mobile-shadow);
        margin-bottom: 1rem;
        overflow: hidden;
    }
    
    .card-header {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-bottom: 1px solid #dee2e6;
        padding: 1rem;
        font-weight: 600;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-footer {
        background: #f8f9fa;
        border-top: 1px solid #dee2e6;
        padding: 0.75rem 1rem;
    }
}

/* Enhanced mobile modals */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    .modal-content {
        border-radius: var(--mobile-border-radius);
        border: none;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    
    .modal-header {
        padding: 1rem;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-body {
        padding: 1rem;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .modal-footer {
        padding: 1rem;
        border-top: 1px solid #dee2e6;
    }
}

/* Enhanced mobile alerts */
@media (max-width: 768px) {
    .alert {
        border-radius: var(--mobile-border-radius);
        padding: 1rem;
        margin-bottom: 1rem;
        border: none;
        box-shadow: var(--mobile-shadow);
    }
    
    .alert-success {
        background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
        color: #155724;
    }
    
    .alert-danger {
        background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
        color: #721c24;
    }
    
    .alert-warning {
        background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
        color: #856404;
    }
    
    .alert-info {
        background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
        color: #0c5460;
    }
}

/* Mobile animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Mobile utility classes */
@media (max-width: 768px) {
    .mobile-hidden { display: none !important; }
    .mobile-visible { display: block !important; }
    .mobile-text-center { text-align: center !important; }
    .mobile-text-left { text-align: left !important; }
    .mobile-text-right { text-align: right !important; }
    .mobile-full-width { width: 100% !important; }
    .mobile-no-padding { padding: 0 !important; }
    .mobile-no-margin { margin: 0 !important; }
    .mobile-small-padding { padding: 0.5rem !important; }
    .mobile-small-margin { margin: 0.5rem !important; }
}

/* Force light mode for mobile - Override dark mode */
@media (max-width: 768px) {
    body, .card, .modal-content, .navbar-collapse {
        background: #ffffff !important;
        color: #333333 !important;
    }

    .form-control {
        background: #ffffff !important;
        border-color: #e9ecef !important;
        color: #333333 !important;
    }

    .btn-primary {
        background: linear-gradient(135deg, #007bff 0%, #0056b3 100%) !important;
        color: #ffffff !important;
    }

    .text-white {
        color: #333333 !important;
    }

    .bg-dark {
        background: #f8f9fa !important;
        color: #333333 !important;
    }
}

/* High contrast mode for mobile */
@media (max-width: 768px) and (prefers-contrast: high) {
    .btn, .card, .form-control {
        border: 2px solid currentColor;
    }
    
    .product-card {
        border: 2px solid #333;
    }
}

/* Reduced motion for mobile */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .product-card:hover,
    .btn:active {
        transform: none !important;
    }
}
