/* ===== Advanced Responsive Styles - All Devices (light only) ===== */

/* ===== CSS Variables ===== */
:root {
    --primary: #2a7de1;
    --primary-dark: #1a5fb4;
    --primary-light: #e8f0fe;
    --secondary: #ff6b35;
    --text: #2d3748;
    --text-light: #718096;
    --white: #ffffff;
    --gray-light: #f7fafc;
    --gray-medium: #e2e8f0;
    --gray-dark: #a0aec0;
    --bg-warm: #EDE8D0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.15);
    --radius: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-size-base: 16px;
    --container-padding: 20px;
    --header-height: 70px;
    color-scheme: light only;
}

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: var(--font-size-base);
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-size: 1rem;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================ */
/* ===== DESKTOP - 1920px and above ===== */
/* ============================================ */
@media (min-width: 1920px) {
    :root {
        --container-padding: 40px;
        --font-size-base: 18px;
    }

    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
    }

    .product-detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 60px;
    }

    .checkout-form {
        grid-template-columns: 2fr 1fr;
        gap: 40px;
    }

    .profile-grid {
        grid-template-columns: 280px 1fr;
        gap: 40px;
    }

    .slide-content h1 {
        font-size: 3.5rem;
        line-height: 1.2;
    }

    .section-title {
        font-size: 2.2rem;
        margin-bottom: 30px;
    }

    .product-info .product-name {
        font-size: 1.1rem;
        min-height: 3rem;
    }

    .current-price {
        font-size: 1.4rem;
    }

    .original-price {
        font-size: 1rem;
    }

    .add-to-cart {
        font-size: 1rem;
        padding: 14px 24px;
    }

    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 40px;
        padding: 60px 0;
    }

    .main-nav ul {
        gap: 30px;
    }

    .main-nav ul li a {
        font-size: 1.1rem;
        padding: 10px 0;
    }

    .product-card {
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .product-card:hover {
        transform: translateY(-8px);
        box-shadow: var(--shadow-lg);
    }

    .top-bar {
        padding: 12px 0;
    }

    .top-bar p {
        font-size: 1rem;
    }

    .top-bar-links a {
        font-size: 1rem;
        padding: 0 15px;
    }

    .header-actions a {
        font-size: 1.3rem;
    }

    .cart-table {
        font-size: 1rem;
    }

    .cart-table td,
    .cart-table th {
        padding: 16px 20px;
    }

    .cart-item-product img {
        width: 80px;
        height: 80px;
    }

    .quantity-input input {
        width: 60px;
        height: 40px;
        font-size: 1rem;
    }
}

/* ============================================ */
/* ===== LAPTOP - 1366px to 1919px ===== */
/* ============================================ */
@media (min-width: 1366px) and (max-width: 1919px) {
    :root {
        --container-padding: 30px;
    }

    .products-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 25px;
    }

    .product-detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 50px;
    }

    .checkout-form {
        grid-template-columns: 2fr 1fr;
        gap: 30px;
    }

    .profile-grid {
        grid-template-columns: 250px 1fr;
        gap: 30px;
    }

    .slide-content h1 {
        font-size: 3rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .footer-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 30px;
        padding: 50px 0;
    }

    .main-nav ul {
        gap: 20px;
    }

    .main-nav ul li a {
        font-size: 1rem;
        padding: 8px 0;
    }

    .product-card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-lg);
    }

    .top-bar {
        padding: 10px 0;
    }

    .cart-table td,
    .cart-table th {
        padding: 14px 16px;
    }
}

/* ============================================ */
/* ===== TABLET - 769px to 1365px ===== */
/* ============================================ */
@media (min-width: 769px) and (max-width: 1365px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    .product-detail-grid {
        grid-template-columns: 1fr 1fr;
        gap: 35px;
    }

    .checkout-form {
        grid-template-columns: 1fr 1fr;
        gap: 25px;
    }

    .profile-grid {
        grid-template-columns: 220px 1fr;
        gap: 25px;
    }

    .slide-content h1 {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 25px;
        padding: 40px 0;
    }

    .main-nav ul {
        gap: 15px;
    }

    .main-nav ul li a {
        font-size: 0.95rem;
    }

    .top-bar p {
        font-size: 0.9rem;
    }

    .top-bar-links a {
        font-size: 0.9rem;
    }

    .cart-table td,
    .cart-table th {
        padding: 12px 14px;
    }
}

