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

/* ============================================
   Large Screens (1200px and below)
   ============================================ */
@media (max-width: 1200px) {
    .nav-link span {
        font-size: 0.85rem;
    }

    .hero-text h2 {
        font-size: 2.5rem;
    }

    .content-wrapper {
        grid-template-columns: 250px 1fr;
    }

    .footer-grid {
        grid-template-columns: 1.2fr 1fr 1fr 1.2fr;
        gap: var(--spacing-xl);
    }
}

/* ============================================
   Medium Screens / Tablets (992px and below)
   ============================================ */
@media (max-width: 992px) {
    /* Top Bar */
    .top-bar-center {
        display: none;
    }

    /* Header */
    .header-content {
        flex-wrap: wrap;
    }

    .search-section {
        order: 3;
        max-width: 100%;
        flex: 0 0 100%;
        margin-top: var(--spacing-md);
    }

    .user-actions .action-text {
        display: none;
    }

    .action-item {
        padding: var(--spacing-sm);
    }

    /* Navigation */
    .nav-list {
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        padding: var(--spacing-sm) 0;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .nav-list::-webkit-scrollbar {
        display: none;
    }

    .nav-link {
        white-space: nowrap;
        padding: var(--spacing-sm) var(--spacing-md);
    }

    /* Hero */
    .hero-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-text {
        max-width: 100%;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-image {
        height: 300px;
        width: 100%;
    }

    /* Content Layout */
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        order: 2;
    }

    .products-section {
        order: 1;
    }

    /* Mobile Filter Toggle */
    .filter-toggle-mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--spacing-sm);
        width: 100%;
        padding: var(--spacing-md);
        background: var(--primary-beige);
        color: var(--primary-brown);
        border-radius: var(--radius-md);
        font-weight: 600;
        margin-bottom: var(--spacing-md);
    }

    .sidebar.collapsed {
        display: none;
    }

    /* Products Grid */
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    /* Features */
    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Panorama */
    .panorama-container {
        height: 450px;
    }

    .panorama-controls {
        flex-wrap: wrap;
        max-width: 90%;
    }

    .panorama-minimap {
        bottom: auto;
        top: 70px;
        left: var(--spacing-sm);
    }

    .panorama-info-panel {
        display: none;
    }

    /* Product Modal */
    .product-modal {
        width: 95%;
    }

    .product-modal-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   Small Screens / Large Phones (768px and below)
   ============================================ */
