/* Reset và Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
}

/* Container - Rộng hơn */
.container {
    max-width: 1400px; /* Tăng từ 1200px lên 1400px */
    margin: 0 auto;
    padding: 0 1rem;
}

/* Container rộng full cho một số section */
.container-fluid {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Container cho hero section */
.hero-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Cập nhật product container */
.product-container {
    display: grid;
    grid-template-columns: 500px 1fr; /* Tăng từ 450px lên 500px */
    gap: 4rem; /* Tăng gap */
    background: white;
    padding: 3rem; /* Tăng padding */
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    align-items: start;
}

.product-gallery-container {
    width: 100%;
    max-width: 500px;

    z-index: 10;
    position: relative;
}

/* Responsive cho container rộng hơn */
@media (max-width: 1600px) {
    .container {
        max-width: 1300px;
    }

    .container-fluid {
        padding: 0 1.5rem;
    }
}

@media (max-width: 1400px) {
    .container {
        max-width: 1200px;
    }

    .product-container {
        grid-template-columns: 450px 1fr;
        gap: 3rem;
    }
}

@media (max-width: 1200px) {
    .container {
        max-width: 1000px;
    }

    .product-container {
        grid-template-columns: 400px 1fr;
        gap: 2rem;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: #ee4d2d;
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #d73211;
}

/* Header */
header {
    background: linear-gradient(135deg, #ee4d2d 0%, #f05a3b 100%);
    color: white;
    padding: 1.5rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(238, 77, 45, 0.2);
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin: 0;
}

/* Breadcrumb */
.breadcrumb {
    background: white;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    font-size: 0.9rem;
}

.breadcrumb a {
    color: #666;
    margin-right: 0.5rem;
}

.breadcrumb a:hover {
    color: #ee4d2d;
}

.breadcrumb span {
    color: #333;
    font-weight: 500;
}

/* Product Container - FIX CHÍNH */
.product-container {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 3rem;
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    align-items: start;
}

.product-gallery-container {
    width: 100%;
    max-width: 450px;
}

.product-detail-info {
    width: 100%;
    min-width: 0; /* Prevent overflow */
}

.product-detail-info h1 {
    font-size: 1.6rem;
    line-height: 1.4;
    color: #333;
    margin-bottom: 1rem;
    word-wrap: break-word;
}

/* Rating Section */
.rating-section {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.rating {
    color: #ffa500;
    font-weight: 600;
    font-size: 1.1rem;
    white-space: nowrap;
}

.reviews {
    color: #666;
    font-size: 0.95rem;
    white-space: nowrap;
}

.sold {
    color: #666;
    font-size: 0.95rem;
    white-space: nowrap;
}

/* Price Section */
.price-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #fff5f5 0%, #ffe8e8 100%);
    border-radius: 8px;
    border: 1px solid rgba(238, 77, 45, 0.1);
}

.current-price {
    font-size: 2.2rem;
    color: #ee4d2d;
    font-weight: 700;
    display: block;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.original-price {
    text-decoration: line-through;
    color: #999;
    font-size: 1.2rem;
    margin-right: 1rem;
}

.discount-badge {
    background: linear-gradient(45deg, #ee4d2d, #ff6b47);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(238, 77, 45, 0.3);
    display: inline-block;
}

/* Shop Info */
.shop-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #ee4d2d;
    margin-bottom: 1.5rem;
}

.shop-info h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.shop-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    font-size: 0.9rem;
    color: #666;
}

.shop-stats div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

/* Shipping Info */
.shipping-info {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4edda 100%);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #28a745;
    margin-bottom: 1.5rem;
}

.shipping-info h4 {
    color: #155724;
    margin-bottom: 0.8rem;
}

.shipping-info p {
    margin-bottom: 0.5rem;
    color: #155724;
}

/* Product Description */
.product-description {
    background: white;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin-top: 2rem;
}

.product-description h2 {
    color: #333;
    margin-bottom: 1.5rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #ee4d2d;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    line-height: 1;
}

.btn-primary {
    background: #ee4d2d;
    color: white;
}

.btn-primary:hover {
    background: #d73211;
    color: white;
}

.btn-secondary {
    background: white;
    color: #ee4d2d;
    border: 1px solid #ee4d2d;
}

.btn-secondary:hover {
    background: #ee4d2d;
    color: white;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.action-buttons a,
.action-buttons button {
    flex: 1;
    min-width: 200px;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.buy-now-btn {
    background: #ee4d2d;
    color: white;
    padding: 12px;
    border-radius: 8px;
}

.buy-now-btn:hover {
    background: #d73211;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(238, 77, 45, 0.3);
}

.share-btn {
    background: white;
    color: #ee4d2d;
    border: 1px solid #ee4d2d;
}

.share-btn:hover {
    background: #ee4d2d;
    color: white;
}

/* Category Section */
.category-section {
    margin-bottom: 3rem;
}

.category-header {
    background: white;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    border-left: 4px solid #ee4d2d;
}

.category-header h2, .category-header h3 {
    margin: 0;
    color: #333;
}

.category-header a {
    color: #333;
    font-size: 1.5rem;
    font-weight: 600;
}

.category-header a:hover {
    color: #ee4d2d;
}

.product-count {
    color: #666;
    font-weight: normal;
    font-size: 1rem;
    margin-left: 0.5rem;
}

/* Product Grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Product Card */
.product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.product-card a {
    color: inherit;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Product Image */
.product-image {
    width: 100%;
    height: 240px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Product Info */
.product-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-name {
    font-size: 1rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    height: 2.8rem;
    font-weight: 500;
    color: #333;
}

/* Product Price */
.product-price {
    color: #ee4d2d;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

.product-original-price {
    color: #999;
    text-decoration: line-through;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    font-weight: normal;
}

/* Product Discount Badge */
.product-discount {
    background: linear-gradient(45deg, #ee4d2d, #ff6b47);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    box-shadow: 0 2px 8px rgba(238, 77, 45, 0.3);
}

/* Product Stats */
.product-stats {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid #f0f0f0;
}

.product-rating {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.sold-count {
    font-size: 0.8rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin: 3rem 0;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    padding: 0.8rem 1.2rem;
    border: 1px solid #ddd;
    text-decoration: none;
    color: #333;
    border-radius: 6px;
    transition: all 0.2s ease;
    min-width: 44px;
    text-align: center;
}

.pagination a:hover {
    background: #ee4d2d;
    color: white;
    border-color: #ee4d2d;
    transform: translateY(-1px);
}

.pagination .current {
    background: #ee4d2d;
    color: white;
    border-color: #ee4d2d;
    font-weight: 600;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

/* Loading States */
.loading {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ee4d2d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid #dc3545;
}

.no-reviews {
    text-align: center;
    padding: 3rem;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* Success States */
.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    border-left: 4px solid #28a745;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #333 0%, #2c2c2c 100%);
    color: white;
    text-align: center;
    padding: 3rem 0;
    margin-top: 4rem;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* RESPONSIVE DESIGN - FIX CHÍNH */
@media (max-width: 1200px) {
    .product-container {
        grid-template-columns: 400px 1fr;
        gap: 2rem;
    }

    .product-gallery-container {
        max-width: 400px;
    }
}

@media (max-width: 390px) {
    .product-gallery-container {
        max-width: 330px !important;
    }
}

@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    .product-container {
        grid-template-columns: 350px 1fr;
        gap: 2rem;
        padding: 2rem;
    }

    .product-gallery-container {
        max-width: 350px;
    }

    .current-price {
        font-size: 2rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons a,
    .action-buttons button {
        min-width: auto;
        flex: none;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    header {
        padding: 1rem 0;
    }

    header h1 {
        font-size: 1.5rem;
    }

    header p {
        font-size: 1rem;
    }

    /* MOBILE LAYOUT - FIX CHÍNH */
    .product-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1.5rem;
    }

    .product-gallery-container {
        /*max-width: 100%;*/
        /*width: 100%;*/
    }

    .product-detail-info {
        width: 100%;
    }

    .current-price {
        font-size: 1.8rem;
    }

    .rating-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.8rem;
    }

    .shop-stats {
        grid-template-columns: 1fr;
    }

    .category-header {
        padding: 1.5rem;
    }

    .product-description {
        padding: 1.5rem;
    }

    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .product-image {
        height: 180px;
    }

    .product-info {
        padding: 1rem;
    }

    .product-name {
        font-size: 0.9rem;
        height: 2.4rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .pagination {
        gap: 0.3rem;
    }

    .pagination a,
    .pagination span {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
        min-width: 36px;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .product-image {
        height: 200px;
    }

    .product-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .current-price {
        font-size: 1.6rem;
    }

    .price-section {
        padding: 1rem;
    }

    .breadcrumb {
        font-size: 0.8rem;
        padding: 0.8rem;
    }

    .category-header h3 a {
        font-size: 1.2rem;
    }

    .product-count {
        display: block;
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .action-buttons a,
    .action-buttons button {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Smooth animations */
* {
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

/* Focus states for accessibility */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #ee4d2d;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .product-card {
        border: 2px solid #333;
    }

    .btn-primary {
        border: 2px solid #333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }

    .product-card:hover {
        transform: none;
    }

    .product-card:hover .product-image {
        transform: none;
    }
}

/* Print styles */
@media print {
    header,
    footer,
    .pagination,
    .breadcrumb {
        display: none;
    }

    .product-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .product-card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}