/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mobile-close {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-weight: 500;
}

.nav-item:hover, .nav-item.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    position: relative;
    background: var(--bg-base);
}

.top-header {
    height: 75px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.85); /* Light glass */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    box-sizing: border-box;
}

.menu-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.search-bar {
    position: relative;
}

.search-bar input {
    min-width: 400px;
    border-radius: var(--radius-pill);
    padding: 12px 15px; /* using the form standard */
    background: var(--bg-surface-elevated);
    border: none;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.cart-trigger {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    position: relative;
    cursor: pointer;
}

.cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: var(--danger);
    color: white;
    font-size: 0.65rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
}

.user-profile img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--border);
}

/* Content Area */
.content-wrapper {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.hero-section {
    background: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.95)), url('https://images.unsplash.com/photo-1607083206869-4c7672e72a8a?q=80&w=2070&auto=format&fit=crop') center/cover;
    border-radius: var(--radius-lg);
    padding: 4rem 3rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.hero-content h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1.1;
    color: var(--text-primary);
}

.hero-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Filters */
.catalog-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 100%;
}

.pill-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    max-width: 100%;
}

.pill {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.pill:hover, .pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.product-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-md);
}

.product-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background: var(--bg-surface-elevated); /* light grey background for missing images */
}

.product-info {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.product-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.product-sku {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-heading);
    margin-bottom: 1rem;
}

.product-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.price {
    font-size: 1.25rem;
    font-weight: bold;
    font-family: var(--font-heading);
    color: var(--text-primary);
}

.btn-add {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border);
    color: var(--primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.btn-add:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Cart Drawer */
.cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.2); /* lighter overlay */
    backdrop-filter: blur(2px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: var(--bg-surface);
    border-left: 1px solid var(--border);
    z-index: 101;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
}

.cart-active .cart-drawer-overlay {
    opacity: 1;
    pointer-events: all;
}

.cart-active .cart-drawer {
    right: 0;
}

.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.close-cart {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

.empty-cart-state {
    color: var(--text-muted);
    text-align: center;
    margin-top: 2rem;
}

.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg-surface-elevated);
}

.cart-summary {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
}

/* Responsiveness */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        left: -260px;
    }
    .sidebar-open .sidebar {
        left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .mobile-close {
        display: block;
    }
}

@media (max-width: 600px) {
    .hero-content h1 {
        font-size: 2rem;
    }
    .cart-drawer {
        width: 100%;
        right: -100%;
    }
    .search-bar {
        display: none;
    }
}

.highlight-cart-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--primary);
    color: white;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.highlight-cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(99, 102, 241, 0.4);
    background: #4f46e5;
}

.cart-trigger-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.cart-label {
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.cart-total-header {
    font-size: 1.1rem;
    font-family: var(--font-heading);
    line-height: 1;
}

.cart-icon-wrapper {
    position: relative;
    background: rgba(255,255,255,0.2);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.highlight-cart-btn .cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: var(--radius-pill);
    border: 2px solid var(--primary);
}

body.cart-active #topCartBtn { display: none !important; }
body.checkout-active #topCartBtn { display: none !important; }
