/* 
 * Premium Marketplace Styles 
 * Design: Luxury Organic / Minimal
 */

:root {
    --primary-sage: #7D8C7D;
    --primary-sage-dark: #5A665A;
    --accent-beige: #F5F5F0;
    --bg-white: #FFFFFF;
    --bg-off-white: #FCFCFA;
    --text-charcoal: #2D2D2D;
    --text-muted: #8E8E8E;
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-full: 50px;
    --soft-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    --premium-shadow: 0 20px 50px rgba(125, 140, 125, 0.08);
    --transition-smooth: all 0.6s cubic-bezier(0.165, 0.84, 0.44, 1);
}

body {
    background-color: var(--bg-white);
    color: var(--text-charcoal);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Layout Containers */
.premium-container {
    max-width: 1536px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Hero Section - Lifestyle */
.hero-premium {
    position: relative;
    min-height: 450px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 0;
    background-color: #E5E7E1; /* Fallback Sage Beige */
    background-image: linear-gradient(rgba(0,0,0,0.2), rgba(0,0,0,0.2)), url('../images/hero_bg.png');
    background-size: cover;
    background-position: center;
    border-radius: 0 0 40px 40px;
    overflow: hidden;
    margin-bottom: 6rem;
    text-align: center;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0.1) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 800px;
}

.hero-tagline {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--primary-sage-dark);
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: 300;
    letter-spacing: -0.02em;
    margin-bottom: 2.5rem;
    color: #ffffff;
    line-height: 1.1;
    text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.btn-premium {
    display: inline-flex;
    align-items: center;
    padding: 1rem 3rem;
    background: #64bb3c;
    color: white;
    border-radius: var(--radius-full);
    font-weight: 500;
    transition: var(--transition-smooth);
    border: none;
    cursor: pointer;
}

.btn-premium:hover {
    background: var(--primary-sage);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

/* Marketplace Layout */
.marketplace-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 4rem;
    align-items: start;
}

/* Sidebar Filters */
.filter-sidebar {
    background: #FAFAFA;
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0,0,0,0.04);
    position: sticky;
    top: 2rem;
    box-shadow: var(--soft-shadow);
}

.filter-group {
    margin-bottom: 3rem;
}

.filter-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: block;
}

.filter-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-charcoal);
    transition: var(--transition-smooth);
}

.checkbox-item span {
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.brand-filter-logo {
    width: 34px;
    height: 34px;
    object-fit: contain;
    margin-right: 14px;
    opacity: 1;
    transition: var(--transition-smooth);
}

.checkbox-item.active .brand-filter-logo,
.checkbox-item:hover .brand-filter-logo {
    opacity: 1;
    transform: scale(1.1);
}

.checkbox-item:hover {
    color: var(--primary-sage);
}

.custom-checkbox {
    width: 20px;
    height: 20px;
    border: 1px solid #DEDEDE;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    background: white;
}

.checkbox-item.active .custom-checkbox {
    background: var(--primary-sage);
    border-color: var(--primary-sage);
}

.checkbox-item.active .custom-checkbox::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: white;
}

/* Product Cards Refresh */
.premium-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 3.5rem 2.5rem;
    padding-bottom: 5rem;
}

.product-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-smooth);
    border: 1px solid rgba(0,0,0,0.02);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--premium-shadow);
}

.image-wrapper {
    position: relative;
    aspect-ratio: 1/1;
    overflow: hidden;
    background: #F8F8F6;
}

.image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.product-card:hover .image-wrapper img {
    transform: scale(1.08);
}

.brand-badge-mini {
    position: absolute;
    bottom: 0.8rem;
    left: 0.8rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    padding: 0.3rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    z-index: 10;
    transition: var(--transition-smooth);
    border: 1px solid rgba(255,255,255,0.2);
}

.brand-badge-mini img {
    height: 22px;
    width: auto;
    object-fit: contain;
}

.product-card:hover .brand-badge-mini {
    transform: translateY(-2px);
    background: white;
}

