/**
 * Responsive CSS for Devanco Canada Front-End
 * Mobile-first responsive design
 */

/* ========================================
   GLOBAL RESPONSIVE UTILITIES
   ======================================== */

/* Responsive Images */
img {
    max-width: 100%;
    height: auto;
}

/* Responsive Videos */
video {
    max-width: 100%;
    height: auto;
}

/* Responsive Tables */
.table-responsive-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ========================================
   MOBILE VISIBILITY UTILITIES
   ======================================== */

/* Hide on mobile */
@media (max-width: 767px) {
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: block !important;
    }
}

/* Hide on desktop */
@media (min-width: 768px) {
    .mobile-only {
        display: none !important;
    }

    .desktop-only {
        display: block !important;
    }
}

/* ========================================
   MOBILE DEVICES (0-575px)
   ======================================== */

@media (max-width: 575.98px) {
    /* Typography */
    body {
        font-size: 14px;
        line-height: 1.5;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.95rem; }

    /* Header */
    #topGreyBar {
        padding: 10px 0;
    }

    #topGreyBar .inner {
        padding: 0 15px;
    }

    .topLeftMenu img {
        max-width: 180px;
    }

    /* Navigation */
    nav {
        padding: 0 15px;
    }

    nav ul li {
        display: block;
        width: 100%;
        border-bottom: 1px solid #eee;
    }

    nav ul li a {
        display: block;
        padding: 12px 15px;
    }

    /* Bootstrap Grid Adjustments */
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .row {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
    }

    .row > * {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    /* Content Box */
    .contentBox {
        margin-bottom: 20px;
        padding: 15px;
    }

    /* Forms */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    textarea,
    select {
        width: 100%;
        font-size: 16px; /* Prevents iOS zoom */
        padding: 12px;
        margin-bottom: 15px;
    }

    /* Buttons */
    .btn,
    button,
    input[type="submit"],
    input[type="button"] {
        width: 100%;
        padding: 12px 20px;
        font-size: 16px;
        margin-bottom: 10px;
    }

    /* Product Grid */
    .product-grid {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .product-item {
        width: 100% !important;
        margin-bottom: 20px;
    }

    /* Tables */
    table {
        font-size: 12px;
    }

    table thead {
        display: none;
    }

    table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #ddd;
        border-radius: 5px;
        padding: 10px;
    }

    table tbody td {
        display: block;
        text-align: right;
        padding: 8px;
        border: none;
    }

    table tbody td:before {
        content: attr(data-label);
        float: left;
        font-weight: bold;
    }

    /* Footer */
    footer {
        padding: 20px 15px;
        text-align: center;
    }

    footer nav ul li {
        display: block;
        margin-bottom: 10px;
    }

    /* Cart */
    .cart-item {
        flex-direction: column;
    }

    .cart-item-image,
    .cart-item-details,
    .cart-item-quantity,
    .cart-item-price {
        width: 100% !important;
        margin-bottom: 10px;
    }

    /* Breadcrumbs */
    .breadcrumb {
        font-size: 12px;
        padding: 10px 0;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Search Box */
    .search-box {
        width: 100%;
        margin-bottom: 20px;
    }

    /* Modal/Lightbox */
    .colorbox,
    .modal {
        width: 95% !important;
        margin: 10px auto;
    }
}

/* ========================================
   TABLET PORTRAIT (576px - 767px)
   ======================================== */

@media (min-width: 576px) and (max-width: 767.98px) {
    /* Typography */
    body {
        font-size: 15px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    /* Bootstrap Grid - tablets still use stacked layout (handled by Bootstrap) */
    .container-fluid {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }

    /* Forms */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        font-size: 15px;
    }

    /* Buttons can be inline on tablet */
    .btn,
    button {
        width: auto;
        min-width: 150px;
    }

    /* Content boxes better spacing */
    .contentBox {
        padding: 20px;
        margin-bottom: 20px;
    }
}

/* ========================================
   TABLET LANDSCAPE (768px - 991px)
   ======================================== */

@media (min-width: 768px) and (max-width: 991.98px) {
    /* Typography */
    body {
        font-size: 15px;
    }

    /* Bootstrap Grid - tablets use col-md breakpoint if needed */
    .container-fluid {
        padding-left: 2rem;
        padding-right: 2rem;
    }

    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 20px;
    }

    /* Navigation */
    nav ul li a {
        padding: 10px 12px;
        font-size: 14px;
    }

    /* Content boxes */
    .contentBox {
        padding: 20px;
    }

    /* Adjust sidebar for medium screens */
    aside .contentBox {
        font-size: 14px;
    }
}

/* ========================================
   SMALL LAPTOP (992px - 1199px)
   ======================================== */

@media (min-width: 992px) and (max-width: 1199.98px) {
    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* Bootstrap Grid uses col-lg-3 (25%), col-lg-6 (50%), col-lg-3 (25%) from default.ctp */
    .container-fluid {
        padding-left: 2.5rem;
        padding-right: 2.5rem;
    }

    /* Optimize sidebar content for smaller laptops */
    aside {
        font-size: 14px;
    }

    aside .contentBox {
        padding: 18px;
    }
}

/* ========================================
   DESKTOP (1200px+)
   ======================================== */

@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
    }

    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
}

/* ========================================
   LARGE DESKTOP (1920px+)
   ======================================== */

@media (min-width: 1920px) {
    .container {
        max-width: 1600px;
    }

    body {
        font-size: 16px;
    }

    /* Product Grid */
    .product-grid {
        grid-template-columns: repeat(5, 1fr) !important;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    a,
    button,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    a:hover,
    button:hover {
        opacity: 1;
    }

    /* Better spacing for touch */
    nav ul li a {
        padding: 15px;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION
   ======================================== */

@media (max-width: 767px) and (orientation: landscape) {
    /* Adjust header height */
    #topGreyBar {
        padding: 5px 0;
    }

    .topLeftMenu img {
        max-width: 150px;
    }

    /* Reduce spacing */
    .contentBox {
        padding: 10px;
        margin-bottom: 15px;
    }
}

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

@media print {
    /* Hide non-essential elements */
    nav,
    .leftSideColumn,
    .rightSideColumn,
    footer,
    .breadcrumb,
    .btn,
    button {
        display: none !important;
    }

    /* Full width content */
    .rightSideContent {
        width: 100% !important;
        float: none !important;
    }

    /* Clean layout */
    body {
        background: white;
        color: black;
    }

    a {
        text-decoration: underline;
    }
}

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

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #F7D61B;
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    body {
        background: white;
        color: black;
    }

    a {
        color: #0000EE;
        text-decoration: underline;
    }
}

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