/* ============================================
   RESPONSIVE STYLES FOR ALL PAGES
   Mobile-First Responsive Design
   ============================================ */

/* Base Mobile Styles (320px and up) */
* {
    box-sizing: border-box;
}

body {
    overflow-x: hidden;
    width: 100%;
}

/* ============================================
   HEADER & NAVIGATION - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    /* Header adjustments */
    .main-header {
        padding: 10px 15px !important;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .logo {
        font-size: 1.2rem !important;
        max-width: 150px;
    }
    
    .logo img {
        max-height: 40px !important;
    }
    
    /* Hide desktop navigation */
    .main-nav .nav-list {
        display: none !important;
    }
    
    /* Search bar */
    .search-form {
        width: 100% !important;
        max-width: 100% !important;
        order: 3;
    }
    
    .search-input {
        font-size: 14px !important;
        padding: 8px 35px 8px 12px !important;
    }
    
    /* Header actions */
    .header-actions {
        gap: 10px !important;
    }
    
    .action-item {
        padding: 8px !important;
    }
    
    .action-text {
        display: none !important;
    }
    
    .action-icon {
        font-size: 18px !important;
    }
}

/* ============================================
   HERO SECTION - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .hero-section {
        padding: 40px 20px !important;
        min-height: auto !important;
    }
    
    .hero-content {
        text-align: center;
        padding: 20px !important;
    }
    
    .hero-content h1 {
        font-size: 2rem !important;
        line-height: 1.2 !important;
    }
    
    .hero-content p {
        font-size: 1rem !important;
    }
    
    .hero-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .btn {
        width: 100% !important;
        justify-content: center !important;
    }
}

/* ============================================
   PRODUCTS GRID - RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px !important;
    }
}

@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
        padding: 10px !important;
    }
    
    .product-card {
        padding: 10px !important;
    }
    
    .product-card h3 {
        font-size: 14px !important;
    }
    
    .product-card .price {
        font-size: 16px !important;
    }
    
    .product-card button {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}

/* ============================================
   CART PAGE - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .cart-container {
        padding: 10px !important;
    }
    
    .cart-header {
        padding: 20px 15px !important;
    }
    
    .cart-header h1 {
        font-size: 1.8rem !important;
    }
    
    .cart-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        padding: 15px !important;
    }
    
    .item-image {
        width: 100% !important;
        height: 200px !important;
        margin-bottom: 15px !important;
    }
    
    .item-details {
        width: 100% !important;
    }
    
    .quantity-controls {
        margin: 15px 0 !important;
    }
    
    .cart-summary {
        padding: 20px 15px !important;
    }
    
    .checkout-btn {
        width: 100% !important;
    }
}

/* ============================================
   ADMIN PANEL - RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%) !important;
        z-index: 9999 !important;
    }
    
    .sidebar.active {
        transform: translateX(0) !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .top-bar {
        left: 0 !important;
        width: 100% !important;
    }
    
    /* Add mobile menu toggle */
    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        top: 20px;
        left: 20px;
        z-index: 9998;
        background: #667eea;
        color: white;
        border: none;
        padding: 10px 15px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    .product-grid {
        grid-template-columns: 1fr !important;
    }
    
    .section-content {
        padding: 15px !important;
    }
    
    table {
        font-size: 12px !important;
    }
    
    table th,
    table td {
        padding: 8px 5px !important;
    }
    
    .btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

/* ============================================
   FORMS - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .form-group {
        margin-bottom: 15px !important;
    }
    
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px !important;
    }
    
    .form-row {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .form-col {
        width: 100% !important;
    }
}

/* ============================================
   MODALS - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 20px auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
    
    .modal-header {
        padding: 15px !important;
    }
    
    .modal-body {
        padding: 15px !important;
    }
    
    .modal-footer {
        padding: 15px !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .modal-footer button {
        width: 100% !important;
    }
}

/* ============================================
   FOOTER - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .footer {
        padding: 30px 20px !important;
    }
    
    .footer-content {
        grid-template-columns: 1fr !important;
        gap: 30px !important;
    }
    
    .footer-section {
        text-align: center !important;
    }
    
    .footer-links {
        align-items: center !important;
    }
    
    .social-links {
        justify-content: center !important;
    }
}

/* ============================================
   CHECKOUT - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .checkout-container {
        padding: 15px !important;
    }
    
    .checkout-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .order-summary {
        order: -1 !important; /* Show summary first on mobile */
    }
}

/* ============================================
   PRODUCTS PAGE - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .products-header {
        flex-direction: column !important;
        gap: 15px !important;
        padding: 15px !important;
    }
    
    .filters-section {
        width: 100% !important;
        overflow-x: auto !important;
    }
    
    .category-filters {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .category-filter {
        white-space: nowrap !important;
        font-size: 12px !important;
        padding: 8px 15px !important;
    }
    
    .sort-controls {
        width: 100% !important;
    }
    
    .sort-select {
        width: 100% !important;
    }
}

/* ============================================
   CONTAINERS - RESPONSIVE
   ============================================ */

@media (max-width: 1200px) {
    .container {
        max-width: 100% !important;
        padding: 0 30px !important;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px !important;
    }
    
    section {
        padding: 40px 0 !important;
    }
}

/* ============================================
   TYPOGRAPHY - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    h1 {
        font-size: 2rem !important;
    }
    
    h2 {
        font-size: 1.75rem !important;
    }
    
    h3 {
        font-size: 1.5rem !important;
    }
    
    h4 {
        font-size: 1.25rem !important;
    }
    
    p {
        font-size: 14px !important;
    }
}

/* ============================================
   UTILITIES - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
    
    .text-center-mobile {
        text-align: center !important;
    }
    
    .full-width-mobile {
        width: 100% !important;
    }
}

/* ============================================
   IMAGES - RESPONSIVE
   ============================================ */

img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 768px) {
    .product-image,
    .item-image,
    .hero-image {
        width: 100% !important;
        height: auto !important;
        object-fit: cover !important;
    }
}

/* ============================================
   BUTTONS - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .btn-group {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .btn-group .btn {
        width: 100% !important;
    }
}

/* ============================================
   TABLES - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    table {
        min-width: 600px !important;
    }
}

/* ============================================
   CARDS - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .card {
        margin: 10px 0 !important;
        padding: 15px !important;
    }
    
    .card-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}

/* ============================================
   SPACING - RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .section-padding {
        padding: 30px 15px !important;
    }
    
    .margin-bottom-lg {
        margin-bottom: 20px !important;
    }
    
    .gap-lg {
        gap: 15px !important;
    }
}

/* ============================================
   TOUCH IMPROVEMENTS
   ============================================ */

@media (max-width: 768px) {
    /* Larger touch targets */
    button,
    a,
    input[type="button"],
    input[type="submit"] {
        min-height: 44px !important;
        min-width: 44px !important;
    }
    
    /* Better tap highlighting */
    * {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
}

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

@media (max-width: 768px) and (orientation: landscape) {
    .hero-section {
        min-height: auto !important;
        padding: 30px 20px !important;
    }
    
    .modal-content {
        max-height: 80vh !important;
    }
}

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

@media print {
    .no-print,
    .header,
    .footer,
    .sidebar,
    button {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
        width: 100% !important;
    }
}