.modal-brand-tag {
    display: inline-block;
    padding: 0.4rem 1.2rem;
    background: var(--accent-beige);
    color: var(--text-charcoal);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.category-badge {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(8px);
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-sage-dark);
}

.card-info {
    padding: 2rem;
}

.product-name {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-charcoal);
}

.price-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
}

.product-price {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-charcoal);
}

.add-to-cart-btn {
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius-full);
    background: var(--text-charcoal);
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.product-card:hover .add-to-cart-btn {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.12);
}

/* Animations & Interaction */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.8s forwards cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Adjustments */
@media (max-width: 1024px) {
    .marketplace-layout {
        grid-template-columns: 1fr;
    }
    .filter-sidebar {
        display: none !important;
    }
    .premium-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem; /* Increased gap for single column spacing */
    }
    .mobile-filter-trigger {
        display: flex !important;
        position: fixed;
        bottom: 2rem;
        left: 50%;
        transform: translateX(-50%); /* Center on mobile */
        z-index: 100;
        background: var(--text-charcoal);
        color: white;
        padding: 0.9rem 1.8rem;
        border-radius: var(--radius-full);
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
        font-weight: 600;
        font-size: 0.95rem;
        letter-spacing: 0.02em;
        border: none;
        align-items: center;
        gap: 0.8rem;
        transition: var(--transition-smooth);
    }
    
    .modal-grid {
        grid-template-columns: 1fr !important; /* Stack vertically */
    }
    
    .modal-image-pane {
        padding: 2rem !important;
        aspect-ratio: 1/1;
    }
    
    .modal-info-pane {
        padding: 2rem !important;
    }
    
    .modal-product-title {
        font-size: 1.5rem !important;
    }
}

/* Mobile Drawer Styling */
.mobile-filter-drawer {
    position: fixed;
    top: 0;
    right: -100%; /* Hidden by default */
    width: 100%;
    max-width: 400px;
    height: 100vh;
    background: white;
    z-index: 10000; /* Above everything */
    padding: 2.5rem;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 50px rgba(0,0,0,0.1);
}

.mobile-filter-drawer.active {
    right: 0;
}

.drawer-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F5F5F0;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-charcoal);
}

@media (min-width: 1025px) {
    .mobile-filter-trigger,
    .mobile-filter-drawer {
        display: none !important;
    }
}

/* More Dense Cards */
.product-name {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-charcoal);
    line-height: 1.2;
}

.product-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-sage-dark);
}

/* Premium Modals Design */
.premium-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(45, 45, 45, 0.4);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}

.premium-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.premium-modal-content {
    background: white;
    width: 100%;
    max-width: 480px; /* Reduced for a more compact focused look */
    max-height: 95vh; /* Increased to allow it to be taller */
    border-radius: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 40px 100px rgba(0,0,0,0.15);
    transform: translateY(10px) scale(0.98);
    transition: var(--transition-smooth);
    position: relative;
    border: 1px solid rgba(0,0,0,0.05);
}

.premium-modal-backdrop.active .premium-modal-content {
    transform: translateY(0) scale(1);
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 100%;
}

.modal-image-pane {
    background: #F8F8F6;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    position: relative;
    overflow: hidden;
}

.modal-image-pane img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.modal-image-pane img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 20px 40px rgba(0,0,0,0.05));
}

.modal-info-pane {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: white;
    overflow-y: auto;
}

.modal-brand-tag {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2rem;
    text-transform: uppercase;
    color: var(--primary-sage);
    margin-bottom: 1.5rem;
    display: block;
}

.modal-product-title {
    font-size: 1.8rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-charcoal);
}

.modal-product-desc {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.modal-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-charcoal);
    margin-bottom: 2rem;
}

.modal-close-btn {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-off-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--text-charcoal);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    z-index: 10;
}

.modal-close-btn:hover {
    background: var(--text-charcoal);
    color: white;
    transform: rotate(90deg);
}

