/* ========================================================================
   BabsPay Multi-Vendor Marketplace Stylesheet
   ======================================================================== */

/* Storefront Ribbon & Header */
.market-header {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
    border-bottom: 1px solid var(--border-glass);
    padding: 30px 20px;
    text-align: center;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.market-header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 179, 0, 0.05) 0%, transparent 60%);
    pointer-events: none;
}

.market-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.market-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Category Ribbon */
.category-ribbon {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 10px 4px 20px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.category-ribbon::-webkit-scrollbar {
    display: none;
}

.category-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-pill);
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.88rem;
    white-space: nowrap;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.category-chip:hover, .category-chip.active {
    background: var(--primary);
    color: #121212 !important;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.category-chip i {
    font-size: 1rem;
}

/* Product Search Bar */
.search-container {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-soft);
}

.search-input-group {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input-group i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-size: 0.95rem;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-select {
    padding: 12px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-light);
    font-weight: 600;
    min-width: 150px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

.search-btn {
    padding: 12px 24px;
    background: var(--primary);
    color: #121212;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.search-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

/* Product Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 16px;
    }
}

/* Product Card */
.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.product-card:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 179, 0, 0.3);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
}

.product-image-container {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: #f8fafc;
}

[data-theme="dark"] .product-image-container {
    background: #151515;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.product-card:hover .product-image {
    transform: scale(1.08);
}

.badge-condition {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(30, 41, 59, 0.85);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-discount {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--danger);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.product-details {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-brand {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}

.product-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 2.8em;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.product-rating i {
    color: #FFC107;
}

.product-price-row {
    margin-top: auto;
    margin-bottom: 12px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

.product-price {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary);
}

.product-original-price {
    font-size: 0.85rem;
    text-decoration: line-through;
    color: var(--text-muted);
}

.product-merchant-row {
    font-size: 0.72rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-glass);
    padding-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.product-merchant-row a {
    color: var(--text-muted);
    font-weight: 600;
}

.product-merchant-row a:hover {
    color: var(--primary);
}

.btn-card-buy {
    width: 100%;
    padding: 8px;
    background: var(--primary-light);
    color: var(--primary) !important;
    border: 1px solid rgba(255, 179, 0, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    display: block;
    margin-top: 10px;
}

.btn-card-buy:hover {
    background: var(--primary);
    color: #121212 !important;
    box-shadow: var(--shadow-glow);
}

/* Product Detail Layout */
.product-detail-container {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 40px;
    margin-bottom: 48px;
}

@media (max-width: 820px) {
    .product-detail-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }
}

.product-gallery {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gallery-main {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    background: #f8fafc;
}

[data-theme="dark"] .gallery-main {
    background: #151515;
}

.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-thumbs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.gallery-thumb {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    background: #f8fafc;
    transition: all 0.3s;
}

[data-theme="dark"] .gallery-thumb {
    background: #151515;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-thumb.active {
    border-color: var(--primary);
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    font-size: 0.88rem;
}

.spec-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-glass);
}

.spec-table td:first-child {
    font-weight: 700;
    color: var(--text-muted);
    width: 35%;
}

.spec-table td:last-child {
    color: var(--text-light);
}

/* Installment Plan Layout */
.installment-builder {
    background: rgba(255, 179, 0, 0.05);
    border: 1px dashed var(--primary);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.installment-timeline {
    position: relative;
    padding-left: 24px;
    margin-top: 12px;
}

.installment-timeline::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: var(--border-glass);
}

.timeline-step {
    position: relative;
    padding-bottom: 14px;
}

.timeline-step::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.timeline-step.active::before {
    background: var(--primary);
    box-shadow: 0 0 8px var(--primary);
}

.timeline-step:last-child {
    padding-bottom: 0;
}

.timeline-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

/* Cart & Checkout Panel */
.cart-table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th, .cart-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-glass);
}

.cart-table th {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
}

.cart-item-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cart-item-img {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: #f8fafc;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--bg-dark);
    border: 1px solid var(--border-glass);
    color: var(--text-light);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.qty-btn:hover {
    background: var(--primary);
    color: #121212;
    border-color: var(--primary);
}

.qty-val {
    font-weight: 700;
    font-size: 0.95rem;
    width: 24px;
    text-align: center;
}

.billing-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.billing-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 0.92rem;
}

.billing-row.total {
    border-top: 1px solid var(--border-glass);
    padding-top: 14px;
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary);
}

