/* Buy/sell product detail page — loaded in <head> via critical_css.php */
/* Modern Product Page Design - Inspired by Premium E-commerce */
:root {
    --product-primary: #000;
    --product-secondary: #666;
    --product-border: #e5e7eb;
    --product-bg: #ffffff;
    --product-hover: #f9fafb;
    --product-accent: #007bff;
    --product-success: #ff3c3c;
    --product-success-dark: #d32f2f;
    --product-success-hover: #e03131;
}

.product-page-wrapper {
    background: var(--product-bg);
    min-height: calc(100vh - 200px);
}

.product-breadcrumb {
    padding: 1.5rem 0 1rem;
    font-size: 0.875rem;
    color: var(--product-secondary);
    border-bottom: 1px solid var(--product-border);
    margin-bottom: 2rem;
}

.product-breadcrumb a {
    color: var(--product-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

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

.product-breadcrumb .separator {
    margin: 0 0.5rem;
    color: var(--product-border);
}

/* Image Gallery Section */
.product-gallery-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
}

.product-thumbnails {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100px;
    flex-shrink: 0;
    max-height: calc(100px * 8 + 0.75rem * 7); /* Exactly 8 thumbnails visible */
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
    user-select: none; /* Prevent text selection during scroll attempts */
}

.product-thumbnails::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.product-thumbnails-wrapper {
    position: relative;
    width: 100px;
    padding-top: 24px;
    padding-bottom: 24px;
}

.product-thumbnail-nav-btn {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--product-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: var(--product-primary);
}

.product-thumbnail-nav-btn:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateX(-50%) scale(1.1);
}

.product-thumbnail-nav-btn:active {
    transform: translateX(-50%) scale(0.95);
}

.product-thumbnail-nav-left {
    top: 0;
}

.product-thumbnail-nav-right {
    bottom: 0;
}

.product-thumbnail-nav-btn i {
    font-size: 0.75rem;
}

.product-thumbnail-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Hide scrollbar in mobile view by default */
@media (max-width: 991px) {
    .product-thumbnails-scroll-arrow {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
    
    .product-thumbnail-nav-btn {
        display: none !important;
    }
    
    .product-thumbnails {
        max-height: none !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }
}

.product-thumbnail {
    width: 100px;
    height: 100px;
    min-width: 100px;
    min-height: 100px;
    max-width: 100px;
    max-height: 100px;
    aspect-ratio: 1 / 1;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--product-hover);
    position: relative;
    flex-shrink: 0;
    box-sizing: border-box;
}

.product-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.2s;
}

.product-thumbnail:hover {
    border-color: var(--product-primary);
    transform: scale(1.05);
}

.product-thumbnail.active {
    border-color: var(--product-primary);
}

.product-thumbnail.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid var(--product-primary);
    border-radius: 6px;
}

.product-main-image-container {
    flex: 1;
    position: relative;
    background: var(--product-bg);
    border-radius: 8px;
    overflow: hidden;
    min-height: 500px;
    max-height: 600px;
    height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
    cursor: grab;
    user-select: none;
}

.product-main-image-container:active {
    cursor: grabbing;
}

.swipe-indicator {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
    animation: fadeInOut 3s ease-in-out infinite;
    pointer-events: none;
}

.swipe-indicator i {
    animation: bounceUpDown 1.5s ease-in-out infinite;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

@keyframes bounceUpDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.product-main-image {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1), transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1;
}

.product-main-image.active {
    opacity: 1;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 2;
}

