/* Mobile/tablet overrides [@media queries] */

@media (max-width: 768px) {
    /* Hide mobile header */
    .mobile-header {
        display: none !important;
    }

    /* Show new bottom bar */
    .bottom-bar {
        position: fixed;
        bottom: 16px;
        left: 16px;
        right: 16px;
        height: 70px;
        display: flex !important;
        flex-direction: column;
        background: var(--secondary-bg);
        background: color-mix(in srgb, var(--secondary-bg) 84%, transparent);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        z-index: 1001;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
        -webkit-backdrop-filter: blur(8px);
        backdrop-filter: blur(8px);
        user-select: none;
        touch-action: pan-y;
        overflow: hidden;
        transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .bottom-bar.active {
        left: 0;
        right: 0;
        bottom: 0;
        height: 55vh;
        background: color-mix(in srgb, var(--secondary-bg) 88%, transparent);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        border-radius: 24px 24px 0 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.4);
    }

    .bottom-bar.active .bottom-bar-panel {
        display: flex;
        flex-direction: column;
    }

    .bottom-bar-hint {
        position: fixed;
        left: 50%;
        bottom: calc(16px + 70px + 10px + env(safe-area-inset-bottom));
        transform: translate(-50%, 8px);
        opacity: 0;
        border: 1px solid var(--accent-color);
        background: var(--accent-color);
        color: white;
        border-radius: 999px;
        padding: 0.45rem 0.7rem;
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.78rem;
        font-weight: 600;
        z-index: 1003;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
        pointer-events: auto;
        transition: opacity 0.2s ease, transform 0.2s ease;
    }

    .bottom-bar-hint.show {
        opacity: 1;
        transform: translate(-50%, 0);
    }

    .bottom-bar-hint-arrow {
        color: white;
        animation: mobileBottomBarHintArrow 1s ease-in-out infinite;
    }

    @keyframes mobileBottomBarHintArrow {
        0%,
        100% {
            transform: translateY(0);
            opacity: 0.6;
        }
        50% {
            transform: translateY(2px);
            opacity: 1;
        }
    }

    @media (prefers-reduced-motion: reduce) {
        .bottom-bar-hint {
            transition: none;
        }

        .bottom-bar-hint-arrow {
            animation: none;
        }
    }

    .container {
        flex-direction: column;
    }

    /* Hide desktop sidebar entirely on mobile */
    .sidebar {
        display: none !important;
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .sidebar-section {
        padding: 0rem 1rem;
        border-bottom: none;
    }

    .sidebar-section:first-of-type {
        padding-bottom: 0;
    }

    .filter-section {
        padding-top: 0rem;
    }

    .mobile-bottom-filters {
        display: flex;
        flex-direction: column;
    }

    .mobile-bottom-filters > .sidebar-section:first-child {
        position: sticky;
        top: 0;
        z-index: 6;
        background: var(--secondary-bg);
        border-bottom: 1px solid var(--border-color);
        padding-top: 0.75rem;
    }

    .section-header {
        margin-bottom: 1rem;
    }

    .filter-section .section-header h3 {
        display: none;
    }

    .filter-section .section-header {
        justify-content: flex-end;
    }

    .filter-section .section-header #reset-filters {
        display: none;
    }

    .filter-controls {
        gap: 0.875rem;
    }

    .search-mobile-actions {
        margin-top: 0.7rem;
        margin-bottom: 0.7rem;
    }

    .mobile-price-select {
        display: none;
    }

    .mobile-price-range-control {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        order: 1;
    }

    .category-filter-item {
        order: 2;
    }

    .category-filter-item select {
        display: none;
    }

    .mobile-category-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 0.45rem;
    }

    .mobile-category-chip {
        border: 1px solid var(--border-color);
        background: var(--tertiary-bg);
        color: var(--light-text);
        border-radius: 10px;
        padding: 0.42rem 0.75rem;
        font-size: 0.74rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .mobile-category-chip.active {
        background: var(--accent-color);
        border-color: var(--accent-color);
        color: white;
    }

    .mobile-filter-actions {
        display: grid;
        grid-template-columns: 1fr auto;
        gap: 0.6rem;
        align-items: center;
    }

    .mobile-filter-actions .reset-btn {
        padding: 0.7rem 0.85rem;
        font-size: 0.74rem;
        white-space: nowrap;
    }

    .mobile-filter-actions .reset-btn.has-active-filters,
    .mobile-filter-actions .reset-btn.has-active-filters:hover {
        background: var(--pick-color);
        color: white;
        border-color: var(--pick-color);
    }

    .filter-item .checkbox-label {
        display: none;
    }

    /* Social area follows the same unified section styling */
    .sidebar-section.social-section,
    .social-section {
        border-top: 1px solid var(--border-color);
        padding: 0.85rem 1rem;
        background: var(--secondary-bg);
        margin-top: 0;
    }

    .sidebar-section.social-section {
        display: none;
    }

    .page-social-section {
        margin-top: 1rem;
    }

    .social-links {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 0.5rem;
    }

    .social-row {
        display: contents;
    }

    .social-row a {
        width: 44px;
        height: 44px;
        padding: 0;
        color: var(--medium-text);
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        background: var(--card-bg);
        border: 1px solid var(--border-color);
        flex: 0 0 auto;
    }

    .social-row a svg {
        width: 20px;
        height: 20px;
    }

    .sidebar-footer {
        padding: 0.85rem 1rem 1rem 1rem;
        border-top: none;
        background: transparent;
    }

    .sidebar-footer .disclaimer {
        font-size: 0.75rem;
    }

    .sidebar-footer .last-updated p {
        font-size: 0.7rem !important;
        margin: 0;
        padding: 0 0.5rem;
    }

    main {
        margin-left: 0;
        padding: 1rem;
        overflow-x: hidden;
        width: 100%;
        padding-bottom: calc(1.5rem + 96px + env(safe-area-inset-bottom));
    }

    .quote-banner {
        padding: 1.5rem 1.5rem;
        margin-bottom: 1rem;
        border-radius: 10px;
    }

    .quote-text {
        font-size: 1.3rem;
        margin-bottom: 0.5rem;
    }

    .quote-author {
        font-size: 1rem;
    }

    .recommended-count-banner {
        margin: 0.5rem 0 0.9rem;
        font-size: 0.9rem;
    }

    .category {
        margin-bottom: 0.1rem;
        overflow-x: hidden;
        width: 100%;
    }

    .category h2 {
        font-size: 1.3rem;
        margin-bottom: 1rem;
        padding: 0 0.5rem;
    }

    .view-mode-bar {
        margin: 0 0 1rem 0;
        justify-content: stretch;
    }

    .view-mode-toggle-btn {
        width: 100%;
    }

    .mobile-view-mode-toggle-item {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border-color);
    }

    .mobile-view-mode-toggle-item .view-mode-toggle-btn {
        margin-top: 0;
        background: var(--card-bg);
    }

    .category-options-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        grid-auto-rows: 1fr;
    }

    .category-toggle-btn {
        padding: 0.62rem;
        min-height: 90px;
        height: 100%;
        aspect-ratio: auto;
        align-items: stretch;
        text-align: left;
    }

    .category-toggle-content {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        width: 100%;
        height: 100%;
    }

    .category-toggle-text {
        gap: 0.22rem;
    }

    .category-toggle-label {
        font-size: clamp(0.8rem, 3.2vw, 0.95rem);
        line-height: 1.1;
    }

    .category-toggle-count {
        font-size: 0.7rem;
    }

    .category-toggle-svg {
        width: 30px;
        height: 30px;
        flex: 0 0 30px;
    }

    .category-page-header {
        margin-bottom: 1rem;
        padding: 0;
        display: none;
        background: transparent;
        border: none;
        flex-direction: column;
    }

    .category-page-title {
        font-size: 1.2rem;
    }

    .category-page-items {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .items.category-page-items {
        display: block;
        overflow-x: visible;
        overflow-y: visible;
        scroll-snap-type: none;
        padding: 0;
    }

    .items.category-page-items .item {
        flex: 1 1 auto;
        max-width: none;
        margin-bottom: 1rem;
    }

    /* Horizontal scrolling container */
    .items {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        gap: 1rem;
        padding: 0.5rem;
    }

    .item {
        flex: 0 0 280px;
        scroll-snap-align: start;
        max-width: 280px;
    }

    /* Scroll buttons container */
    .category {
        position: relative;
    }
}

@media (max-width: 480px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        padding: 0;
    }

    .sidebar-header {
        padding: 1.25rem 0.75rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }

    .sidebar-logo {
        width: 40px;
        height: 40px;
    }

    .sidebar-header h1 {
        font-size: 1.1rem;
    }

    main {
        padding: 1rem;
        padding-bottom: calc(1.5rem + 96px + env(safe-area-inset-bottom));
    }

    .category h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 600px) {
    .wishlist-btn {
        width: 100%;
    }

    .share-link-container {
        flex-direction: column;
    }

    .copy-btn {
        width: 100%;
    }

    .social-row {
        gap: 0.25rem;
    }
}