/* ============================================ */
/* ===== SMALL TABLET & LARGE PHONE - up to 768px ===== */
/* ============================================ */
@media (max-width: 768px) {
    /* Mobile Menu Toggle */
    .mobile-menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        font-size: 1.75rem;
        cursor: pointer;
        color: var(--primary);
        padding: 8px;
        border-radius: var(--radius);
        transition: var(--transition);
        touch-action: manipulation;
        width: 44px;
        height: 44px;
        position: relative;
    }

    .mobile-menu-toggle:hover,
    .mobile-menu-toggle:focus-visible {
        background: var(--gray-light);
        outline: 2px solid var(--primary);
        outline-offset: 2px;
    }

    .mobile-menu-toggle .menu-icon {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 24px;
        height: 20px;
        transition: var(--transition);
    }

    .mobile-menu-toggle .menu-icon span {
        display: block;
        height: 2px;
        background: currentColor;
        border-radius: 2px;
        transition: var(--transition);
        transform-origin: center;
    }

    .mobile-menu-toggle.active .menu-icon span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .mobile-menu-toggle.active .menu-icon span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }

    .mobile-menu-toggle.active .menu-icon span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }

    /* Navigation Overlay */
    .nav-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .nav-overlay.active {
        display: block;
        opacity: 1;
    }

    .main-nav {
        position: relative;
        width: 100%;
    }

    .main-nav ul {
        display: none;
        flex-direction: column;
        position: absolute;
        top: calc(100% + 12px);
        left: 0;
        right: 0;
        background: var(--white);
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
        padding: 8px 0;
        max-height: 80vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1000;
        opacity: 0;
        transform: translateY(-10px);
        transition: all 0.3s ease;
        pointer-events: none;
    }

    .main-nav ul.active {
        display: flex;
        opacity: 1;
        transform: translateY(0);
        pointer-events: all;
    }

    .main-nav ul li {
        width: 100%;
        border-bottom: 1px solid var(--gray-medium);
    }

    .main-nav ul li:last-child {
        border-bottom: none;
    }

    .main-nav ul li a {
        display: flex;
        align-items: center;
        padding: 14px 20px;
        color: var(--text);
        font-size: 0.95rem;
        font-weight: 500;
        transition: var(--transition);
        gap: 10px;
        text-decoration: none;
    }

    .main-nav ul li a:hover,
    .main-nav ul li a:focus-visible {
        background: var(--primary-light);
        color: var(--primary);
        padding-left: 24px;
    }

    .dropdown-menu {
        position: static;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        transform: none;
        padding: 0;
        background: var(--gray-light);
        display: none;
        margin: 0;
        border-radius: 0;
    }

    .dropdown-menu.active {
        display: block;
    }

    .dropdown-menu li a {
        padding: 10px 20px 10px 40px;
        font-size: 0.9rem;
        font-weight: 400;
        border-bottom: 1px solid var(--gray-medium);
    }

    .dropdown-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: none;
        border: none;
        padding: 14px 20px;
        font-size: 0.95rem;
        font-weight: 500;
        color: var(--text);
        cursor: pointer;
        transition: var(--transition);
        gap: 10px;
    }

    .dropdown-toggle:hover {
        background: var(--primary-light);
        color: var(--primary);
    }

    .dropdown-toggle .arrow {
        transition: transform 0.3s ease;
        font-size: 0.7rem;
    }

    .dropdown-toggle.active .arrow {
        transform: rotate(180deg);
    }

    .main-nav ul li:hover .dropdown-menu {
        display: none;
    }

    /* Grids */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .product-detail-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .checkout-form {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .profile-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .product-card {
        transition: transform 0.2s ease;
        cursor: pointer;
        touch-action: manipulation;
    }

    .product-card:active {
        transform: scale(0.98);
    }

    .product-card .product-image {
        aspect-ratio: 1/1;
        object-fit: cover;
        width: 100%;
    }

    .slide-content h1 {
        font-size: 1.8rem;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        padding: 30px 0;
    }

    .footer-column h3 {
        font-size: 0.95rem;
    }

    .footer-column ul li a {
        font-size: 0.85rem;
    }

    .top-bar {
        padding: 8px 0;
        flex-direction: column;
        text-align: center;
        gap: 4px;
    }

    .top-bar p {
        font-size: 0.8rem;
    }

    .top-bar-links {
        display: flex;
        justify-content: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .top-bar-links a {
        font-size: 0.8rem;
    }

    .header-actions {
        gap: 8px;
    }

    .header-actions a {
        font-size: 1.1rem;
        padding: 6px;
        min-width: 36px;
        min-height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: var(--transition);
        position: relative;
        touch-action: manipulation;
    }

    .header-actions a:active {
        transform: scale(0.9);
    }

    .cart-count {
        position: absolute;
        top: -2px;
        right: -2px;
        width: 18px;
        height: 18px;
        font-size: 0.6rem;
        background: var(--secondary);
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
    }

    .cart-table {
        font-size: 0.8rem;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .cart-table td,
    .cart-table th {
        padding: 8px 6px;
    }

    .cart-item-product {
        display: flex;
        align-items: center;
        gap: 8px;
        min-width: 120px;
    }

    .cart-item-product img {
        width: 40px;
        height: 40px;
        border-radius: 4px;
        flex-shrink: 0;
    }

    .quantity-input input {
        width: 36px;
        height: 28px;
        font-size: 0.8rem;
        text-align: center;
        border: 1px solid var(--gray-medium);
        border-radius: 4px;
    }

    .quantity-input button {
        width: 28px;
        height: 28px;
        min-width: 28px;
        padding: 0;
        font-size: 0.9rem;
    }
}

/* ============================================ */
/* ===== MOBILE - 480px and below ===== */
/* ============================================ */
@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .product-info {
        padding: 10px 8px;
    }

    .product-info .product-name {
        font-size: 0.8rem;
        min-height: 2.4rem;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        margin-bottom: 4px;
    }

    .current-price {
        font-size: 0.9rem;
        font-weight: 700;
        color: var(--primary);
    }

    .original-price {
        font-size: 0.7rem;
        text-decoration: line-through;
        color: var(--text-light);
        margin-left: 6px;
    }

    .add-to-cart {
        font-size: 0.75rem;
        padding: 6px 10px;
        border-radius: var(--radius);
        min-height: 36px;
        touch-action: manipulation;
        width: 100%;
        justify-content: center;
        gap: 4px;
    }

    .add-to-cart:active {
        transform: scale(0.95);
    }

    .slide-content h1 {
        font-size: 1.4rem;
        line-height: 1.3;
    }

    .slide-content p {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 1.25rem;
        margin-bottom: 16px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        padding: 25px 0;
    }

    .footer-column h3 {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }

    .footer-column ul li a {
        font-size: 0.8rem;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 15px 0;
        font-size: 0.75rem;
    }

    .top-bar p {
        font-size: 0.7rem;
    }

    .top-bar-links a {
        font-size: 0.7rem;
    }

    .cart-table {
        font-size: 0.7rem;
    }

    .cart-table td,
    .cart-table th {
        padding: 6px 4px;
    }

    .cart-item-product img {
        width: 35px;
        height: 35px;
    }

    .cart-item-product span {
        font-size: 0.7rem;
    }

    .quantity-input input {
        width: 32px;
        height: 24px;
        font-size: 0.7rem;
    }

    .quantity-input button {
        width: 24px;
        height: 24px;
        min-width: 24px;
        font-size: 0.8rem;
    }
}

/* ============================================ */
/* ===== EXTRA SMALL - 360px and below ===== */
/* ============================================ */
@media (max-width: 360px) {
    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .product-info .product-name {
        font-size: 0.7rem;
        min-height: 2rem;
    }

    .current-price {
        font-size: 0.8rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 15px;
    }

    .slide-content h1 {
        font-size: 1.2rem;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .container {
        padding: 0 10px;
    }

    .header-actions a {
        font-size: 0.9rem;
        min-width: 32px;
        min-height: 32px;
    }

    .cart-count {
        width: 16px;
        height: 16px;
        font-size: 0.5rem;
    }
}

/* ============================================ */
/* ===== TOUCH-FRIENDLY IMPROVEMENTS ===== */
/* ============================================ */
@media (hover: none) and (pointer: coarse) {
    button,
    a,
    .clickable {
        min-height: 44px;
        min-width: 44px;
    }

    .product-card:hover {
        transform: none;
    }

    .add-to-cart:hover {
        transform: none;
    }

    .product-card:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }

    .btn-primary:active,
    .add-to-cart:active {
        transform: scale(0.95);
    }
}

/* ============================================ */
/* ===== PRINT STYLES ===== */
/* ============================================ */
@media print {
    .main-nav,
    .top-bar,
    .site-footer,
    .header-actions,
    .mobile-menu-toggle,
    .breadcrumb,
    .social-share {
        display: none !important;
    }

    .product-detail-grid {
        display: block;
    }

    .product-detail-grid .product-image-gallery {
        margin-bottom: 20px;
    }

    .btn-primary,
    .add-to-cart,
    .add-to-wishlist {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000;
    }

    a {
        text-decoration: underline;
        color: #000;
    }

    .product-card {
        break-inside: avoid;
        border: 1px solid #ddd;
        padding: 10px;
    }
}

/* ============================================ */
/* ===== ACCESSIBILITY ===== */
/* ============================================ */
@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;
    }
}