.product-main-image.swipe-up {
    animation: swipeUpOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.product-main-image.swipe-down {
    animation: swipeDownOut 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.product-main-image.swipe-up-in {
    animation: swipeUpIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.product-main-image.swipe-down-in {
    animation: swipeDownIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes swipeUpOut {
    0% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, -100%); }
}

@keyframes swipeDownOut {
    0% { opacity: 1; transform: translate(-50%, -50%); }
    100% { opacity: 0; transform: translate(-50%, 0%); }
}

@keyframes swipeUpIn {
    0% { opacity: 0; transform: translate(-50%, 0%); }
    100% { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes swipeDownIn {
    0% { opacity: 0; transform: translate(-50%, -100%); }
    100% { opacity: 1; transform: translate(-50%, -50%); }
}

.product-image-placeholder {
    width: 100%;
    height: 500px;
    background: var(--product-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--product-secondary);
}

.product-image-placeholder i {
    font-size: 4rem;
}

/* Product Details Section */
.product-details {
    padding-left: 2rem;
}

.product-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--product-primary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.product-price {
    font-size: 2rem;
    font-weight: 700;
    color: #16a34a;
    margin-bottom: 0.5rem;
}

.product-badges {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.product-badge {
    padding: 0.375rem 0.75rem;
    background: var(--product-hover);
    border-radius: 4px;
    font-size: 0.875rem;
    color: var(--product-secondary);
    border: 1px solid var(--product-border);
}

.product-description-wrapper {
    margin-bottom: 2rem;
    position: relative;
}

.product-description {
    color: var(--product-secondary);
    line-height: 1.7;
    font-size: 0.9375rem;
}

.product-description-toggle {
    display: none;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--product-border);
    border-radius: 6px;
    color: var(--product-primary);
    font-size: 0.875rem;
    cursor: pointer;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.product-description-toggle:hover {
    background: var(--product-hover);
    border-color: var(--product-primary);
}

.product-description-toggle i {
    transition: transform 0.2s;
}

.product-description-toggle.expanded i {
    transform: rotate(180deg);
}

.product-details-section {
    margin-bottom: 2rem;
}

.product-details-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--product-primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-details-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.product-details-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--product-border);
    display: flex;
    justify-content: space-between;
}

.product-details-list li:last-child {
    border-bottom: none;
}

.product-owner {
    padding: 1.5rem;
    background: var(--product-hover);
    border-radius: 8px;
    margin-bottom: 2rem;
}

.product-owner-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--product-primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.product-owner-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.product-owner-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--product-border);
    transition: transform 0.2s;
}

.product-owner-avatar:hover {
    transform: scale(1.05);
}

.product-owner-details {
    flex: 1;
}

.product-owner-name {
    font-weight: 600;
    color: var(--product-primary);
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
    transition: color 0.2s;
}

.product-owner-name:hover {
    color: var(--product-accent);
}

.product-actions {
    margin-top: 2rem;
}

.product-action-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.product-action-btn {
    flex: 1;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.product-action-btn-primary:hover:not(:disabled) {
    background: #333;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.product-action-btn-secondary {
    background: var(--product-success);
    color: white;
}

.product-action-btn-secondary:hover:not(:disabled) {
    background: var(--product-success-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255,60,60,0.2);
}

.product-back-btn {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid var(--product-border);
    color: var(--product-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.product-back-btn:hover {
    background: var(--product-hover);
    border-color: var(--product-primary);
    color: var(--product-primary);
}

.product-expandable {
    border-top: 1px solid var(--product-border);
    padding: 1rem 0;
    cursor: pointer;
    user-select: none;
}

.product-expandable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--product-primary);
}

.product-expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    margin-top: 0.75rem;
    color: var(--product-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
}

.product-expandable.active .product-expandable-content {
    max-height: 500px;
}

.product-expandable-icon {
    transition: transform 0.3s;
}

.product-expandable.active .product-expandable-icon {
    transform: rotate(180deg);
}

@media (max-width: 991px) {
    .product-gallery-container {
        display: flex !important;
        flex-direction: column !important;
    }
    
    .product-thumbnails-wrapper {
        position: relative !important;
        width: 100% !important;
        order: 1 !important;
    }
    
    .product-thumbnails {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 0.5rem 1rem !important;
        padding-bottom: 0.75rem !important;
        min-height: 100px !important;
        max-height: 100px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        gap: 0.75rem !important;
        flex-wrap: nowrap !important;
        max-width: 100% !important;
        margin: 0 !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }
    
    .product-thumbnails::-webkit-scrollbar {
        display: none !important;
    }
    
    /* Force all thumbnails to be exactly the same size */
    .product-thumbnails .product-thumbnail,
    .product-thumbnails .product-thumbnail.active,
    .product-thumbnails .product-thumbnail:hover {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        min-height: 100px !important;
        max-width: 100px !important;
        max-height: 100px !important;
        aspect-ratio: 1 / 1 !important;
        box-sizing: border-box !important;
    }
    
    .product-thumbnail {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        min-height: 100px !important;
        max-width: 100px !important;
        max-height: 100px !important;
        aspect-ratio: 1 / 1 !important;
        box-sizing: border-box !important;
        border: 2px solid transparent !important;
    }
    
    .product-thumbnail img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        aspect-ratio: 1 / 1 !important;
    }
    
    .product-details {
        padding-left: 0;
        margin-top: 2rem;
    }
    
    .product-main-image-container {
        order: 2 !important;
        width: 100% !important;
        min-height: 400px;
        max-height: 500px;
        height: 500px;
    }
}

@media (max-width: 767px) {
    .product-thumbnails-wrapper {
        position: relative !important;
        width: 100% !important;
        order: 1 !important;
    }
    
    .product-thumbnails {
        display: flex !important;
        flex-direction: row !important;
        width: 100% !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 0.5rem 1rem !important;
        padding-bottom: 0.75rem !important;
        min-height: 100px !important;
        max-height: 100px !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
        gap: 0.75rem !important;
        flex-wrap: nowrap !important;
        max-width: 100% !important;
        margin: 0 !important;
        align-items: center !important;
        box-sizing: border-box !important;
    }
    
    .product-thumbnails::-webkit-scrollbar {
        display: none !important;
    }
    
    /* Limit description to 2 lines in mobile */
    .product-description {
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        margin-bottom: 0 !important;
    }
    
    .product-description.expanded {
        display: block !important;
        -webkit-line-clamp: unset !important;
        -webkit-box-orient: unset !important;
        overflow: visible !important;
    }
    
    .product-description-toggle {
        display: flex !important;
    }
    
    .product-thumbnail {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        width: 100px !important;
        height: 100px !important;
        min-width: 100px !important;
        min-height: 100px !important;
        max-width: 100px !important;
        max-height: 100px !important;
        aspect-ratio: 1 / 1 !important;
        box-sizing: border-box !important;
        border: 2px solid transparent !important;
    }
    
    .product-thumbnail img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        aspect-ratio: 1 / 1 !important;
    }
    
    .product-title {
        font-size: 1.5rem;
    }
    
    .product-price {
        font-size: 1.75rem;
    }
    
    .product-action-buttons {
        flex-direction: column;
    }
    
    .product-main-image-container {
        order: 2 !important;
        width: 100% !important;
        min-height: 300px;
        max-height: 400px;
        height: 400px;
    }
}

