/* ============================================
   SHOP REDESIGN — layout additions layered on top of style.css
   Reuses the :root custom properties already declared in style.css;
   does NOT redeclare :root.
   ============================================ */

/* ============================================
   LOGO (two-tone brand name)
   ============================================ */
.logo .shop-logo {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--dark-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.shop-logo i {
    color: var(--primary-color);
}

.shop-logo span {
    color: var(--secondary-color);
    margin-left: 0.25rem;
}

/* ============================================
   BUTTON VARIANT (used by the chat drawer's "View All Messages" link)
   ============================================ */
.btn-outline {
    border: 1px solid var(--border-color);
    color: var(--dark-color) !important;
    background: var(--bg-card);
}

.btn-outline:hover {
    background: var(--light-color);
    border-color: var(--gray-light);
}

/* ============================================
   SIDEBAR + MAIN LAYOUT (index.php)
   ============================================ */
.main-layout {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    padding-top: 24px;
    padding-bottom: 40px;
}

.shop-sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 90px;
}

.shop-content {
    flex: 1;
    min-width: 0;
}

.sidebar-title {
    font-size: 1.1rem;
    color: var(--dark-color);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-light);
}

/* ============================================
   CATEGORY TREE (shared partial: category_sidebar.php)
   Generic enough to render correctly inside either .shop-sidebar (index.php)
   or the existing .search-sidebar/.filter-section shell (search.php).
   ============================================ */
.category-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-menu > li {
    margin-bottom: 4px;
}

.category-menu a {
    text-decoration: none;
    color: var(--text-main);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.category-menu a i {
    width: 16px;
    text-align: center;
    color: var(--gray-color);
}

.category-menu a.active i {
    color: #fff;
}

.category-menu a:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.category-menu a.active {
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

.category-menu .submenu {
    list-style: none;
    padding-left: 18px;
    margin: 2px 0 6px;
}

.category-menu .submenu a {
    font-size: 0.83rem;
    color: var(--gray-color);
    padding: 4px 8px;
}

.category-menu .submenu a.active {
    color: #fff;
}

/* ============================================
   PRODUCT CARD — corporate / P2P badge overlay
   ============================================ */
.product-card {
    position: relative;
}

.badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 5;
    color: #fff;
    box-shadow: var(--shadow-sm);
}

.badge-corporate {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.badge-p2p {
    background: linear-gradient(135deg, var(--secondary-color), #9d4edd);
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.product-category {
    font-size: 0.75rem;
    color: var(--gray-color);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 4px;
}

/* ============================================
   FLOATING CHAT DRAWER (global widget, templates/chat_drawer.php)
   ============================================ */
.shop-chat-drawer {
    position: fixed;
    bottom: 0;
    right: 30px;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.shop-chat-drawer.minimized .chat-body {
    display: none;
}

.chat-header {
    background: var(--primary-gradient);
    color: var(--text-inverse);
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.chat-header .toggle-icon {
    transition: transform 0.2s ease;
}

.shop-chat-drawer.minimized .toggle-icon {
    transform: rotate(180deg);
}

.chat-body {
    display: flex;
    flex-direction: column;
    background: var(--light-color);
}

.chat-rooms-list {
    max-height: 320px;
    overflow-y: auto;
}

.chat-footer {
    padding: 10px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
}

#drawer-unread-badge.chat-unread-badge {
    background: var(--danger-color);
    color: #fff;
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.72rem;
    margin-left: 6px;
}

@media (max-width: 480px) {
    .shop-chat-drawer {
        right: 12px;
        width: calc(100vw - 24px);
    }
}

/* ============================================
   CHECKOUT — only classes NOT already covered by style.css's own
   "CHECKOUT PAGE" section (which already uses var(--primary-color) etc.
   correctly). checkout.php's old inline <style> block duplicated most of
   that section with hardcoded hex; removed in favor of style.css's
   existing rules, plus these few genuinely-missing ones.
   ============================================ */
.logged-in-info {
    background: var(--primary-light);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.logged-in-info p {
    margin: 0.25rem 0;
}

.logout-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--danger-color);
    text-decoration: none;
}

.item-details h4 {
    margin: 0 0 0.25rem;
    font-size: 0.95rem;
}

.item-variant {
    font-size: 0.8rem;
    color: var(--gray-color);
    margin: 0.25rem 0;
}

.item-quantity {
    font-size: 0.8rem;
    color: var(--gray-color);
}

.item-price {
    font-weight: 600;
    color: var(--primary-color);
}

/* style.css's .order-items lacks sticky positioning - add it back */
.order-items {
    height: fit-content;
    position: sticky;
    top: 100px;
}

@media (max-width: 768px) {
    .order-items {
        position: static;
    }
}

/* ============================================
   RESPONSIVE — sidebar stacks above content, stays reachable (not hidden)
   ============================================ */
@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }

    .shop-sidebar {
        width: 100%;
        position: static;
    }
}
