/* ====================================
   Responsive Design - Mobile First
   ==================================== */

/* Extra Small Devices (Phones, less than 576px) */
@media (max-width: 575.98px) {
    /* Typography */
    html {
        font-size: 14px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    .page-subtitle {
        font-size: 14px;
    }
    
    /* Container */
    .container {
        padding: 0 15px;
    }
    
    /* Grid adjustments */
    .row {
        margin: 0 -5px;
    }
    
    .row > [class*="col-"] {
        padding: 0 5px;
    }
    
    /* Spacing adjustments */
    .page-section {
        padding: 20px 0;
    }
    
    /* Header adjustments */
    .top-bar {
        font-size: 12px;
    }
    
    .top-bar-content {
        flex-direction: column;
        gap: 5px;
        text-align: center;
    }
    
    .logo img {
        height: 50px !important;
    }
    
    .search-bar {
        flex-direction: column;
    }
    
    .category-select {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    /* Navigation adjustments */
    .nav-links li a {
        font-size: 13px;
        padding: 12px 15px;
    }
    
    /* Card adjustments */
    .card-body,
    .product-card-body {
        padding: 15px;
    }
    
    /* Button adjustments */
    .btn {
        font-size: 13px;
        padding: 10px 20px;
    }
    
    .btn-lg {
        font-size: 14px;
        padding: 12px 25px;
    }

    /* Category menu - single column on mobile */
    .category-menu {
        min-width: 100% !important;
        flex-direction: column;
    }

    .category-menu .category-column {
        flex: 0 0 100% !important;
        margin: 0 !important;
    }
}

/* Small Devices (Phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .container {
        max-width: 540px;
    }
    
    .page-title {
        font-size: 28px;
    }

    /* Category menu - 2 columns on small devices */
    .category-menu {
        min-width: 480px !important;
        padding: 5px !important;
        gap: 5px;
    }

    .category-menu .category-column {
        flex: 0 0 calc(50% - 5px) !important;
        margin: 0 !important;
    }
}

@media (max-width: 880px) {
    .container {
        max-width: 720px;
    }
}

/* Medium Devices (Tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Category menu - 2 columns on tablets */
    .category-menu {
        min-width: 600px !important;
        padding: 5px !important;
        gap: 5px;
    }

    .category-menu .category-column {
        flex: 0 0 calc(50% - 5px) !important;
        margin: 0 !important;
    }
}

/* Large Devices (Desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 960px;
    }
    
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Category menu - 3 columns but smaller width */
    .category-menu {
        min-width: 800px !important;
    }
}

/* Extra Large Devices (Large Desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ====================================
   Print Styles
   ==================================== */
@media print {
    /* Hide unnecessary elements */
    .top-bar,
    .main-header,
    .main-nav,
    .mobile-nav,
    .site-footer,
    .breadcrumb-section,
    .pagination,
    .btn,
    .sidebar-widget {
        display: none !important;
    }
    
    /* Reset colors for printing */
    body {
        background-color: white !important;
        color: black !important;
    }
    
    /* Adjust layout */
    .content-layout {
        display: block;
    }
    
    .content-sidebar {
        display: none;
    }
    
    .content-main {
        width: 100%;
    }
    
    /* Adjust typography */
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    h1 {
        font-size: 24pt;
    }
    
    h2 {
        font-size: 18pt;
    }
    
    h3 {
        font-size: 14pt;
    }
    
    /* Show URLs for links */
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
        color: #666;
    }
    
    /* Avoid page breaks inside elements */
    img,
    table,
    figure,
    .card,
    .product-card,
    .blog-card {
        page-break-inside: avoid;
    }
    
    /* Optimize images */
    img {
        max-width: 100% !important;
    }
}

/* ====================================
   Accessibility Improvements
   ==================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: var(--text-dark);
    font-weight: 600;
    text-decoration: none;
}

.skip-to-main:focus {
    left: 10px;
    top: 10px;
}

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

/* High contrast mode support */
@media (prefers-contrast: more) {
    :root {
        --border-color: #000000;
        --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    :root {
        --white: #1a1a1a;
        --bg-light: #2a2a2a;
        --text-dark: #e0e0e0;
        --text-gray: #b0b0b0;
        --text-light: #808080;
        --border-color: #404040;
    }
    */
}

/* ====================================
   Utility Classes - Responsive
   ==================================== */

/* Display utilities */
@media (max-width: 575.98px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-flex { display: flex !important; }
}

@media (max-width: 767.98px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-flex { display: flex !important; }
}

@media (max-width: 991.98px) {
    .d-lg-none { display: none !important; }
    .d-lg-block { display: block !important; }
    .d-lg-flex { display: flex !important; }
}

/* Text alignment */
@media (max-width: 767.98px) {
    .text-md-center { text-align: center !important; }
    .text-md-left { text-align: left !important; }
    .text-md-right { text-align: right !important; }
}

@media (max-width: 575.98px) {
    .text-sm-center { text-align: center !important; }
    .text-sm-left { text-align: left !important; }
    .text-sm-right { text-align: right !important; }
}