@media (max-width: 768px) {
    .premium-modal-backdrop {
        padding: 1rem; /* More space for the modal on mobile */
    }
    .modal-grid {
        grid-template-columns: 1fr;
    }
    .modal-image-pane {
        padding: 1.5rem;
        height: 220px; /* Reduced to leave more space for text/actions */
    }
    .modal-info-pane {
        padding: 1.5rem 2rem;
    }
    .modal-product-title {
        font-size: 1.6rem;
    }
    .modal-brand-tag {
        margin-bottom: 0.8rem;
    }
    .modal-product-desc {
        margin-bottom: 1.5rem;
    }
}

/* Form Styles for Order Modal */
.premium-form-group {
    margin-bottom: 1.2rem;
}

/* Custom Order Modal Replication */
.custom-order-modal .premium-modal-content {
    max-width: 500px;
    padding: 2rem;
    border-radius: 20px;
    overflow-y: auto; /* Ensure scrollability */
}

.modal-title-bold {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2D3748;
    margin-bottom: 1.5rem;
}

.summary-box-green {
    background-color: #F0FFF4;
    border: 1px solid #C6F6D5;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    color: #38A169;
    font-weight: 500;
}

.custom-label {
    display: block;
    font-size: 0.8rem;
    color: #4A5568;
    margin-bottom: 0.5rem;
    margin-top: 1rem;
}

.custom-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2D3748;
    transition: all 0.2s;
}

.custom-input:focus {
    border-color: #38A169;
    background: white;
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.1);
}

.place-order-btn {
    width: 100%;
    background: #64bb3c;
    color: white;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 700;
    margin-top: 1.5rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(100, 187, 60, 0.2);
}

.place-order-btn:hover {
    background: #52a331;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 187, 60, 0.3);
}

.modal-trust-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    font-size: 0.75rem;
    color: #718096;
}

/* Modern Success Modal Redesign */
.modern-success-modal .premium-modal-content {
    max-width: 400px;
    padding: 3.5rem 2.5rem;
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.95);
}

.success-checkmark-svg {
    width: 80px;
    height: 80px;
    margin: 0 auto 2.5rem;
    display: block;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #7D8C7D;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke: #7D8C7D;
    stroke-width: 3;
    fill: none;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}

.success-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-charcoal);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s cubic-bezier(0.2, 1, 0.3, 1) 0.4s;
}

.success-message {
    color: #718096;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.6s cubic-bezier(0.2, 1, 0.3, 1) 0.6s;
}

.premium-modal-backdrop.active .success-title,
.premium-modal-backdrop.active .success-message {
    opacity: 1;
    transform: translateY(0);
}

.done-btn-premium {
    width: 100%;
    padding: 1rem;
    background: var(--text-charcoal);
    color: white;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.done-btn-premium:hover {
    background: #000;
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

/* Floating Cart Button */
.cart-floating-trigger {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 65px;
    height: 65px;
    background: #64bb3c;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 15px 35px rgba(100, 187, 60, 0.3);
    cursor: pointer;
    z-index: 999;
    transition: var(--transition-smooth);
    border: none;
}

.cart-floating-trigger:hover {
    transform: scale(1.1) rotate(-5deg);
}

.cart-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #000;
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Cart Toast Notification */
.cart-toast {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 1000;
    transform: translateX(-120%);
    transition: var(--transition-smooth);
    border: 1px solid rgba(0,0,0,0.05);
}

.cart-toast.active {
    transform: translateX(0);
}

.cart-toast .icon {
    width: 35px;
    height: 35px;
    background: #F0FFF4;
    color: #64bb3c;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cart Sidebar / Modal Fixes */
.cart-items-container {
    max-height: 70vh; /* Increased to allow more items to show before scrolling */
    overflow-y: auto;
    padding-right: 10px;
}

.cart-items-container::-webkit-scrollbar {
    width: 4px;
}

.cart-items-container::-webkit-scrollbar-thumb {
    background: #E2E8F0;
    border-radius: 10px;
}

@media (max-width: 1024px) {
    .cart-floating-trigger {
        bottom: 2rem; 
        right: auto;
        left: 2rem;
        z-index: 999;
    }
}