/* Payment Selector Cards */
.payment-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 12px;
    margin-bottom: 20px;
}

.payment-card {
    background: var(--bg-card);
    border: 2px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 18px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.payment-card:hover {
    border-color: rgba(255, 179, 0, 0.4);
}

.payment-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.payment-card i {
    font-size: 1.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.payment-card.active i {
    color: var(--primary);
}

.payment-card span {
    font-weight: 700;
    font-size: 0.9rem;
    display: block;
}

/* Merchant Store Header */
.store-header {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95)), var(--store-banner-url, none);
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    padding: 40px;
    display: flex;
    align-items: center;
    gap: 30px;
    margin-bottom: 30px;
    position: relative;
}

@media (max-width: 680px) {
    .store-header {
        flex-direction: column;
        text-align: center;
        padding: 30px 20px;
    }
}

.store-logo {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-md);
    background: #fff;
    padding: 8px;
    border: 2px solid var(--primary);
    object-fit: contain;
    box-shadow: var(--shadow-glow);
}

.store-info h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.store-info p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-bottom: 12px;
    max-width: 600px;
}

.store-socials {
    display: flex;
    gap: 12px;
}

.store-socials a {
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color 0.3s;
}

.store-socials a:hover {
    color: var(--primary);
}

/* Reviews block */
.review-item {
    border-bottom: 1px solid var(--border-glass);
    padding: 16px 0;
}

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

.review-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.88rem;
}

.review-author {
    font-weight: 700;
    color: var(--text-light);
}

.review-date {
    color: var(--text-muted);
}

.review-comment {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 8px;
}

.review-reply {
    background: var(--bg-dark);
    border-left: 3px solid var(--primary);
    padding: 10px 14px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.85rem;
    margin-left: 16px;
    margin-top: 8px;
}

.review-reply-author {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

/* Dashboard Widget Stats */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s;
}

.stat-widget:hover {
    transform: translateY(-4px);
}

.stat-widget-info h5 {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.stat-widget-info h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-light);
}

.stat-widget-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    background: var(--primary-light);
    color: var(--primary);
}

/* Order timeline */
.order-tracking-timeline {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-top: 30px;
    margin-bottom: 30px;
}

.order-tracking-timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    right: 20px;
    top: 15px;
    height: 3px;
    background: var(--border-glass);
    z-index: 1;
}

.timeline-checkpoint {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    width: 80px;
}

.checkpoint-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-dark);
    border: 3px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: all 0.3s;
}

.checkpoint-label {
    margin-top: 8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    color: var(--text-muted);
    text-transform: uppercase;
}

.timeline-checkpoint.active .checkpoint-circle {
    background: var(--primary);
    border-color: var(--primary);
    color: #121212;
    box-shadow: 0 0 10px var(--primary-light);
}

.timeline-checkpoint.active .checkpoint-label {
    color: var(--primary);
}

.timeline-checkpoint.completed .checkpoint-circle {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.timeline-checkpoint.completed .checkpoint-label {
    color: var(--success);
}

@media (max-width: 600px) {
    .order-tracking-timeline {
        flex-direction: column;
        gap: 20px;
        padding-left: 20px;
    }
    .order-tracking-timeline::before {
        left: 24px;
        top: 10px;
        bottom: 10px;
        width: 3px;
        height: auto;
    }
    .timeline-checkpoint {
        flex-direction: row;
        align-items: center;
        gap: 16px;
        width: auto;
    }
    .checkpoint-label {
        margin-top: 0;
        text-align: left;
    }
}

/* Floating Market Cart Widget */
.floating-market-cart {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 899;
    display: none;
    align-items: center;
    animation: bounceInCart 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes bounceInCart {
    from { transform: scale(0.8) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.floating-market-cart-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #FFB300 0%, #F59E0B 100%);
    color: #0f172a !important;
    text-decoration: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-weight: 800;
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.45);
    transition: all 0.25s ease;
    border: 1px solid rgba(255, 255, 255, 0.25);
    font-size: 0.92rem;
}

.floating-market-cart-btn:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 14px 30px rgba(245, 158, 11, 0.6);
    color: #0f172a !important;
}

.floating-market-cart-btn .cart-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.floating-market-cart-btn .cart-badge {
    position: absolute;
    top: -8px;
    right: -10px;
    background: #ef4444;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    line-height: 1;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.floating-market-cart-btn .cart-checkout-label {
    background: #0f172a;
    color: #FFB300;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.78rem;
    margin-left: 4px;
    font-weight: 700;
}