/* Suggested Products Section */
.suggested-products-section {
    background: var(--product-bg);
}

.suggested-products-carousel-wrapper {
    position: relative;
    padding: 0 50px;
}

.suggested-products-carousel {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 10px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

.suggested-products-carousel.suggested-auto-scrolling {
    scroll-behavior: auto;
}

.suggested-products-carousel::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.suggested-product-card {
    position: relative;
    flex: 0 0 280px;
    min-width: 280px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.suggested-product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.suggested-product-card .sponsored-badge-top {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #dc3545;
    color: white;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 600;
    z-index: 1000;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.suggested-card-image-wrapper {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
    position: relative;
}

.suggested-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.suggested-card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    color: #999;
}

.suggested-card-image-placeholder i {
    font-size: 3rem;
}

.suggested-card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.suggested-card-provider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.suggested-provider-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.suggested-provider-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #333;
}

.suggested-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #000;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.suggested-card-description {
    font-size: 0.875rem;
    color: #666;
    margin: 0 0 0.75rem 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.suggested-card-price {
    font-size: 1rem;
    font-weight: 700;
    color: #16a34a;
    margin-bottom: 1rem;
}

.suggested-card-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.suggested-view-details-btn {
    flex: 1;
    background: linear-gradient(to bottom, #ff5252, #ff3c3c);
    color: #fff;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(255, 60, 60, 0.2);
}

.suggested-view-details-btn:hover {
    background: linear-gradient(to bottom, #ff6b6b, #e03131);
    box-shadow: 0 4px 8px rgba(255, 60, 60, 0.3);
    transform: translateY(-1px);
}

.suggested-cart-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    background: #fff;
    border: 1px solid #ff3c3c;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #ff3c3c;
    flex-shrink: 0;
}

.suggested-cart-btn:hover:not(:disabled) {
    background: #fff5f5;
    border-color: #ff3c3c;
    color: #ff3c3c;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(255, 60, 60, 0.2);
}

.suggested-cart-btn i {
    font-size: 1.1rem;
    color: #ff3c3c;
}

.suggested-cart-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border-color: #ddd;
}

.suggested-cart-btn:disabled i {
    color: #999;
}

.suggested-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: #333;
}

.suggested-nav-btn:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-50%) scale(1.05);
}

.suggested-nav-left {
    left: 0;
}

.suggested-nav-right {
    right: 0;
}

.suggested-nav-btn i {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .suggested-products-carousel-wrapper {
        padding: 0 40px;
    }
    
    .suggested-nav-btn {
        width: 36px;
        height: 36px;
    }
    
    .suggested-nav-btn i {
        font-size: 0.875rem;
    }
}
