:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --card-bg: #ffffff;
    --bg-color: #f3f4f6;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --radius-lg: 16px;
    --radius-md: 12px;
}

body {
    background-color: var(--bg-color);
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

.product-container {
    max-width: 1100px;
    margin: 30px auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* Sections */
.card-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
}

/* Image & Main Info */
.product-showcase {
    display: flex;
    gap: 24px;
}

.product-image-column {
    flex: 0 0 45%;
    max-width: 45%;
}

.main-image-wrapper {
    width: 100%;
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: #f8fafc;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
    display: block;
}

.product-info-header {
    flex: 1;
}

.product-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.seller-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    background: #f9fafb;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.seller-badge i {
    color: var(--primary-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.info-box {
    background: #f8fafc;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.info-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
}

/* Share Button */
.btn-share {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, background 0.2s;
    z-index: 10;
    color: #333;
    font-size: 16px;
}

.btn-share:hover {
    transform: scale(1.1);
    background: #fff;
    color: var(--primary-color);
}

/* Owner Actions */
.owner-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn {
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

/* Description */
.section-heading {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.description-text {
    font-size: 16px;
    color: #4b5563;
    line-height: 1.6;
}

/* Gallery */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
}

.gallery-img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.gallery-img:hover {
    transform: scale(1.05);
}

/* Contact Card (Sidebar) */
.contact-card {
    position: sticky;
    top: 20px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: 24px;
}

.contact-header {
    text-align: center;
    margin-bottom: 20px;
}

.seller-avatar {
    width: 64px;
    height: 64px;
    background: #e0e7ff;
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 12px;
}

.seller-name {
    font-weight: 700;
    font-size: 18px;
    margin: 0;
}

.seller-contact-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.contact-row {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #4b5563;
    font-size: 14px;
}

.contact-row i {
    color: var(--primary-color);
    width: 20px;
    text-align: center;
}

.w-100 {
    width: 100%;
}

/* Responsive */
@media (max-width: 900px) {
    .product-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .product-showcase {
        flex-direction: column;
        gap: 16px;
    }

    .product-image-column {
        flex: none;
        width: 100%;
        max-width: 100%;
    }

    .main-image-wrapper {
        flex: none;
        width: 100%;
        height: auto;
        min-height: 0;
        aspect-ratio: 4/3;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .main-image {
        max-height: 400px;
        object-fit: contain;
    }

    /* Remove left and right margin from all cards in mobile view */
    .card-section {
        margin-left: 0;
        margin-right: 0;
        padding: 16px;
        border-radius: 12px;
        border: 1px solid var(--border-color);
    }

    .card-section:first-of-type {
        padding: 0;
        overflow: hidden;
    }

    .product-info-header {
        padding: 0 16px 16px;
    }

    .product-image-column {
        flex: none;
        width: 100%;
        max-width: 100%;
        margin: 0;
    }

    .cart-action-box, .owner-actions {
        padding: 16px !important;
    }

    .checkout-actions {
        flex-wrap: wrap;
        gap: 10px !important;
    }

    .checkout-actions .btn {
        width: 100%;
        flex: none !important;
    }

    .product-container {
        padding: 0;
        margin-top: 10px;
        /* Reduced top margin */
    }

    /* Override boilerplate .contain to fix edge-to-edge */
    .contain {
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
}

/* Desktop Fix for Grid Layout */
@media (min-width: 992px) {
    .product-container {
        grid-column: 1 / -1 !important;
        /* Forces container to span all parent grid columns */
        width: 100% !important;
        max-width: 1200px;
        /* Cap width for aesthetics */
        margin: 20px auto;
    }

    .items-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
        /* Premium card size */
        gap: 24px;
    }
}

/* Circular Quantity Selector */
.circular-qty-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qty-btn-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
    padding: 0;
}

.qty-btn-circle:hover {
    background: #f8fafc;
    border-color: #3b82f6;
    color: #3b82f6;
    transform: scale(1.1);
}

.qty-btn-circle:active {
    transform: scale(0.95);
}

.qty-value-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    border: 2px solid white;
    position: relative;
    transition: background 0.2s;
}

@keyframes qty-pulse {
    0%   { transform: scale(1); box-shadow: 0 4px 10px rgba(59,130,246,0.3); }
    40%  { transform: scale(1.25); box-shadow: 0 0 0 8px rgba(59,130,246,0.15); }
    70%  { transform: scale(0.95); }
    100% { transform: scale(1); box-shadow: 0 4px 10px rgba(59,130,246,0.3); }
}

.qty-value-circle.qty-changed {
    animation: qty-pulse 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

/* --- Shop Profile Redesign --- */
.shop-profile-header {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.shop-profile-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #60a5fa 100%);
    z-index: 0;
}

.shop-profile-img-container {
    position: relative;
    z-index: 1;
    margin-top: 40px;
    /* Push down to overlap background */
}

.shop-profile-img {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.3s;
    background-color: #fff;
}

.shop-profile-img:hover {
    transform: scale(1.05);
}

.shop-details-container {
    z-index: 1;
    width: 100%;
    max-width: 800px;
}

.shop-name-large {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 5px;
}

.shop-meta-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.meta-badge {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 20px;
    background: #f3f4f6;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.shop-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    text-align: left;
    margin-top: 20px;
}

.info-card {
    background: #f8fafc;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s;
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-card-content {
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.5;
}

/* Image Modal */
.profile-img-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.profile-img-modal.show {
    display: flex;
    opacity: 1;
}

.profile-modal-content {
    max-width: 90%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s;
}

.profile-img-modal.show .profile-modal-content {
    transform: scale(1);
}

.profile-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 2001;
}

@media (min-width: 768px) {
    .shop-profile-header {
        flex-direction: row;
        align-items: flex-start;
        text-align: left;
        padding-top: 60px;
        /* Space for gradient top */
    }

    .shop-profile-img-container {
        margin-top: 0;
        margin-right: 30px;
        flex-shrink: 0;
    }

    .shop-profile-img {
        width: 160px;
        height: 160px;
        border-width: 5px;
    }

    .shop-meta-badges {
        justify-content: flex-start;
    }
}