/* Mobile Adaptations for TechStore Burkina */

@media (max-width: 900px) {
    .main-layout {
        flex-direction: column;
        padding: 0 5px;
        gap: 15px;
    }

    .category-sidebar {
        width: 100%;
        position: static;
        display: none;
    }

    .category-sidebar.active {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 220px;
        height: 100vh;
        z-index: 3000;
        background: #fff;
        box-shadow: 10px 0 30px rgba(0,0,0,0.1);
        padding: 0;
        overflow-y: auto;
    }

    /* Mobile Nav in Sidebar */
    .mobile-nav-links {
        display: flex !important;
        flex-direction: column;
        padding: 8px;
        border-bottom: 1px solid var(--border-color);
        background: #f8fafc;
    }

    .mobile-nav-links a {
        padding: 8px 10px;
        font-size: 12px;
        font-weight: 700;
        color: var(--text-dark);
        text-decoration: none;
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .mobile-nav-links a i {
        width: 16px;
        text-align: center;
        color: var(--tech-blue);
        font-size: 14px;
    }

    .sidebar-title {
        padding: 10px 15px;
        background: #fff;
        border-bottom: 1px solid var(--border-color);
        font-size: 12px !important;
        margin: 0 !important;
        color: var(--tech-blue);
        text-transform: uppercase;
    }

    .category-list {
        padding: 5px 0;
    }

    .category-item {
        padding: 8px 15px !important;
        font-size: 13px;
    }

    .category-item span {
        font-size: 12px;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 2999;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.active {
        display: block !important;
    }

    .content-center {
        width: 100%;
    }

    .right-panel {
        width: 100%;
        flex-shrink: 1;
        margin-top: 10px;
    }

    .welcome-card {
        margin-bottom: 10px;
        padding: 15px !important;
    }

    .hero-banner {
        height: 150px;
    }

    .hero-banner div {
        left: 10px !important;
        bottom: 10px !important;
        padding: 5px 12px !important;
        border-radius: 8px !important;
        max-width: calc(100% - 20px) !important;
    }

    .hero-banner div h2 {
        font-size: 16px !important;
    }

    .hero-banner div p {
        font-size: 10px !important;
    }

    /* Header Mobile */
    .header-container {
        flex-wrap: wrap;
        padding: 5px 10px;
        gap: 5px;
    }

    .mobile-top-nav {
        display: flex !important;
    }

    .search-section {
        order: 3;
        width: 100%;
        margin-top: 5px;
    }

    .search-bar-wrapper {
        border-width: 1px !important;
    }

    .search-input-container {
        padding: 0 10px !important;
    }

    .search-input-container input {
        font-size: 13px !important;
        padding: 8px 0 !important;
    }

    .logo-section span {
        font-size: 14px;
    }

    .logo-section img {
        height: 26px;
    }

    .user-actions {
        gap: 8px;
    }

    .action-item i {
        font-size: 16px;
    }

    .mobile-menu-btn {
        display: flex !important;
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .search-btn {
        padding: 5px 10px !important;
    }

    .search-btn span {
        display: none;
    }

    /* Grid adjustment - INCREASE DENSITY */
    .product-grid-dense {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important;
        gap: 6px !important;
        padding: 10px 0;
    }

    .product-card-small .card-title {
        font-size: 9px;
        height: 22px;
    }

    .product-card-small .card-price {
        font-size: 12px;
    }

    .product-card-small .card-info {
        padding: 5px;
    }

    .product-card-mini {
        min-width: 90px !important;
        width: 90px !important;
    }

    .product-card-mini .card-img {
        height: 55px !important;
        font-size: 16px !important;
    }

    .product-card-mini .card-info {
        padding: 4px;
    }

    .product-card-mini .card-title {
        font-size: 8px;
        height: 18px;
    }

    .product-card-mini .card-price {
        font-size: 10px;
    }

    .strip-header h3 {
        font-size: 13px;
    }

    /* Modals Mobile */
    .modal-content {
        padding: 15px;
        width: 92%;
    }

    /* Cart Page Mobile Optimization */
    .cart-price-cell {
        display: flex !important;
        flex-direction: column !important;
        align-items: center;
        justify-content: center;
        font-size: 13px !important;
        line-height: 1.1;
    }

    .cart-price-cell .price-unit {
        font-size: 10px;
        opacity: 0.8;
    }

    .cart-action-cell .remove-text {
        display: none !important;
    }

    .cart-item-remove {
        font-size: 18px !important;
        color: #ef4444;
    }

    .cart-item-info-cell {
        gap: 8px !important;
        flex-direction: row !important; /* Keep image and text side by side */
        align-items: center !important;
    }

    .cart-item-img {
        width: 50px !important; /* Smaller image */
        height: 50px !important;
    }

    .cart-item-details h4 {
        font-size: 11px !important;
        line-height: 1.2;
        max-width: 120px;
        white-space: normal;
        margin: 0 !important;
    }

    .cart-item-id {
        display: none; /* Hide ID to save space */
    }

    .cart-check-cell {
        width: 30px;
    }

    /* Chat Page Mobile - Improved Stacked Layout */
    .chat-page-container {
        flex-direction: row !important; /* Back to row to use translations or relative positioning */
        height: calc(100vh - 120px) !important;
        margin: 5px !important;
        position: relative;
        overflow: hidden;
    }

    .chat-sidebar {
        width: 100% !important;
        height: 100% !important;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 10;
        transition: transform 0.3s ease;
        background: #fff;
    }

    .chat-main {
        width: 92% !important; /* Leave a small void on the left */
        height: 100% !important;
        position: absolute;
        top: 0;
        right: 0; /* Align to right */
        z-index: 20;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        background: #f8fafc;
        box-shadow: -5px 0 20px rgba(0,0,0,0.1);
    }

    .chat-page-container.mobile-show-chat .chat-main {
        transform: translateX(0);
    }

    .chat-page-container.mobile-show-chat .chat-sidebar {
        filter: blur(1px);
        opacity: 0.5;
    }

    /* Back overlay for "click in the void" to return to list */
    .chat-page-container.mobile-show-chat::after {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 15;
        background: transparent; /* Invisible void area */
    }

    .mobile-chat-back {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        color: var(--tech-blue);
        font-size: 18px;
        cursor: pointer;
        margin-right: 10px;
    }

    #detail-modal .modal-content {
        max-height: 90vh;
        overflow-y: auto !important;
        padding: 20px;
        display: flex !important;
        flex-direction: column !important;
    }

    #detail-modal .detail-img {
        max-height: 250px;
        object-fit: contain;
        margin-bottom: 15px;
    }

    #detail-modal .detail-specs {
        font-size: 13px;
        line-height: 1.6;
    }
}

.mobile-chat-back {
    display: none;
}
