/* Electro Walid - Mobile & Responsive Stylesheet */
/* Native App-Like Mobile Experience */

/* ============================================
   MOBILE VIEW OPTIMIZATIONS
   ============================================ */

/* Mobile Body Adjustments */
.mobile-view {
    font-size: 16px; /* Prevent zoom on input focus on iOS */
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Touch-Friendly Tap Targets */
.mobile-view .btn,
.mobile-view .nav-link,
.mobile-view a.card,
.mobile-view .product-card {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */

/* Mobile Top Bar - Compact */
.mobile-view .top-bar {
    font-size: 0.75rem;
    padding: 0.5rem 0 !important;
}

.mobile-view .top-bar .col-md-6 {
    font-size: 0.7rem;
}

/* Mobile Navbar - Sticky */
.mobile-view .navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    padding: 0.75rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-view .navbar-brand {
    font-size: 1.25rem;
}

/* Mobile Menu - Full Screen */
.mobile-view .navbar-collapse {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1040;
    padding: 1rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-view .navbar-collapse.show {
    transform: translateX(0);
}

.mobile-view .navbar-nav {
    margin: 2rem 0 !important;
}

.mobile-view .nav-item {
    border-bottom: 1px solid #e9ecef;
}

.mobile-view .nav-link {
    padding: 1rem !important;
    font-size: 1.1rem;
}

/* Mobile Cart Button */
.mobile-view .btn-outline-primary {
    padding: 0.5rem 0.75rem;
}

/* ============================================
   MOBILE HERO SLIDER
   ============================================ */

.mobile-view .hero-slide {
    min-height: 300px !important;
    background-position: center center;
}

.mobile-view .hero-slide .row {
    min-height: 300px !important;
}

.mobile-view .hero-content {
    text-align: center;
    padding: 1rem;
}

.mobile-view .hero-content h1 {
    font-size: 1.5rem !important;
    margin-bottom: 0.75rem !important;
}

.mobile-view .hero-content p {
    font-size: 0.95rem !important;
    margin-bottom: 1rem !important;
}

.mobile-view .hero-content .btn {
    font-size: 0.9rem;
    padding: 0.625rem 1.25rem;
}

/* Carousel Controls - Larger Touch Targets */
.mobile-view .carousel-control-prev,
.mobile-view .carousel-control-next {
    width: 15%;
    opacity: 0.8;
}

.mobile-view .carousel-indicators {
    bottom: 0.5rem;
}

.mobile-view .carousel-indicators button {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 4px;
}

/* ============================================
   MOBILE PRODUCT GRID
   ============================================ */

.mobile-view .product-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
}

.mobile-view .product-card {
    border-radius: 0.5rem;
    overflow: hidden;
}

.mobile-view .product-card img {
    height: 180px;
    object-fit: cover;
}

.mobile-view .product-card .card-body {
    padding: 0.75rem;
}

.mobile-view .product-card .card-title {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.mobile-view .product-card .card-text {
    font-size: 0.85rem;
}

.mobile-view .product-card .btn {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
}

/* ============================================
   MOBILE CATEGORY CARDS
   ============================================ */

.mobile-view .category-card {
    margin-bottom: 0.75rem;
}

.mobile-view .category-card img {
    height: 120px;
    object-fit: cover;
}

.mobile-view .category-card .card-body {
    padding: 0.75rem;
}

.mobile-view .category-card h5 {
    font-size: 1rem;
}

/* ============================================
   MOBILE PRODUCT DETAIL PAGE
   ============================================ */

.mobile-view .product-gallery-main img {
    height: 300px !important;
    border-radius: 0.5rem;
}

.mobile-view .product-gallery-thumbs {
    gap: 0.375rem;
}

.mobile-view .product-gallery-thumb {
    width: 60px;
    height: 60px;
}

.mobile-view .product-detail-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.mobile-view .product-detail-price {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

/* ============================================
   MOBILE CART
   ============================================ */

.mobile-view .cart-item {
    padding: 0.75rem 0;
}

.mobile-view .cart-item-image {
    width: 70px;
    height: 70px;
}

.mobile-view .quantity-input {
    width: 60px;
    font-size: 0.9rem;
}

.mobile-view .order-summary {
    padding: 1rem;
    margin-top: 1rem;
    position: sticky;
    bottom: 0;
    background: white;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 0;
}

/* ============================================
   MOBILE FORMS
   ============================================ */

.mobile-view .form-control,
.mobile-view .form-select {
    font-size: 16px; /* Prevent zoom on iOS */
    padding: 0.75rem;
    border-radius: 0.5rem;
}

.mobile-view .form-label {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.mobile-view textarea.form-control {
    min-height: 120px;
}

/* ============================================
   MOBILE TABLES
   ============================================ */

.mobile-view .table-responsive {
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.mobile-view .table {
    font-size: 0.85rem;
}

.mobile-view .table th,
.mobile-view .table td {
    padding: 0.5rem;
    white-space: nowrap;
}

/* Mobile Table - Card Style */
.mobile-view .mobile-table-card {
    display: block;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: white;
}

.mobile-view .mobile-table-card .row {
    margin-bottom: 0.5rem;
}

.mobile-view .mobile-table-card .row:last-child {
    margin-bottom: 0;
}

/* ============================================
   MOBILE DASHBOARD
   ============================================ */

.mobile-view .dashboard-sidebar {
    margin-bottom: 1rem;
}

.mobile-view .dashboard-sidebar .nav-link {
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
}

.mobile-view .stats-card {
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.mobile-view .stats-card h3 {
    font-size: 1.75rem;
}

/* ============================================
   MOBILE BUTTONS & ACTIONS
   ============================================ */

.mobile-view .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.95rem;
    border-radius: 0.5rem;
}

.mobile-view .btn-lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
}

.mobile-view .btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

/* Fixed Bottom Action Bar */
.mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
    z-index: 1020;
    display: none;
}

.mobile-view .mobile-action-bar {
    display: block;
}

/* ============================================
   MOBILE MODALS
   ============================================ */

.mobile-view .modal-dialog {
    margin: 0;
    max-width: 100%;
    height: 100%;
}

.mobile-view .modal-content {
    height: 100%;
    border-radius: 0;
    border: none;
}

.mobile-view .modal-body {
    padding: 1.25rem;
}

/* ============================================
   MOBILE SPACING & LAYOUT
   ============================================ */

.mobile-view .container {
    padding-left: 1rem;
    padding-right: 1rem;
}

.mobile-view section,
.mobile-view .section {
    padding: 1.5rem 0;
}

.mobile-view h1 {
    font-size: 1.75rem;
}

.mobile-view h2 {
    font-size: 1.5rem;
}

.mobile-view h3 {
    font-size: 1.25rem;
}

.mobile-view h4 {
    font-size: 1.1rem;
}

.mobile-view h5 {
    font-size: 1rem;
}

/* ============================================
   MOBILE FOOTER
   ============================================ */

.mobile-view footer {
    font-size: 0.85rem;
    padding: 1.5rem 0;
}

.mobile-view footer .col-md-3 {
    margin-bottom: 1rem;
}

/* ============================================
   VERSION SWITCHER
   ============================================ */

.version-switcher {
    position: fixed;
    bottom: 80px;
    right: 1rem;
    z-index: 1010;
}

.version-switcher .btn {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border-radius: 2rem;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* ============================================
   TABLET OPTIMIZATIONS
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
    .device-tablet .product-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1rem !important;
    }
    
    .device-tablet .hero-slide {
        min-height: 400px !important;
    }
    
    .device-tablet .hero-content h1 {
        font-size: 2rem !important;
    }
    
    .device-tablet .product-card img {
        height: 220px;
    }
}

/* ============================================
   LANDSCAPE MODE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) and (orientation: landscape) {
    .mobile-view .hero-slide {
        min-height: 250px !important;
    }
    
    .mobile-view .hero-slide .row {
        min-height: 250px !important;
    }
    
    .mobile-view .hero-content h1 {
        font-size: 1.25rem !important;
    }
    
    .mobile-view .hero-content p {
        font-size: 0.85rem !important;
    }
}

/* ============================================
   PULL-TO-REFRESH INDICATOR
   ============================================ */

.pull-to-refresh {
    position: fixed;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border-radius: 0 0 0.5rem 0.5rem;
    font-size: 0.85rem;
    transition: top 0.3s ease;
    z-index: 1050;
}

.pull-to-refresh.active {
    top: 0;
}

/* ============================================
   LOADING STATES
   ============================================ */

.mobile-view .skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 0.375rem;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ============================================
   SWIPE GESTURES
   ============================================ */

.swipeable {
    touch-action: pan-y;
    user-select: none;
}

/* ============================================
   SAFE AREA INSETS (iPhone X+)
   ============================================ */

@supports (padding: max(0px)) {
    .mobile-view .navbar,
    .mobile-view .mobile-action-bar,
    .mobile-view .order-summary {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }
    
    .mobile-view .mobile-action-bar {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ============================================
   ACCESSIBILITY IMPROVEMENTS
   ============================================ */

.mobile-view *:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.mobile-view .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ============================================
   PERFORMANCE OPTIMIZATIONS
   ============================================ */

.mobile-view img {
    content-visibility: auto;
}

.mobile-view .lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-view .lazy-load.loaded {
    opacity: 1;
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .mobile-view.dark-mode {
        background: #1a1a1a;
        color: #f0f0f0;
    }
    
    .mobile-view.dark-mode .navbar,
    .mobile-view.dark-mode .card,
    .mobile-view.dark-mode .modal-content {
        background: #2a2a2a;
        color: #f0f0f0;
        border-color: #3a3a3a;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .mobile-view .navbar,
    .mobile-view .top-bar,
    .mobile-view .mobile-action-bar,
    .mobile-view .version-switcher,
    .mobile-view footer {
        display: none !important;
    }
}
