/* Mobile Optimization CSS for NextGen.DZ Public Site */

/* ===== MOBILE-FIRST RESPONSIVE DESIGN ===== */

/* Base mobile optimizations */
@media (max-width: 768px) {
    /* Typography improvements for mobile */
    body {
        font-size: 16px;
        line-height: 1.5;
        -webkit-text-size-adjust: 100%;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.125rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.875rem; }
    
    /* Container adjustments */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    /* Spacing adjustments */
    .py-8 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    .py-12 { padding-top: 2rem; padding-bottom: 2rem; }
    .py-16 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
    .py-20 { padding-top: 3rem; padding-bottom: 3rem; }
    
    .px-4 { padding-left: 1rem; padding-right: 1rem; }
    .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
    .px-8 { padding-left: 2rem; padding-right: 2rem; }
    
    .my-4 { margin-top: 1rem; margin-bottom: 1rem; }
    .my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
    .my-8 { margin-top: 2rem; margin-bottom: 2rem; }
    
    /* Grid adjustments */
    .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    
    /* Flex adjustments */
    .flex-row { flex-direction: column; }
    .flex-row-reverse { flex-direction: column-reverse; }
    
    /* Button optimizations */
    .btn, button {
        min-height: 44px;
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 12px;
        touch-action: manipulation;
    }
    
    /* Input optimizations */
    input, textarea, select {
        min-height: 44px;
        font-size: 16px;
        padding: 12px 16px;
        border-radius: 12px;
    }
    
    /* Card optimizations */
    .card {
        border-radius: 16px;
        padding: 1.5rem;
        margin-bottom: 1rem;
    }
    
    /* Image optimizations */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* Link optimizations */
    a:not(.categories-title):not(.categories-badge) {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===== CATEGORY HEADER MOBILE FIX ===== */
@media (max-width: 768px) {
    /* Ensure category headers are always visible on mobile */
    .categories-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin-bottom: 20px !important;
    }
    
    .categories-badge {
        display: inline-flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        font-size: 0.7rem !important;
        padding: 4px 10px !important;
    }
    
    .categories-title {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        text-align: center !important;
        font-size: 1.8rem !important;
        line-height: 1.1 !important;
        font-weight: 700 !important;
        color: #111827 !important;
    }
    
    .categories-title span {
        display: inline !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* ===== HERO SECTION MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1rem;
        text-align: center;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
        margin-bottom: 1rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
        line-height: 1.4;
        margin-bottom: 1.5rem;
    }
    
    .hero-description {
        font-size: 1rem;
        line-height: 1.5;
        margin-bottom: 2rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .hero-button {
        width: 100%;
        max-width: 280px;
        padding: 16px 24px;
        font-size: 16px;
        font-weight: 600;
    }
    
    .hero-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        margin-top: 2rem;
    }
    
    .hero-stat {
        padding: 1rem;
        text-align: center;
    }
    
    .hero-stat-number {
        font-size: 1.5rem;
        font-weight: 700;
    }
    
    .hero-stat-label {
        font-size: 0.875rem;
    }
}

/* ===== PRODUCT CARDS MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .product-card {
        border-radius: 16px;
        padding: 1rem;
        margin-bottom: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .product-image {
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .product-title {
        font-size: 1rem;
        font-weight: 600;
        line-height: 1.3;
        margin-bottom: 0.5rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    
    .product-price {
        font-size: 1.125rem;
        font-weight: 700;
        margin-bottom: 0.5rem;
    }
    
    .product-original-price {
        font-size: 0.875rem;
        text-decoration: line-through;
        color: #6b7280;
    }
    
    .product-discount {
        font-size: 0.75rem;
        padding: 2px 6px;
        border-radius: 4px;
        font-weight: 600;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .product-button {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 600;
    }
}

/* ===== CATEGORY SHOWCASE MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .category-showcase {
        padding: 2rem 1rem;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .category-card {
        border-radius: 16px;
        padding: 1.5rem 1rem;
        text-align: center;
        min-height: 120px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }
    
    .category-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 0.75rem;
    }
    
    .category-name {
        font-size: 0.875rem;
        font-weight: 600;
        line-height: 1.2;
    }
    
    .category-count {
        font-size: 0.75rem;
        color: #6b7280;
        margin-top: 0.25rem;
    }
}

/* ===== FEATURED PRODUCTS MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .featured-products {
        padding: 2rem 1rem;
    }
    
    .featured-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 1rem;
    }
    
    .featured-product {
        border-radius: 16px;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .featured-image {
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .featured-title {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    .featured-price {
        font-size: 1.125rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }
    
    .featured-button {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 600;
    }
}

/* ===== PC BUILDER MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .pc-builder {
        padding: 1rem;
    }
    
    .pc-builder-section {
        margin-bottom: 2rem;
    }
    
    .pc-builder-title {
        font-size: 1.25rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }
    
    .pc-builder-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .pc-component-card {
        border-radius: 16px;
        padding: 1rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .pc-component-image {
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .pc-component-name {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    .pc-component-price {
        font-size: 1.125rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }
    
    .pc-component-button {
        width: 100%;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 600;
    }
    
    .pc-summary {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid #e5e7eb;
        padding: 1rem;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
        z-index: 40;
    }
    
    .pc-summary-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .pc-summary-total {
        font-size: 1.125rem;
        font-weight: 700;
    }
    
    .pc-summary-button {
        padding: 12px 24px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 12px;
    }
}

/* ===== PRODUCT DETAIL MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .product-detail {
        padding: 1rem;
    }
    
    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .product-images {
        border-radius: 16px;
        overflow: hidden;
    }
    
    .product-main-image {
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    
    .product-thumbnails {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .product-thumbnail {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        flex-shrink: 0;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-title {
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 0.5rem;
    }
    
    .product-category {
        font-size: 0.875rem;
        color: #6b7280;
        margin-bottom: 1rem;
    }
    
    .product-price {
        font-size: 1.5rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }
    
    .product-description {
        font-size: 1rem;
        line-height: 1.6;
        margin-bottom: 1.5rem;
    }
    
    .product-actions {
        flex-direction: column;
        gap: 1rem;
        margin-bottom: 2rem;
    }
    
    .product-quantity {
        display: flex;
        align-items: center;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    
    .quantity-input {
        width: 80px;
        text-align: center;
    }
    
    .add-to-cart-button {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 12px;
    }
    
    .product-specifications {
        margin-top: 2rem;
    }
    
    .specs-table {
        border-radius: 12px;
        overflow: hidden;
    }
    
    .specs-row {
        display: flex;
        padding: 12px 16px;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .specs-label {
        font-weight: 600;
        width: 40%;
        color: #374151;
    }
    
    .specs-value {
        width: 60%;
        color: #6b7280;
    }
}

/* ===== CART MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .cart-drawer {
        width: 100%;
        max-width: 100%;
        right: 0;
        border-radius: 16px 16px 0 0;
    }
    
    .cart-header {
        padding: 1rem;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .cart-title {
        font-size: 1.25rem;
        font-weight: 700;
    }
    
    .cart-items {
        max-height: 60vh;
        overflow-y: auto;
        padding: 1rem;
    }
    
    .cart-item {
        display: flex;
        gap: 1rem;
        padding: 1rem;
        border-radius: 12px;
        background: #f9fafb;
        margin-bottom: 1rem;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
        border-radius: 8px;
        object-fit: cover;
    }
    
    .cart-item-info {
        flex: 1;
        min-width: 0;
    }
    
    .cart-item-name {
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: 0.25rem;
        line-height: 1.3;
    }
    
    .cart-item-price {
        font-size: 0.875rem;
        font-weight: 700;
        color: #059669;
        margin-bottom: 0.5rem;
    }
    
    .cart-item-quantity {
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }
    
    .cart-item-quantity input {
        width: 50px;
        text-align: center;
        padding: 4px 8px;
        border-radius: 6px;
        border: 1px solid #d1d5db;
    }
    
    .cart-item-remove {
        padding: 4px 8px;
        border-radius: 6px;
        background: #ef4444;
        color: white;
        border: none;
        font-size: 12px;
    }
    
    .cart-footer {
        padding: 1rem;
        border-top: 1px solid #e5e7eb;
        background: white;
    }
    
    .cart-total {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1rem;
        font-size: 1.125rem;
        font-weight: 700;
    }
    
    .cart-actions {
        display: flex;
        gap: 1rem;
    }
    
    .cart-button {
        flex: 1;
        padding: 12px 16px;
        font-size: 14px;
        font-weight: 600;
        border-radius: 12px;
    }
}

/* ===== CHECKOUT MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .checkout {
        padding: 1rem;
    }
    
    .checkout-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .checkout-section {
        border-radius: 16px;
        padding: 1.5rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .checkout-title {
        font-size: 1.25rem;
        font-weight: 700;
        margin-bottom: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    .form-label {
        font-size: 0.875rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
        color: #374151;
    }
    
    .form-input {
        width: 100%;
        padding: 12px 16px;
        border-radius: 12px;
        border: 1px solid #d1d5db;
        font-size: 16px;
    }
    
    .form-input:focus {
        outline: none;
        border-color: #8B5CF6;
        box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
    }
    
    .checkout-summary {
        position: sticky;
        top: 1rem;
        border-radius: 16px;
        padding: 1.5rem;
        background: #f9fafb;
    }
    
    .summary-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .summary-total {
        font-size: 1.25rem;
        font-weight: 700;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 2px solid #e5e7eb;
    }
    
    .checkout-button {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
        font-weight: 600;
        border-radius: 12px;
        margin-top: 1.5rem;
    }
}

/* ===== FOOTER MOBILE OPTIMIZATION ===== */
@media (max-width: 768px) {
    .footer {
        padding: 2rem 1rem;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-section {
        margin-bottom: 1.5rem;
    }
    
    .footer-title {
        font-size: 1.125rem;
        font-weight: 700;
        margin-bottom: 1rem;
    }
    
    .footer-links {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-link {
        padding: 0.5rem 0;
        color: #6b7280;
        text-decoration: none;
        transition: color 0.2s;
    }
    
    .footer-link:hover {
        color: #8B5CF6;
    }
    
    .footer-social {
        display: flex;
        justify-content: center;
        gap: 1rem;
        margin-top: 1rem;
    }
    
    .social-link {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #8B5CF6;
        color: white;
        text-decoration: none;
        transition: transform 0.2s;
    }
    
    .social-link:hover {
        transform: scale(1.1);
    }
    
    .footer-bottom {
        text-align: center;
        padding-top: 1.5rem;
        border-top: 1px solid #e5e7eb;
        margin-top: 2rem;
    }
}

/* ===== UTILITY CLASSES FOR MOBILE ===== */
@media (max-width: 768px) {
    .mobile-hidden { display: none !important; }
    .mobile-block { display: block !important; }
    .mobile-flex { display: flex !important; }
    .mobile-grid { display: grid !important; }
    
    .mobile-text-center { text-align: center !important; }
    .mobile-text-left { text-align: left !important; }
    .mobile-text-right { text-align: right !important; }
    
    .mobile-w-full { width: 100% !important; }
    .mobile-h-full { height: 100% !important; }
    
    .mobile-p-4 { padding: 1rem !important; }
    .mobile-p-6 { padding: 1.5rem !important; }
    .mobile-p-8 { padding: 2rem !important; }
    
    .mobile-m-4 { margin: 1rem !important; }
    .mobile-m-6 { margin: 1.5rem !important; }
    .mobile-m-8 { margin: 2rem !important; }
    
    .mobile-rounded-lg { border-radius: 12px !important; }
    .mobile-rounded-xl { border-radius: 16px !important; }
    
    .mobile-text-sm { font-size: 0.875rem !important; }
    .mobile-text-base { font-size: 1rem !important; }
    .mobile-text-lg { font-size: 1.125rem !important; }
    .mobile-text-xl { font-size: 1.25rem !important; }
    .mobile-text-2xl { font-size: 1.5rem !important; }
    
    .mobile-gap-2 { gap: 0.5rem !important; }
    .mobile-gap-4 { gap: 1rem !important; }
    .mobile-gap-6 { gap: 1.5rem !important; }
    
    .mobile-space-y-1 > * + * { margin-top: 0.25rem !important; }
    .mobile-space-y-2 > * + * { margin-top: 0.5rem !important; }
    
    .mobile-items-start { align-items: flex-start !important; }
    .mobile-justify-center { justify-content: center !important; }
    .mobile-flex-wrap { flex-wrap: wrap !important; }
}

/* ===== TOUCH OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    /* Improve touch targets */
    button, a, input[type="button"], input[type="submit"], input[type="reset"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Improve scrolling */
    .scroll-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Prevent zoom on input focus */
    input, textarea, select {
        font-size: 16px;
    }
    
    /* Improve tap highlights */
    * {
        -webkit-tap-highlight-color: rgba(139, 92, 246, 0.1);
    }
    
    /* Smooth transitions */
    * {
        transition: all 0.2s ease;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    /* Optimize animations for mobile */
    .animate-fadeInUp {
        animation-duration: 0.2s;
    }
    
    /* Reduce shadow complexity on mobile */
    .shadow-lg {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .shadow-xl {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    }
    
    /* Optimize gradients for mobile */
    .bg-gradient-to-r {
        background: linear-gradient(90deg, var(--tw-gradient-stops));
    }
    
    /* Reduce backdrop blur on mobile for performance */
    .backdrop-blur-sm {
        backdrop-filter: blur(4px);
    }
    
    .backdrop-blur-md {
        backdrop-filter: blur(8px);
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */
@media (max-width: 768px) {
    /* Improve focus indicators */
    button:focus, a:focus, input:focus, textarea:focus, select:focus {
        outline: 2px solid #8B5CF6;
        outline-offset: 2px;
    }
    
    /* Improve color contrast */
    .text-gray-600 {
        color: #4b5563;
    }
    
    .text-gray-500 {
        color: #6b7280;
    }
    
    /* Improve text readability */
    .text-sm {
        line-height: 1.4;
    }
    
    .text-base {
        line-height: 1.5;
    }
    
    .text-lg {
        line-height: 1.6;
    }
}

/* ===== DARK MODE SUPPORT (if needed) ===== */
@media (max-width: 768px) {
    @media (prefers-color-scheme: dark) {
        .dark-mode-support {
            background-color: #1f2937;
            color: #f9fafb;
        }
        
        .dark-mode-support .card {
            background-color: #374151;
            border-color: #4b5563;
        }
        
        .dark-mode-support .form-input {
            background-color: #374151;
            border-color: #4b5563;
            color: #f9fafb;
        }
    }
}
