/* Exhibition Products Page Styles */

/* Hero Section */
.products-hero {
    position: relative;
    min-height: 60vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    overflow: hidden;
}

.products-hero .hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('/cms/images/products-bg.jpg');
    background-size: cover;
    background-position: center;
    opacity: 0.3;
}

.products-hero .hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.8) 0%, rgba(245, 87, 108, 0.8) 100%);
}

.products-hero .hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 20px;
}

.products-hero .hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.products-hero .hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.2;
}

.products-hero .hero-subtitle {
    font-size: 1.2rem;
    font-weight: 400;
    opacity: 0.9;
    line-height: 1.6;
    max-width: 600px;
    margin: 0 auto;
}

/* Section Styles */
.products-main {
    padding-top: 0;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.section-title i {
    color: #f093fb;
    font-size: 2rem;
}

.section-subtitle {
    font-size: 1.1rem;
    color: #4a5568;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Products Grid Section */
.products-grid-section {
    padding: 80px 0;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    height: auto;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

/* Product Gallery - Optimized Image Display with Horizontal Expansion */
.product-gallery {
    position: relative;
    height: 280px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-main {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.main-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background: white;
    
    /* Ensure horizontal expansion while maintaining aspect ratio */
    min-width: 0;
    flex-shrink: 0;
}

/* For landscape images, prioritize width expansion */
.main-image[style*="aspect-ratio"] {
    width: 100%;
    height: auto;
}

/* For very wide images, ensure they don't exceed container */
.main-image {
    max-width: calc(100% - 40px);
    max-height: calc(100% - 40px);
}

.product-card:hover .main-image {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Fallback for missing images */
.main-image[src*="default-product.jpg"],
.main-image[src=""],
.main-image:not([src]) {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.main-image[src*="default-product.jpg"]::before,
.main-image[src=""]::before,
.main-image:not([src])::before {
    content: '\f1b2';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 3rem;
    color: white;
}

.gallery-thumbnails {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.thumbnail-item {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.thumbnail-item:hover {
    transform: scale(1.1);
}

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

/* Image Loading States and Error Handling */
.main-image {
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.main-image.loaded {
    opacity: 1;
}

/* Image Error Handling */
.main-image.error {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}

.main-image.error::before {
    content: '\f1b2';
}

/* Enhanced Image Display for Different Aspect Ratios */
.gallery-main::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(240, 147, 251, 0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.main-image {
    position: relative;
    z-index: 2;
}

/* Responsive Image Sizing for Better Horizontal Fill */
@media (min-width: 769px) {
    .main-image {
        /* On larger screens, prioritize horizontal expansion */
        width: 100%;
        height: auto;
        min-height: 180px;
    }
    
    /* For very tall images, limit height and expand width */
    .main-image[style*="height"] {
        max-height: 240px;
        width: auto;
        max-width: 100%;
    }
}

/* Image Container Improvements */
.gallery-main {
    /* Ensure proper spacing while maximizing image area */
    padding: 20px 25px;
}

/* Better handling for different image orientations */
.main-image {
    /* Smart object-fit for better space utilization */
    object-fit: contain;
    object-position: center;
    
    /* Ensure images expand to fill available space appropriately */
    min-width: 200px;
    min-height: 120px;
}

/* Product Info */
.product-info {
    padding: 30px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 12px;
    line-height: 1.3;
}

.product-description {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 25px;
    font-size: 1rem;
    flex: 1;
}

/* Supplier Info */
.supplier-info {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.supplier-details h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.supplier-details h4::before {
    content: '\f1ad';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #f093fb;
}

.supplier-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    color: #4a5568;
}

.contact-item i {
    color: #f093fb;
    width: 16px;
    text-align: center;
}

.contact-phone,
.contact-email {
    font-weight: 500;
}

/* Product Actions */
.product-actions {
    display: flex;
    gap: 12px;
    margin-top: auto;
}

.view-details-btn {
    /*background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);*/
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.view-details-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 147, 251, 0.4);
    color: white;
}

.contact-supplier-btn {
    background: white;
    border: 2px solid #f093fb;
    color: #f093fb;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.contact-supplier-btn:hover {
    /*background: #f093fb;*/
    background: #8b5cf6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 147, 251, 0.3);
}

/* Modal Styles - Optimized with News Modal Styling */
.product-modal .modal-content {
    border-radius: 20px;
    border: none;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.product-modal .modal-header {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border-bottom: none;
    padding: 2rem;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.product-modal .modal-title {
    font-weight: 700;
    font-size: 1.8rem;
    margin: 0;
    padding-right: 100px;
    line-height: 1.3;
}

/* Modal Controls Container */
.modal-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 8px;
}

/* Maximize/Restore Button */
.modal-maximize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.modal-maximize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Close Button - Same as News Modal */
.product-modal .close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.3s ease;
    opacity: 1;
    font-weight: normal;
    text-shadow: none;
    position: static;
}

.product-modal .close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
    opacity: 1;
}

/* Maximized Modal Styles */
.product-modal.maximized .modal-dialog {
    width: 100vw;
    height: 100vh;
    max-width: none;
    margin: 0;
    transition: all 0.3s ease;
}

.product-modal.maximized .modal-content {
    height: 100vh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

.product-modal.maximized .modal-body {
    flex: 1;
    overflow-y: auto;
}

/* Smooth transitions for modal resize */
.product-modal .modal-dialog {
    transition: all 0.3s ease;
}

.product-modal .modal-content {
    transition: all 0.3s ease;
}

/* Enhanced modal controls styling */
.modal-controls button {
    margin: 0;
    padding: 0;
}

.modal-controls button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

/* Responsive adjustments for maximized modal */
@media (max-width: 768px) {
    .product-modal.maximized .modal-header {
        padding: 1.5rem;
    }
    
    .product-modal.maximized .modal-title {
        font-size: 1.5rem;
        padding-right: 80px;
    }
    
    .modal-controls {
        top: 0.75rem;
        right: 0.75rem;
    }
    
    .modal-maximize-btn,
    .product-modal .close {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

.product-modal .modal-body {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-image {
    margin-bottom: 25px;
    text-align: center;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.modal-image img {
    border-radius: 12px;
    max-height: 400px;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    background: white;
}

.modal-content-text {
    line-height: 1.7;
    color: #4a5568;
    margin-bottom: 25px;
}

.modal-content-text h5 {
    color: #2d3748;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 12px;
}

.modal-content-text ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.modal-content-text li {
    margin-bottom: 8px;
    color: #4a5568;
}

.modal-supplier-info {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #f093fb;
}

.modal-supplier-info h5 {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-supplier-info h5::before {
    content: '\f095';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: #f093fb;
}

.modal-supplier-info p {
    margin-bottom: 8px;
    color: #4a5568;
}

.modal-supplier-info strong {
    color: #2d3748;
}

/* Animation Classes */
.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .products-hero .hero-title {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .products-grid {
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 0 20px;
    }
    
    .product-card {
        min-width: auto;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .gallery-thumbnails {
        display: none;
    }
    
    /* Mobile image optimizations */
    .product-gallery {
        height: 220px;
    }
    
    .gallery-main {
        padding: 15px 20px;
    }
    
    .main-image {
        min-width: 150px;
        min-height: 100px;
        width: 100%;
        max-width: calc(100% - 30px);
        max-height: calc(100% - 30px);
    }
    
    .main-image.error {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
    
    .contact-info {
        gap: 12px;
    }
    
    .contact-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
}

@media (max-width: 576px) {
    .products-hero .hero-title {
        font-size: 2rem;
    }
    
    .product-info {
        padding: 20px;
    }
    
    .supplier-info {
        padding: 15px;
    }
    
    .product-actions {
        gap: 8px;
    }
    
    .view-details-btn,
    .contact-supplier-btn {
        padding: 10px 16px;
        font-size: 0.9rem;
    }
    
    /* Extra small screen image optimizations */
    .product-gallery {
        height: 200px;
    }
    
    .gallery-main {
        padding: 12px 18px;
    }
    
    .main-image {
        min-width: 120px;
        min-height: 80px;
        width: 100%;
        max-width: calc(100% - 24px);
        max-height: calc(100% - 24px);
    }
    
    .main-image.error {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .modal-image {
        padding: 15px;
        min-height: 150px;
    }
    
    .modal-image img {
        max-height: 250px;
    }
}

/* Image Quality Enhancements */
.main-image,
.modal-image img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: optimize-quality;
}

/* Lazy Loading Support */
.main-image[loading="lazy"] {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.main-image[loading="lazy"].loaded {
    opacity: 1;
}

/* High DPI Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .main-image {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Loading States */
.product-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.product-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid #f093fb;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hover Effects */
.product-card .product-name {
    transition: color 0.3s ease;
}

.product-card:hover .product-name {
    color: #f093fb;
}

.supplier-info {
    transition: all 0.3s ease;
}

.product-card:hover .supplier-info {
    background: #f1f5f9;
    transform: translateY(-2px);
}

/* Focus States for Accessibility */
.view-details-btn:focus,
.contact-supplier-btn:focus {
    outline: 3px solid rgba(240, 147, 251, 0.3);
    outline-offset: 2px;
}

.thumbnail-item:focus {
    outline: 2px solid #f093fb;
    outline-offset: 2px;
}