/* Product Pages CSS - เสริมสำหรับ products.php และ product.php */

/* Products List Page Styles */
.page-header {
    background: linear-gradient(135deg, #8c8c8c 0%, #78777a 100%);
    color: white;
    padding: 3rem 0;
    margin-bottom: 2rem;
    border-radius: 0 0 20px 20px;
}

.page-header .page-title {
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.page-header .page-subtitle {
    color: rgba(255,255,255,0.9);
}

.filter-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.product-card {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    border-color: #667eea;
}

.product-image-wrapper {
    position: relative;
    height: 200px;
    overflow: hidden;
    background: #f8f9fa;
    flex-shrink: 0;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

.no-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.rating-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #ffc107 0%, #ff8f00 100%);
    color: white;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 2;
}

.product-info {
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-title {
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.product-title a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.product-title a:hover {
    color: #667eea;
}

.product-category {
    margin-bottom: 0.5rem;
}

.product-category .badge {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    font-size: 0.7rem;
    padding: 0.3rem 0.6rem;
    border-radius: 15px;
    font-weight: 500;
}

.product-price {
    margin-bottom: 0.75rem;
}

.product-price .price {
    color: #e74c3c;
    font-size: 1.1rem;
    font-weight: 700;
}

.product-description {
    font-size: 0.85rem;
    line-height: 1.4;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 20;
    line-clamp: 20;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-actions {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-top: auto;
}

.product-actions .btn {
    flex: 1;
    min-width: 100px;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.product-actions .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.product-actions .btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-2px);
}

.product-actions .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
}

.product-actions .btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1ea080 100%);
    transform: translateY(-2px);
}

/* Product Detail Page Styles */
.main-image-wrapper {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    background: white;
    position: relative;
}

.main-image-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(103, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    z-index: 1;
}

.main-product-image {
    position: relative;
    z-index: 2;
}

.product-info-section {
    padding-left: 2rem;
}

.product-title {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

.product-rating .stars {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.product-rating .rating-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #495057;
}

.product-price {
    background: #ffffff;
    border-radius: 15px;
    padding: 0.5rem;
    margin-bottom: 0rem;
    border: 2px solid #dee2e6;
}

.product-price .price {
    color: #e74c3c;
    font-size: 2.2rem;
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.section-title {
    position: relative;
    padding-left: 1rem;
}

.section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    border-radius: 2px;
    display:none;
}

.related-product-card {
    transition: all 0.3s ease;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.related-product-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    border-color: #667eea;
}

.related-image-wrapper {
    height: auto;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    flex-shrink: 0;
}

.related-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.related-product-card:hover .related-image {
    transform: scale(1.05);
}

.related-info {
    padding: 0.8rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.related-title {
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.related-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.related-title a:hover {
    color: #667eea;
}

.related-rating {
    font-size: 0.75rem;
    margin-bottom: 0.4rem;
}

.related-price {
    font-size: 0.9rem;
    margin-bottom: 0.6rem;
    margin-top: auto;
}

.related-info .btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
}

/* Empty State Styles */
.empty-state {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 20px;
    padding: 4rem 2rem;
    text-align: center;
    border: 2px dashed #dee2e6;
}

.empty-state i {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Pagination Styles */
.pagination .page-link {
    /* border-radius: 25px 25px 25px 25px; */
    margin: 0 0.25rem;
    border: 2px solid #dee2e6;
    color: #495057;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

/* Responsive Design */
@media (max-width: 991px) {
    .product-info-section {
        padding-left: 0;
        margin-top: 2rem;
    }
    
    .product-title {
        font-size: 2rem;
    }
    
    .page-header {
        padding: 2rem 0;
    }
    
    .page-header .page-title {
        font-size: 2rem;
    }
}

/* Responsive Design for Products Grid */
@media (max-width: 1199px) {
    .product-image-wrapper {
        height: 180px;
    }
    
    .product-info {
        padding: 0.875rem;
    }
    
    .product-title a {
        font-size: 0.9rem;
    }
    
    .product-price .price {
        font-size: 1rem;
    }
    
    /* Related Products on Large screens */
    .related-image-wrapper {
        height: auto;
    }
    
    .related-title {
        font-size: 0.8rem;
    }
}

@media (max-width: 991px) {
    .filter-bar {
        padding: 1.5rem;
    }
    
    .product-image-wrapper {
        height: 200px;
    }
    
    .product-actions .btn {
        min-width: 90px;
        font-size: 0.75rem;
        padding: 0.4rem 0.6rem;
    }
}

@media (max-width: 768px) {
    .filter-bar .row {
        gap: 1rem;
    }
    
    .filter-bar .col-md-2,
    .filter-bar .col-md-3,
    .filter-bar .col-md-4 {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .product-image-wrapper {
        height: 220px;
    }
    
    .product-info {
        padding: 1rem;
    }
    
    .product-title a {
        font-size: 0.95rem;
    }
    
    .product-actions {
        flex-direction: column;
    }
    
    .product-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        font-size: 0.85rem;
        padding: 0.6rem 1rem;
    }
    
    /* Product Detail Page Mobile */
    .product-title {
        font-size: 1.8rem;
    }
    
    .product-price .price {
        font-size: 1.8rem;
    }
}

@media (max-width: 576px) {
    .page-header {
        padding: 2rem 0;
        margin-bottom: 1.5rem;
    }
    
    .page-header .page-title {
        font-size: 1.6rem;
    }
    
    .page-header .page-subtitle {
        font-size: 0.9rem;
    }
    
    .product-image-wrapper {
        height: 200px;
    }
    
    .product-info {
        padding: 0.875rem;
    }
    
    .product-title a {
        font-size: 0.9rem;
        -webkit-line-clamp: 3;
        line-clamp: 3;
    }
    
    .product-description {
        font-size: 0.8rem;
        -webkit-line-clamp: 15;
        line-clamp: 15;
    }
    
    .product-price .price {
        font-size: 1rem;
    }
    
    .product-actions .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* Grid adjustments for mobile */
    .col-sm-6:nth-child(odd) {
        padding-right: 0.5rem;
    }
    
    .col-sm-6:nth-child(even) {
        padding-left: 0.5rem;
    }
    
    /* Product Detail Mobile */
    .product-title {
        font-size: 1.5rem;
    }
    
    .product-image-wrapper {
        height: 180px;
    }
    
    .main-image-wrapper {
        margin-bottom: 2rem;
    }
    
    /* Related Products Mobile */
    .related-image-wrapper {
        height: auto;
    }
    
    .related-info {
        padding: 0.6rem;
    }
    
    .related-title {
        font-size: 0.8rem;
        line-height: 1.2;
        margin-bottom: 0.4rem;
    }
    
    .related-price {
        font-size: 0.85rem;
        margin-bottom: 0.5rem;
    }
    
    .related-info .btn {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
    }
}

/* Loading Animation */
.product-card.loading {
    pointer-events: none;
    opacity: 0.7;
}

.product-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 3;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus States for Accessibility */
.product-card:focus-within {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

/* Print Styles */
@media print {
    .filter-bar,
    .pagination,
    .product-actions {
        display: none;
    }
    
    .product-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
}