@media (max-width: 768px) {
    /* Typography Scale */
    html {
        font-size: 15px;
    }

    /* Top Bar */
    .top-bar {
        padding: var(--spacing-xs) 0;
    }

    .top-bar .container {
        justify-content: center;
    }

    .top-bar-left,
    .top-bar-right {
        gap: var(--spacing-sm);
    }

    .top-bar-right {
        display: none;
    }

    .top-link span {
        display: none;
    }

    .top-link i {
        font-size: 1.1rem;
    }

    /* Header */
    .main-header {
        padding: var(--spacing-sm) 0;
    }

    .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .logo-text h1 {
        font-size: 1.25rem;
    }

    .logo-text .tagline {
        font-size: 0.65rem;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .user-actions {
        gap: var(--spacing-xs);
    }

    /* Navigation - Mobile Drawer */
    .main-nav {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--white);
        z-index: var(--z-modal);
        transition: left var(--transition-normal);
        overflow-y: auto;
        padding-top: var(--spacing-xl);
    }

    .main-nav.open {
        left: 0;
    }

    .nav-list {
        flex-direction: column;
        padding: var(--spacing-md);
    }

    .nav-item {
        width: 100%;
    }

    .nav-link {
        justify-content: flex-start;
        padding: var(--spacing-md);
        border-bottom: 1px solid var(--gray-100);
    }

    .submenu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: var(--gray-50);
        display: none;
    }

    .nav-item.has-submenu.open .submenu {
        display: block;
    }

    /* Mobile Nav Overlay */
    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-modal) - 1);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-normal);
    }

    .nav-overlay.open {
        opacity: 1;
        visibility: visible;
    }

    /* Hero */
    .hero-section {
        padding: var(--spacing-xl) 0 0;
    }

    .hero-text h2 {
        font-size: 1.75rem;
    }

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

    .hero-buttons {
        flex-direction: column;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .hero-image {
        height: 200px;
    }

    .float-item {
        width: 80px !important;
    }

    /* Products Header */
    .products-header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: flex-start;
    }

    .view-controls {
        width: 100%;
        flex-wrap: wrap;
    }

    .sort-dropdown {
        flex: 1;
    }

    .sort-dropdown select {
        width: 100%;
    }

    .view-mode.panorama-mode span {
        display: none;
    }

    /* Products Grid */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-sm);
    }

    .product-card {
        border-radius: var(--radius-md);
    }

    .product-info {
        padding: var(--spacing-sm);
    }

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

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

    /* List View */
    .products-grid.list-view .product-card {
        grid-template-columns: 120px 1fr;
    }

    .products-grid.list-view .product-image {
        height: 120px;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }

    .page-num {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }

    /* Features */
    .features-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .feature-item {
        display: flex;
        align-items: center;
        gap: var(--spacing-md);
        text-align: left;
        padding: var(--spacing-md);
    }

    .feature-icon {
        margin: 0;
        flex-shrink: 0;
        width: 50px;
        height: 50px;
    }

    .feature-icon i {
        font-size: 1.25rem;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-xl);
    }

    .footer-col {
        text-align: center;
    }

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

    .footer-bottom {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }

    /* Cart Sidebar */
    .cart-sidebar {
        width: 100%;
        right: -100%;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }

    .auth-modal,
    .tracking-modal {
        width: 95%;
        padding: var(--spacing-md);
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Panorama */
    .panorama-container {
        height: 350px;
        border-radius: var(--radius-md);
    }

    .panorama-controls {
        top: var(--spacing-sm);
        padding: var(--spacing-xs);
        gap: var(--spacing-xs);
    }

    .pano-btn {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.75rem;
    }

    .pano-btn span {
        display: none;
    }

    .panorama-minimap {
        display: none;
    }

    .panorama-category-nav {
        padding: var(--spacing-xs);
        gap: var(--spacing-xs);
    }

    .category-nav-btn {
        min-width: 60px;
        padding: var(--spacing-xs);
    }

    .category-nav-btn span {
        font-size: 0.65rem;
    }

    .vr-mode-btn {
        padding: var(--spacing-sm);
    }

    .vr-mode-btn span {
        display: none;
    }

    /* Popup in Panorama */
    .panorama-product-popup {
        width: 90%;
        max-width: 320px;
        left: 50% !important;
        transform: translateX(-50%) scale(0.9) translateY(10px);
    }

    .panorama-product-popup.active {
        transform: translateX(-50%) scale(1) translateY(0);
    }

    .popup-image {
        height: 150px;
    }

    /* Toast */
    .toast-container {
        top: auto;
        bottom: var(--spacing-md);
        right: var(--spacing-sm);
        left: var(--spacing-sm);
    }

    .toast {
        min-width: auto;
    }

    /* Back to Top */
    .back-to-top {
        width: 45px;
        height: 45px;
        right: var(--spacing-md);
        bottom: var(--spacing-md);
    }
}

