/**
 * Mobile Responsive Fixes for E-commerce Site
 * Ensures proper mobile display across all user pages
 * Updated to handle sticky navigation properly
 */

/* Base Mobile Settings */
@media (max-width: 768px) {
    body {
        font-size: 14px;
        line-height: 1.5;
        /* Ensure sticky navigation has proper space */
        padding-bottom: 100px !important;
    }
    
    /* Force sticky navigation to show properly on mobile */
    .sticky-bottom-nav,
    #stickyBottomNav {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        bottom: 10px !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        z-index: 999999 !important;
        width: calc(100% - 20px) !important;
        max-width: 320px !important;
        background: rgba(0, 0, 0, 0.9) !important;
        padding: 10px 6px !important;
        border-radius: 20px !important;
    }
    
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    /* Header Mobile Fixes */
    .navbar-brand {
        font-size: 18px !important;
    }
    
    .site-name-mobile {
        font-size: 16px !important;
        font-weight: 600;
    }
    
    /* Navigation Mobile Fixes */
    .navbar-nav {
        text-align: center;
        margin-top: 10px;
    }
    
    .navbar-nav .nav-link {
        padding: 10px 15px !important;
        font-size: 16px;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* Hero Section Mobile */
    .hero-slider {
        height: 300px !important;
    }
    
    .hero-content h1 {
        font-size: 24px !important;
        margin-bottom: 10px;
    }
    
    .hero-content p {
        font-size: 14px !important;
        margin-bottom: 15px;
    }
    
    .hero-content .btn {
        font-size: 14px;
        padding: 8px 20px;
    }
}

