/* =====================================================
   SPC eCommerce Template - Responsive Styles
   ===================================================== */

/* =====================================================
   1. EXTRA LARGE DEVICES (1400px and up)
   ===================================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1340px;
    }

    h1 { font-size: 3rem; }
    h2 { font-size: 2.5rem; }
    h3 { font-size: 2rem; }

    .hero-content h1 {
        font-size: 4rem;
    }

    .product-card {
        min-height: 450px;
    }
}

/* =====================================================
   2. LARGE DEVICES (1200px to 1399px)
   ===================================================== */
@media (max-width: 1399px) {
    .container {
        max-width: 1140px;
    }

    .hero-content h1 {
        font-size: 3rem;
    }
}

/* =====================================================
   3. MEDIUM DEVICES (992px to 1199px)
   ===================================================== */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }

    h1 { font-size: 2.2rem; }
    h2 { font-size: 1.8rem; }
    h3 { font-size: 1.5rem; }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-slider {
        height: 500px;
    }

    .product-details-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .quick-view-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        margin-bottom: 30px;
    }

    .flash-sale-header {
        flex-direction: column;
        text-align: center;
    }

    .flash-sale-timer {
        justify-content: center;
    }

    .features-bar .container {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer .row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =====================================================
   4. SMALL DEVICES (768px to 991px)
   ===================================================== */
@media (max-width: 991px) {
    .container {
        max-width: 720px;
    }

    /* Bootstrap 5 Navbar handles mobile display - removed old overrides */

    .hero-slider {
        height: 450px;
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content p {
        font-size: 1rem;
    }

    .hero-slider-arrow {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .hero-slider-arrow.prev {
        left: 15px;
    }

    .hero-slider-arrow.next {
        right: 15px;
    }

    .section {
        padding: 50px 0;
    }

    .section-header h2 {
        font-size: 1.8rem;
    }

    .flash-sale {
        padding: 40px 0;
    }

    .flash-sale-title h2 {
        font-size: 1.8rem;
    }

    .flash-sale-timer {
        gap: 10px;
    }

    .timer-block {
        min-width: 70px;
        padding: 10px 15px;
    }

    .timer-value {
        font-size: 1.5rem;
    }

    .flash-sale-products .product-card {
        min-width: 250px;
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .product-gallery {
        margin-bottom: 30px;
    }

    .product-main-image {
        height: 400px;
    }

    .product-thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }

    .features-bar .container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .feature-item {
        justify-content: center;
        text-align: center;
    }

    .feature-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .checkout-steps {
        flex-wrap: wrap;
        gap: 10px;
    }

    .checkout-steps::before {
        display: none;
    }

    .checkout-step {
        flex: 1;
        min-width: 120px;
    }

    .newsletter-form {
        flex-direction: column;
    }

    .cart-table {
        display: block;
        overflow-x: auto;
    }

    .orders-table {
        display: block;
        overflow-x: auto;
    }

    .auth-box {
        padding: 30px 20px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 20px;
    }

    .notification {
        min-width: 300px;
        right: 10px;
        top: 10px;
    }

    /* Grid adjustments */
    .row {
        display: flex;
        flex-wrap: wrap;
        margin: -10px;
    }

    .row .col,
    .row [class*="col-"] {
        padding: 10px;
    }
}

/* =====================================================
   5. EXTRA SMALL DEVICES (576px to 767px)
   ===================================================== */
@media (max-width: 767px) {
    .container {
        max-width: 540px;
    }

    .header-top {
        text-align: center;
    }

    .header-top .container {
        display: flex;
        flex-direction: column;
        gap: 5px;
    }

    .header-logo {
        font-size: 1.4rem;
    }

    .header-icon span {
        display: none;
    }

    .hero-slider {
        height: 400px;
    }

    .hero-content {
        padding: 0 20px;
    }

    .hero-content h1 {
        font-size: 1.8rem;
    }

    .hero-content p {
        font-size: 0.95rem;
    }

    .hero-content .btn {
        padding: 10px 24px;
        font-size: 0.9rem;
    }

    .hero-slider-arrow {
        display: none;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .section-header p {
        font-size: 0.95rem;
    }

    .flash-sale-header {
        text-align: center;
    }

    .flash-sale-title h2 {
        font-size: 1.5rem;
    }

    .flash-sale-timer {
        flex-wrap: wrap;
        justify-content: center;
    }

    .timer-block {
        min-width: 60px;
        padding: 8px 12px;
    }

    .timer-value {
        font-size: 1.3rem;
    }

    .timer-label {
        font-size: 0.65rem;
    }

    .flash-sale-products {
        gap: 15px;
    }

    .flash-sale-products .product-card {
        min-width: 220px;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        min-height: auto;
    }

    .product-actions {
        position: static;
        background: none;
        padding: 15px;
    }

    .product-body {
        padding: 15px;
    }

    .product-price-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-main-image {
        height: 350px;
    }

    .product-thumbnails {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .product-info h1 {
        font-size: 1.6rem;
    }

    .product-price-large {
        font-size: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .product-quantity {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-actions-main {
        flex-direction: column;
    }

    .product-actions-main .btn {
        width: 100%;
    }

    .product-tabs-nav {
        overflow-x: auto;
        white-space: nowrap;
    }

    .product-tab-btn {
        padding: 15px 20px;
    }

    .cart-product-image {
        width: 60px;
        height: 60px;
    }

    .cart-table th,
    .cart-table td {
        padding: 12px 8px;
        font-size: 0.85rem;
    }

    .cart-summary {
        padding: 20px;
    }

    .cart-summary-row {
        font-size: 0.9rem;
    }

    .checkout-steps {
        gap: 5px;
    }

    .checkout-step {
        min-width: 80px;
    }

    .checkout-step-number {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .checkout-step-label {
        font-size: 0.7rem;
    }

    .dashboard-content {
        padding: 20px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 20px;
    }

    .orders-table th,
    .orders-table td {
        padding: 12px 8px;
        font-size: 0.8rem;
    }

    .order-status {
        font-size: 0.7rem;
        padding: 4px 8px;
    }

    .auth-box {
        padding: 30px 20px;
        margin: 20px;
    }

    .auth-header h1 {
        font-size: 1.5rem;
    }

    .newsletter-form {
        padding: 0 15px;
    }

    .newsletter-form input,
    .newsletter-form button {
        padding: 12px 16px;
    }

    .footer-widget {
        margin-bottom: 25px;
    }

    .footer-social {
        justify-content: center;
    }

    .notification {
        left: 10px;
        right: 10px;
        min-width: auto;
    }

    .search-overlay-input {
        font-size: 1.2rem;
        padding: 15px;
    }

    .search-close {
        top: 20px;
        right: 20px;
        font-size: 1.5rem;
    }

    /* Buttons */
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .btn-lg {
        padding: 12px 24px;
        font-size: 1rem;
    }

    /* Forms */
    .form-control {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    .input-group-btn {
        padding: 10px 14px;
    }
}

/* =====================================================
   6. MOBILE DEVICES (480px and below)
   ===================================================== */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    h1 { font-size: 1.6rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.2rem; }

    .hero-slider {
        height: 350px;
    }

    .hero-content h1 {
        font-size: 1.5rem;
    }

    .hero-content p {
        font-size: 0.9rem;
    }

    .section {
        padding: 35px 0;
    }

    .section-header {
        margin-bottom: 30px;
    }

    .flash-sale-products {
        scroll-snap-type: x mandatory;
    }

    .flash-sale-products .product-card {
        scroll-snap-align: start;
        min-width: 200px;
    }

    .product-card {
        border-radius: 6px;
    }

    .product-image-wrapper {
        aspect-ratio: 1;
    }

    .product-title {
        font-size: 0.95rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .product-main-image {
        height: 300px;
    }

    .product-thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }

    .product-info h1 {
        font-size: 1.4rem;
    }

    .product-meta {
        flex-wrap: wrap;
        gap: 10px;
        font-size: 0.8rem;
    }

    .cart-product {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .cart-product-image {
        width: 50px;
        height: 50px;
    }

    .cart-table thead {
        display: none;
    }

    .cart-table tbody {
        display: block;
    }

    .cart-table tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid var(--border-light);
        border-radius: 8px;
        padding: 15px;
    }

    .cart-table td {
        display: block;
        border: none;
        padding: 8px 0;
    }

    .cart-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 5px;
        color: var(--text-light);
    }

    .checkout-steps {
        flex-direction: column;
        align-items: stretch;
    }

    .checkout-step {
        flex-direction: row;
        justify-content: flex-start;
        gap: 15px;
    }

    .dashboard-content {
        padding: 15px;
    }

    .orders-table thead {
        display: none;
    }

    .orders-table tbody {
        display: block;
    }

    .orders-table tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid var(--border-light);
        border-radius: 6px;
        padding: 15px;
    }

    .orders-table td {
        display: block;
        border: none;
        padding: 8px 0;
        text-align: left;
    }

    .orders-table td::before {
        content: attr(data-label);
        font-weight: 600;
        display: block;
        margin-bottom: 5px;
        color: var(--text-light);
    }

    .auth-box {
        padding: 25px 15px;
    }

    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .modal-body {
        padding: 15px;
    }

    .quick-view-grid {
        gap: 20px;
    }

    /* Feature items stack */
    .features-bar {
        padding: 20px 0;
    }

    .feature-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .feature-icon {
        width: 50px;
        height: 50px;
    }

    /* Footer */
    .footer {
        padding: 40px 0 20px;
    }

    .footer-widget h3 {
        font-size: 1rem;
        margin-bottom: 15px;
    }

    .footer-widget ul li {
        margin-bottom: 8px;
    }

    .footer-widget ul li a {
        font-size: 0.85rem;
    }

    /* Notification */
    .notification {
        padding: 15px;
        font-size: 0.85rem;
    }

    .notification-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .notification-content h4 {
        font-size: 0.9rem;
    }

    .notification-content p {
        font-size: 0.8rem;
    }

    /* Input groups */
    .input-group {
        max-width: 150px;
    }

    .input-group-field {
        width: 50px;
        font-size: 0.9rem;
    }

    /* Header adjustments */
    .header-main {
        padding: 15px 0;
    }

    .header-logo img {
        height: 40px;
    }

    .header-icon i {
        font-size: 1.1rem;
    }

    .header-icon .badge {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }

    /* Timer blocks */
    .timer-block {
        min-width: 55px;
        padding: 6px 10px;
    }

    .timer-value {
        font-size: 1.2rem;
    }

    /* Newsletter */
    .newsletter {
        padding: 40px 0;
    }

    .newsletter h2 {
        font-size: 1.4rem;
    }

    .newsletter p {
        font-size: 0.9rem;
    }
}

/* =====================================================
   7. LANDSCAPE ORIENTATIONS
   ===================================================== */
@media (max-width: 767px) and (orientation: landscape) {
    .hero-slider {
        height: 300px;
    }

    .hero-content h1 {
        font-size: 1.4rem;
    }

    .hero-content p {
        font-size: 0.85rem;
        margin-bottom: 15px;
    }

    .section {
        padding: 30px 0;
    }

    .flash-sale {
        padding: 30px 0;
    }
}

/* =====================================================
   8. TOUCH DEVICE OPTIMIZATIONS
   ===================================================== */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover {
        transform: none;
    }

    .product-actions {
        position: static;
        background: none;
        opacity: 1;
    }

    .product-action-btn:active {
        transform: scale(0.95);
    }

    .btn:active {
        transform: scale(0.98);
    }

    .category-card:hover {
        transform: none;
    }

    .category-card:active {
        transform: scale(0.98);
    }
}

/* =====================================================
   9. HIGH DPI / RETINA DISPLAYS
   ===================================================== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Ensure images look sharp on high DPI displays */
    .product-image,
    .product-image-hover,
    .category-card img,
    .cart-product-image {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* =====================================================
   10. PRINT OVERRIDES FOR MOBILE
   ===================================================== */
@media print and (max-width: 767px) {
    .dashboard-layout {
        display: block;
    }

    .dashboard-sidebar {
        display: none;
    }

    .orders-table,
    .orders-table tbody,
    .orders-table tr,
    .orders-table td {
        display: block;
    }

    .orders-table thead {
        display: none;
    }

    .orders-table tr {
        margin-bottom: 20px;
        border: 1px solid #000;
        page-break-inside: avoid;
    }
}

/* =====================================================
   11. DARK MODE SUPPORT (Optional)
   ===================================================== */
@media (prefers-color-scheme: dark) {
    /* Uncomment below if you want dark mode support

    :root {
        --bg-white: #1a1a1a;
        --bg-light: #2d2d2d;
        --bg-gray: #3d3d3d;
        --text-dark: #f0f0f0;
        --text-medium: #d0d0d0;
        --text-light: #a0a0a0;
        --text-muted: #808080;
        --border-color: #404040;
        --border-light: #353535;
        --primary-dark: #001a33;
    }

    .header,
    .navbar,
    .product-card,
    .dashboard-sidebar,
    .dashboard-content,
    .auth-box,
    .modal-content {
        background-color: #2d2d2d;
        border-color: #404040;
    }

    .form-control,
    .input-group {
        background-color: #2d2d2d;
        border-color: #404040;
        color: var(--text-dark);
    }

    .product-main-image,
    .product-thumbnail,
    .category-card {
        background-color: #3d3d3d;
    }

    */
}

/* =====================================================
   12. REDUCED MOTION PREFERENCE
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .hero-slide,
    .product-card,
    .category-card,
    .btn,
    .product-action-btn {
        transition: none;
    }

    @keyframes pulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.8; }
    }
}

/* =====================================================
   13. ACCESSIBILITY - FOCUS VISIBLE
   ===================================================== */
@media (focus-visible: focus) {
    .btn:focus-visible,
    .nav-link:focus-visible,
    .product-action-btn:focus-visible,
    .form-control:focus-visible,
    .header-icon:focus-visible {
        outline: 2px solid var(--accent-color);
        outline-offset: 2px;
    }
}

/* =====================================================
   14. CONFLICT RESOLUTION FOR OVERRIDES
   ===================================================== */
/* Ensure specific mobile overrides take precedence */
@media (max-width: 767px) {
    .product-card .product-actions {
        position: static !important;
        opacity: 1 !important;
        background: none !important;
    }

    .hero-slider-arrow {
        display: none !important;
    }

    .header-top .container {
        flex-direction: column;
        text-align: center;
    }

    .modal-content {
        border-radius: 0 !important;
    }
}