/* ============================================
   Extra Small Screens (480px and below)
   ============================================ */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 var(--spacing-sm);
    }

    /* Header */
    .logo-text h1 {
        font-size: 1.1rem;
    }

    .logo-text .tagline {
        display: none;
    }

    .search-form input {
        padding: var(--spacing-sm);
    }

    .search-form button {
        padding: var(--spacing-sm);
    }

    /* Hero */
    .hero-text h2 {
        font-size: 1.5rem;
    }

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

    .btn {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9rem;
    }

    /* Products */
    .products-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-xs);
    }

    .product-info {
        padding: var(--spacing-xs);
    }

    .product-name {
        font-size: 0.85rem;
        -webkit-line-clamp: 2;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .product-category {
        font-size: 0.65rem;
    }

    .product-rating {
        font-size: 0.75rem;
    }

    .current-price {
        font-size: 1rem;
    }

    .original-price {
        font-size: 0.8rem;
    }

    .product-weight {
        font-size: 0.75rem;
    }

    .btn-add-to-cart {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.8rem;
    }

    .product-badges {
        top: var(--spacing-xs);
        left: var(--spacing-xs);
    }

    .badge-item {
        font-size: 0.6rem;
        padding: 2px 4px;
    }

    /* Sidebar Filters */
    .sidebar {
        padding: var(--spacing-md);
    }

    .filter-group {
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-md);
    }

    .filter-title {
        font-size: 0.9rem;
    }

    .filter-option {
        font-size: 0.85rem;
    }

    /* Panorama */
    .panorama-container {
        height: 280px;
    }

    .panorama-controls {
        flex-wrap: wrap;
        justify-content: center;
    }

    .pano-btn i {
        font-size: 0.85rem;
    }

    .panorama-category-nav {
        overflow-x: auto;
        justify-content: flex-start;
        max-width: 90%;
    }

    /* Modals */
    .modal {
        padding: var(--spacing-sm);
    }

    .modal-content {
        border-radius: var(--radius-md);
    }

    .product-modal {
        padding: var(--spacing-sm);
    }

    .product-gallery .main-image {
        aspect-ratio: 4/3;
    }

    .thumbnail-list img {
        width: 50px;
        height: 50px;
    }

    .product-details h2 {
        font-size: 1.25rem;
    }

    .weight-options {
        flex-wrap: wrap;
    }

    .weight-option {
        font-size: 0.85rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    /* Cart */
    .cart-item {
        gap: var(--spacing-sm);
    }

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

    .cart-item-name {
        font-size: 0.9rem;
    }

    .qty-controls button,
    .qty-controls input {
        width: 28px;
        height: 28px;
    }
}

/* ============================================
   Touch Device Optimizations
   ============================================ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .nav-link,
    .action-item,
    .btn,
    .filter-option,
    .page-num {
        min-height: 44px;
    }

    /* Remove hover effects that don't work well on touch */
    .product-card:hover {
        transform: none;
    }

    .product-actions-overlay {
        opacity: 1;
        transform: translateX(0);
    }

    /* Better scrolling */
    .nav-list,
    .panorama-category-nav {
        scroll-snap-type: x mandatory;
    }

    .nav-item,
    .category-nav-btn {
        scroll-snap-align: start;
    }
}

/* ============================================
   High Resolution Screens (Retina)
   ============================================ */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Sharper borders */
    .product-card,
    .modal-content,
    .cart-sidebar {
        border: 0.5px solid var(--gray-200);
    }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode */
    /*
    :root {
        --white: #1a1a1a;
        --black: #ffffff;
        --gray-100: #2d2d2d;
        --gray-200: #3d3d3d;
        --gray-300: #4d4d4d;
        --gray-400: #6d6d6d;
        --gray-500: #8d8d8d;
        --gray-600: #adadad;
        --gray-700: #cdcdcd;
        --gray-800: #ececec;
        --gray-900: #f8f8f8;
        --primary-beige: #2a2520;
        --primary-beige-dark: #1f1b17;
        --primary-beige-light: #352f28;
    }
    */
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .top-bar,
    .main-header,
    .main-nav,
    .hero-section,
    .sidebar,
    .panorama-container,
    .pagination,
    .features-section,
    .main-footer,
    .cart-sidebar,
    .modal,
    .toast-container,
    .back-to-top {
        display: none !important;
    }

    .main-content {
        padding: 0;
    }

    .content-wrapper {
        display: block;
    }

    .products-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

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

    .float-item {
        animation: none;
    }

    .hotspot-pulse {
        animation: none;
    }

    html {
        scroll-behavior: auto;
    }
}

/* ============================================
   Landscape Orientation (Mobile)
   ============================================ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        padding: var(--spacing-md) 0;
    }

    .hero-content {
        flex-direction: row;
    }

    .hero-text h2 {
        font-size: 1.5rem;
    }

    .hero-image {
        height: 150px;
    }

    .panorama-container {
        height: 250px;
    }

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