/* File: css/components/shop.css */

/*
 * ============================================
 *  SHOP PAGE & CART STYLES
 * ============================================
 *
 * Contains styles for:
 * 1. Product cards (price, badges, add-to-cart button)
 * 2. Cart drawer (slide-out panel)
 * 3. Cart items (row layout, quantity controls)
 * 4. Empty cart state
 * 5. Checkout section
 */


/* ==========================================
   1. PRODUCT CARDS
   ========================================== */

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Accent line */
.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-base);
    z-index: 2;
}

.product-card:hover::before {
    transform: scaleX(1);
}

/* ---- Image Area ---- */
.product-card__image-wrapper {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.product-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.product-card:hover .product-card__image {
    transform: scale(1.05);
}

.product-card__image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    background: var(--bg-tertiary);
    transition: transform var(--transition-slow);
}

.product-card:hover .product-card__image-placeholder {
    transform: scale(1.05);
}

/* Category badge */
.product-card__badge {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    background: var(--accent-primary);
    color: var(--text-on-accent);
    font-size: var(--fs-xs);
    font-weight: 600;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    z-index: 2;
}

/* Sale badge */
.product-card__sale-badge {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    padding: var(--space-xs) var(--space-sm);
    background: #ef4444;
    color: #ffffff;
    font-size: var(--fs-xs);
    font-weight: 700;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
    z-index: 2;
}

/* ---- Card Body ---- */
.product-card__body {
    padding: var(--space-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card__title {
    font-size: var(--fs-md);
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.product-card__description {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-md);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Price row */
.product-card__price-row {
    display: flex;
    align-items: baseline;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.product-card__price {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--text-heading);
    font-family: var(--font-mono);
}

.product-card__price-original {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    text-decoration: line-through;
    font-family: var(--font-mono);
}

/* Tags */
.product-card__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}

.product-card__tag {
    padding: 2px 8px;
    background: rgba(100, 255, 218, 0.08);
    border: 1px solid rgba(100, 255, 218, 0.15);
    color: var(--accent-primary);
    font-size: 0.65rem;
    font-family: var(--font-mono);
    border-radius: var(--radius-sm);
}

[data-theme="light"] .product-card__tag {
    background: rgba(0, 102, 204, 0.06);
    border-color: rgba(0, 102, 204, 0.12);
}

/* Add to cart button */
.product-card__add-btn {
    width: 100%;
    padding: 0.75rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    font-family: var(--font-primary);
    color: var(--accent-primary);
    background: rgba(100, 255, 218, 0.08);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.product-card__add-btn:hover {
    background: var(--accent-primary);
    color: var(--text-on-accent);
    border-color: var(--accent-primary);
}

.product-card__add-btn.added {
    background: #22c55e;
    color: #ffffff;
    border-color: #22c55e;
    pointer-events: none;
}

[data-theme="light"] .product-card__add-btn {
    background: rgba(0, 102, 204, 0.06);
    border-color: rgba(0, 102, 204, 0.15);
}

[data-theme="light"] .product-card__add-btn:hover {
    background: var(--accent-primary);
    color: var(--text-on-accent);
}


/* ==========================================
   2. CART DRAWER
   ==========================================
   Slides out from the right side of the screen.
   Contains cart items, subtotal, and checkout.
*/

.cart-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

.cart-drawer {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    transition: right var(--transition-slow);
    box-shadow: var(--shadow-xl);
}

.cart-drawer.active {
    right: 0;
}

/* Cart header */
.cart-drawer__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.cart-drawer__title {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-heading);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.cart-drawer__count {
    font-size: var(--fs-xs);
    font-family: var(--font-mono);
    color: var(--text-on-accent);
    background: var(--accent-primary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.cart-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    cursor: pointer;
    background: none;
    border: none;
}

.cart-drawer__close:hover {
    color: var(--accent-primary);
    background: var(--bg-tertiary);
}

/* Cart items list */
.cart-drawer__items {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.cart-drawer__items::-webkit-scrollbar {
    width: 4px;
}

.cart-drawer__items::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
}

/* Individual cart item */
.cart-item {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    animation: slideInUp 0.3s ease;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item__image {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    overflow: hidden;
}

.cart-item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-item__info {
    flex: 1;
    min-width: 0;
}

.cart-item__name {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item__price {
    font-size: var(--fs-sm);
    font-family: var(--font-mono);
    color: var(--accent-primary);
    font-weight: 600;
}

/* Quantity controls */
.cart-item__controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-sm);
}

.cart-item__qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    font-size: var(--fs-sm);
    font-weight: 700;
    transition: all var(--transition-fast);
}

.cart-item__qty-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.cart-item__qty {
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--text-heading);
    min-width: 20px;
    text-align: center;
    font-family: var(--font-mono);
}

/* Remove button */
.cart-item__remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    border: none;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    align-self: flex-start;
}

.cart-item__remove:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Cart footer (subtotal + checkout) */
.cart-drawer__footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.cart-drawer__subtotal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.cart-drawer__subtotal-label {
    font-size: var(--fs-base);
    font-weight: 600;
    color: var(--text-heading);
}

.cart-drawer__subtotal-value {
    font-size: var(--fs-xl);
    font-weight: 800;
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.cart-drawer__checkout {
    width: 100%;
    margin-bottom: var(--space-sm);
}

.cart-drawer__continue {
    width: 100%;
    text-align: center;
    display: block;
}

/* Empty cart state */
.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-3xl) var(--space-xl);
    height: 100%;
}

.cart-empty__icon {
    font-size: 4rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.cart-empty__title {
    font-size: var(--fs-lg);
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: var(--space-sm);
}

.cart-empty__text {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}


/* ==========================================
   3. PRODUCTS GRID
   ========================================== */

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

@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
}


/* ==========================================
   RESPONSIVE CART DRAWER
   ========================================== */

@media (max-width: 480px) {
    .cart-drawer {
        width: 100%;
        max-width: 100vw;
        right: -100%;
    }
}