/**
 * IPHOXY B2B Theme - Enhanced Mobile Styles
 * 
 * Complete mobile-first responsive design
 * 
 * @package IPHOXY_B2B
 */

/* ============================================
   Mobile Navigation Enhancement
   ============================================ */

/* Mobile menu toggle animation */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.mobile-menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-gray-700);
    transition: all 0.3s ease;
    transform-origin: center;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   Tablet Styles (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.25rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .hero h1 {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.25rem;
    }
    
    /* Dashboard grid */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Mobile Styles (max-width: 768px)
   ============================================ */
@media (max-width: 768px) {
    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Header */
    .header-top {
        display: none;
    }
    
    .header-main {
        padding: 0.75rem 0;
    }
    
    .header-main-content {
        gap: 1rem;
    }
    
    .logo img {
        height: 45px;
    }
    
    /* Mobile Navigation */
    .main-nav {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--color-white);
        z-index: 1000;
        padding: 80px 1.5rem 2rem;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .main-nav.active {
        display: block;
        transform: translateX(0);
    }
    
    .main-nav ul {
        flex-direction: column;
        gap: 0;
    }
    
    .main-nav a {
        display: block;
        padding: 1rem;
        font-size: 1.125rem;
        border-bottom: 1px solid var(--color-gray-200);
    }
    
    .main-nav a:last-child {
        border-bottom: none;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    /* Header actions */
    .header-actions {
        gap: 0.5rem;
    }
    
    .header-actions .btn {
        display: none;
    }
    
    .header-actions .btn-primary {
        display: inline-flex;
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }
    
    .cart-link {
        width: 40px;
        height: 40px;
    }
    
    .user-menu-toggle span {
        display: none;
    }
    
    .user-menu-toggle {
        padding: 0.5rem;
        width: 40px;
        height: 40px;
        justify-content: center;
    }
    
    /* User dropdown mobile */
    .user-dropdown {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    .user-menu.active .user-dropdown {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    /* Hero */
    .hero {
        min-height: 450px;
        padding: 2rem 0;
    }
    
    .hero h1 {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .hero-description {
        font-size: 0.9375rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Categories */
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .category-card {
        padding: 1rem;
    }
    
    .category-icon {
        width: 48px;
        height: 48px;
    }
    
    .category-name {
        font-size: 0.875rem;
    }
    
    /* Products */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .product-card {
        padding: 0.75rem;
    }
    
    .product-image {
        height: 120px;
    }
    
    .product-name {
        font-size: 0.875rem;
        line-height: 1.3;
    }
    
    .product-sku {
        font-size: 0.75rem;
    }
    
    .product-stock {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .feature-card {
        padding: 1.5rem;
    }
    
    /* CTA */
    .cta-section {
        padding: 3rem 0;
    }
    
    .cta-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .cta-actions .btn {
        width: 100%;
    }
    
    /* Contact */
    .contact-preview-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }
    
    .footer-about {
        text-align: center;
    }
    
    .footer-logo {
        margin: 0 auto 1rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-links ul {
        align-items: center;
    }
    
    .footer-contact ul li {
        justify-content: center;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    /* Forms */
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    /* Auth pages */
    .auth-container {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .auth-header h1 {
        font-size: 1.5rem;
    }
    
    /* Dashboard */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    
    /* Tables */
    .table-responsive {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Cards */
    .card {
        border-radius: var(--radius);
    }
    
    .card-header,
    .card-body,
    .card-footer {
        padding: 1rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 1rem 1.5rem;
    }
    
    /* Modals */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    /* Alerts */
    .alert {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Page headers */
    .page-header {
        padding: 2rem 0;
    }
    
    .page-header h1 {
        font-size: 1.75rem;
    }
    
    /* Breadcrumbs */
    .breadcrumb {
        font-size: 0.8125rem;
        flex-wrap: wrap;
    }
    
    /* Filters */
    .filter-bar {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group select,
    .filter-group input {
        width: 100%;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    
    .pagination a,
    .pagination span {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

/* ============================================
   Small Mobile Styles (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    /* Header */
    .logo img {
        height: 40px;
    }
    
    /* Hero */
    .hero {
        min-height: 400px;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .hero-badge {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    /* Categories & Products */
    .categories-grid,
    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    
    .product-image {
        height: 100px;
    }
    
    /* Section spacing */
    .section {
        padding: 2rem 0;
    }
    
    .section-header {
        margin-bottom: 1.5rem;
    }
    
    .section-header h2 {
        font-size: 1.25rem;
    }
    
    /* Auth pages */
    .auth-container {
        padding: 1.25rem;
        margin: 0.5rem;
    }
    
    /* Stat cards */
    .stat-cards {
        grid-template-columns: 1fr 1fr;
    }
    
    .stat-card .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-card .stat-label {
        font-size: 0.6875rem;
    }
    
    /* Order items */
    .order-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .order-item-image {
        width: 60px;
        height: 60px;
    }
    
    /* Cart */
    .cart-item {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .quantity-input {
        width: 100%;
    }
}

/* ============================================
   Touch-Friendly Enhancements
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 44px;
    }
    
    .main-nav a {
        min-height: 48px;
        display: flex;
        align-items: center;
    }
    
    .form-control {
        min-height: 48px;
    }
    
    /* Remove hover effects on touch devices */
    .btn:hover {
        transform: none;
    }
    
    .product-card:hover {
        transform: none;
    }
    
    .category-card:hover {
        transform: none;
    }
    
    /* Active states for touch */
    .btn:active {
        transform: scale(0.98);
    }
    
    .product-card:active,
    .category-card:active {
        transform: scale(0.98);
    }
}

/* ============================================
   Landscape Mobile
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: 350px;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .main-nav {
        padding-top: 60px;
    }
    
    .main-nav ul {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   Safe Area (Notch) Support
   ============================================ */
@supports (padding: env(safe-area-inset-bottom)) {
    .site-footer {
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    }
    
    .main-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .user-dropdown {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .site-header,
    .site-footer,
    .mobile-menu-toggle,
    .btn,
    .cart-link,
    .user-menu {
        display: none !important;
    }
    
    .site-main {
        padding: 0;
    }
    
    .product-card {
        break-inside: avoid;
    }
}