@media (prefers-contrast: high) {
    :root {
        --primary: #0055cc;
        --text: #000000;
        --text-light: #333333;
        --gray-light: #e8e8e8;
        --gray-medium: #999999;
    }

    .product-card {
        border: 2px solid #000;
    }

    .btn-primary {
        border: 2px solid #000;
    }

    a {
        text-decoration: underline;
    }
}

/* ============================================ */
/* ===== UTILITY CLASSES ===== */
/* ============================================ */
.hide-on-mobile {
    display: block;
}

.show-on-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-on-mobile {
        display: none !important;
    }
    .show-on-mobile {
        display: block !important;
    }
    .text-center-mobile {
        text-align: center !important;
    }
    .flex-column-mobile {
        flex-direction: column !important;
    }
    .full-width-mobile {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    .hide-on-phone {
        display: none !important;
    }
    .show-on-phone {
        display: block !important;
    }
    .text-center-phone {
        text-align: center !important;
    }
    .full-width-phone {
        width: 100% !important;
    }
}

@media (min-width: 1366px) {
    .hide-on-desktop {
        display: none !important;
    }
}

/* ============================================ */
/* ===== SAFE AREA SUPPORT ===== */
/* ============================================ */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(var(--container-padding), env(safe-area-inset-left));
        padding-right: max(var(--container-padding), env(safe-area-inset-right));
    }

    .main-nav ul.active {
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }

    .mobile-menu-toggle {
        margin-right: env(safe-area-inset-right);
    }
}

/* ============================================ */
/* ===== LOADING STATE ===== */
/* ============================================ */
.product-image {
    background: var(--gray-medium);
    position: relative;
    overflow: hidden;
}

.product-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 1.5s infinite;
}

.product-image.loaded::after {
    animation: none;
    display: none;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(200%);
    }
}

/* ============================================ */
/* ===== CUSTOM SCROLLBAR ===== */
/* ============================================ */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-dark) var(--gray-light);
}

/* ============================================ */
/* ===== FOCUS STYLES ===== */
/* ============================================ */
:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}