/* Category Boxes Mobile Responsive */
@media (max-width: 576px) {
    .mobile-category-card {
        min-height: 160px !important;
        padding: 15px 10px !important;
        margin-bottom: 15px;
    }
    
    .category-icon-circle {
        width: 45px !important;
        height: 45px !important;
        margin-bottom: 10px !important;
    }
    
    .category-icon-circle i {
        font-size: 18px !important;
    }
    
    .category-title {
        font-size: 12px !important;
        line-height: 1.2;
        margin-bottom: 5px !important;
    }
    
    .category-tamil {
        font-size: 10px !important;
        line-height: 1.3;
    }
    
    /* Feature boxes mobile */
    .unique-feature-card {
        min-height: 150px !important;
        padding: 15px 10px !important;
    }
    
    .feature-icon-circle {
        width: 50px !important;
        height: 50px !important;
        margin-bottom: 10px !important;
    }
    
    /* Success pages mobile responsive */
    .success-header {
        padding: 2rem 0 !important;
    }
    
    .success-header h1 {
        font-size: 1.8rem !important;
        line-height: 1.3;
    }
    
    .success-header .lead {
        font-size: 1rem !important;
    }
    
    .order-card {
        margin-bottom: 1.5rem !important;
        border-radius: 8px !important;
    }
    
    .order-card .card-header h5 {
        font-size: 1.1rem !important;
    }
    
    /* Table mobile responsive */
    .table-responsive {
        font-size: 12px !important;
        overflow-x: auto !important;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.3rem !important;
        font-size: 12px !important;
        white-space: nowrap;
    }
    
    /* Invoice actions mobile */
    .invoice-actions .btn {
        font-size: 13px !important;
        padding: 6px 12px !important;
        margin-bottom: 8px !important;
        width: 100%;
    }
    
    /* Next steps section mobile responsive */
    .order-card .row .col-md-6 {
        margin-bottom: 1rem !important;
    }
    
    .order-card h6 {
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .order-card p {
        font-size: 0.9rem !important;
        margin-bottom: 1rem !important;
        line-height: 1.4;
    }
    
    /* Contact info mobile responsive */
    .text-center p {
        font-size: 14px !important;
        line-height: 1.5;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    body {
        padding-bottom: 120px !important;
    }
    
    /* Sticky nav adjustments for very small screens */
    .sticky-bottom-nav,
    #stickyBottomNav {
        bottom: 8px !important;
        width: calc(100% - 16px) !important;
        max-width: 300px !important;
        padding: 8px 4px !important;
        border-radius: 18px !important;
    }
    
    .nav-item {
        width: 45px !important;
        height: 45px !important;
    }
    
    .nav-item i {
        font-size: 16px !important;
    }
    
    /* Success pages extra mobile */
    .success-header {
        padding: 1.5rem 0 !important;
    }
    
    .success-header h1 {
        font-size: 1.5rem !important;
    }
    
    .order-card {
        margin-bottom: 1rem !important;
        border-radius: 6px !important;
    }
    
    .table-responsive {
        font-size: 11px !important;
    }
    
    .table th,
    .table td {
        padding: 0.4rem 0.2rem !important;
        font-size: 11px !important;
    }
    
    .invoice-actions .btn {
        font-size: 12px !important;
        padding: 5px 10px !important;
    }
    
    /* Alert responsive */
    .alert {
        font-size: 13px !important;
        padding: 8px !important;
        margin-bottom: 15px !important;
    }
    
    .alert .btn-sm {
        font-size: 11px !important;
        padding: 3px 6px !important;
        width: 100% !important;
        margin-top: 8px !important;
        margin-left: 0 !important;
    }
    
    .feature-icon-circle i {
        font-size: 20px !important;
    }
    
    .feature-title {
        font-size: 14px !important;
        margin-bottom: 8px !important;
    }
    
    .feature-description {
        font-size: 11px !important;
        line-height: 1.4;
    }
}

/* Product Cards Mobile */
@media (max-width: 768px) {
    .product-card {
        margin-bottom: 20px;
    }
    
    .product-card .card-body {
        padding: 15px;
    }
    
    .product-card .card-title {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .product-card .price {
        font-size: 18px;
        font-weight: bold;
    }
    
    .product-card .btn {
        font-size: 14px;
        padding: 8px 15px;
    }
}

/* Footer Mobile */
@media (max-width: 768px) {
    .footer {
        padding: 30px 0 20px 0;
    }
    
    .footer .col-md-4 {
        margin-bottom: 30px;
        text-align: center;
    }
    
    .footer h5 {
        font-size: 18px;
        margin-bottom: 15px;
    }
    
    .footer p {
        font-size: 14px;
        margin-bottom: 15px;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .social-links a {
        margin: 0 10px !important;
        font-size: 24px;
    }
}

/* Mobile Cart and Shopping */
@media (max-width: 576px) {
    .cart-item {
        padding: 10px;
        border-bottom: 1px solid #eee;
    }
    
    .cart-item-details {
        font-size: 14px;
    }
    
    .cart-item-price {
        font-size: 16px;
        font-weight: bold;
    }
    
    .quantity-controls {
        margin: 10px 0;
    }
    
    .quantity-controls button {
        padding: 5px 10px;
        font-size: 14px;
    }
    
    .checkout-summary {
        padding: 15px;
        margin-top: 20px;
    }
    
    .checkout-btn {
        width: 100%;
        padding: 15px;
        font-size: 16px;
        margin-top: 10px;
    }
}

/* Mobile Forms */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .btn-block {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Mobile Tables */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px 4px;
        vertical-align: middle;
    }
    
    .table .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Mobile Alerts */
@media (max-width: 576px) {
    .alert {
        padding: 12px 15px;
        font-size: 14px;
        margin-bottom: 15px;
        border-radius: 8px;
    }
    
    .alert .btn-close {
        padding: 8px;
    }
}

/* Mobile Modals */
@media (max-width: 576px) {
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 15px;
        border-bottom: 1px solid #dee2e6;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .modal-footer {
        padding: 15px;
        border-top: 1px solid #dee2e6;
    }
    
    .modal-title {
        font-size: 18px;
    }
}

/* Mobile Search */
@media (max-width: 576px) {
    .search-form {
        margin: 10px 0;
    }
    
    .search-form .input-group {
        flex-wrap: nowrap;
    }
    
    .search-form .form-control {
        font-size: 16px;
    }
    
    .search-form .btn {
        padding: 10px 15px;
        white-space: nowrap;
    }
}

/* Mobile Pagination */
@media (max-width: 576px) {
    .pagination {
        justify-content: center;
        margin: 20px 0;
    }
    
    .page-link {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .page-item:first-child .page-link,
    .page-item:last-child .page-link {
        border-radius: 6px;
    }
}

/* Mobile Breadcrumb */
@media (max-width: 576px) {
    .breadcrumb {
        font-size: 12px;
        padding: 8px 12px;
        margin-bottom: 15px;
        flex-wrap: wrap;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        content: "›";
        padding: 0 5px;
    }
}

/* Mobile Fireworks Optimization */
@media (max-width: 768px) {
    #fireworks-canvas {
        opacity: 0.5 !important; /* Reduce for better mobile performance */
    }
    
    .fireworks-trigger {
        bottom: 20px !important;
        right: 15px !important;
        width: 45px !important;
        height: 45px !important;
        font-size: 18px !important;
    }
}

/* Touch-friendly interactions */
@media (max-width: 768px) {
    .btn {
        min-height: 44px; /* Apple's recommended touch target size */
        min-width: 44px;
    }
    
    .card {
        margin-bottom: 20px;
    }
    
    .card-body {
        padding: 15px;
    }
    
    /* Improve touch targets for links */
    a {
        min-height: 32px;
        display: inline-block;
        line-height: 32px;
        padding: 0 4px;
    }
    
    /* Better spacing for mobile */
    .mb-3 {
        margin-bottom: 1.5rem !important;
    }
    
    .mb-4 {
        margin-bottom: 2rem !important;
    }
    
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Focus states */
    .btn:focus,
    .form-control:focus,
    a:focus {
        outline: 2px solid #007bff;
        outline-offset: 2px;
    }
    
    /* High contrast for text */
    .text-muted {
        color: #666 !important;
    }
    
    /* Better visibility for important elements */
    .badge {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .alert-success {
        background-color: #d1edff;
        border-color: #007bff;
        color: #004085;
    }
    
    .alert-danger {
        background-color: #f8d7da;
        border-color: #dc3545;
        color: #721c24;
    }
}