/* Fix product image sizes in admin panel */
.product-thumb {
    width: 80px !important;
    height: 80px !important;
    object-fit: cover !important;
    border-radius: 8px;
    border: 2px solid #eee;
}

/* Fix image size in product preview */
.preview-image {
    max-width: 100% !important;
    max-height: 400px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 8px;
    border: 2px solid #eee;
}

/* Fix main product image on detail page */
.main-image img {
    max-width: 100% !important;
    max-height: 500px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
    border-radius: 10px;
    border: 2px solid #eee;
}

/* Fix product images in grids */
.product-img {
    width: 100% !important;
    height: 250px !important;
    object-fit: cover !important;
    border-radius: 8px;
}

/* Fix the entire table layout */
.table-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

/* Ensure table cells have proper sizing */
table {
    table-layout: fixed; /* Add this */
    width: 100%;
}

/* Set specific column widths */
th:nth-child(1), td:nth-child(1) { width: 50px; } /* Checkbox */
th:nth-child(2), td:nth-child(2) { width: 100px; } /* Image */
th:nth-child(3), td:nth-child(3) { width: 250px; } /* Name */
th:nth-child(4), td:nth-child(4) { width: 120px; } /* Price */
th:nth-child(5), td:nth-child(5) { width: 120px; } /* Stock */
th:nth-child(6), td:nth-child(6) { width: 150px; } /* Category */
th:nth-child(7), td:nth-child(7) { width: 100px; } /* Status */
th:nth-child(8), td:nth-child(8) { width: 180px; } /* Actions */

/* Force image cell to stay small */
td:nth-child(2) {
    padding: 5px !important;
    text-align: center;
}

/* More aggressive image constraints */
.product-thumb {
    width: 80px !important;
    height: 80px !important;
    max-width: 80px !important;
    max-height: 80px !important;
    min-width: 80px !important;
    min-height: 80px !important;
    object-fit: cover !important;
    border-radius: 8px;
    border: 2px solid #eee;
    display: block !important;
    margin: 0 auto !important;
}

/* Fix admin container */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

/* Fix products table container */
.products-table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 100%;
    overflow-x: auto;
}

/* Ensure table doesn't expand beyond container */
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px; /* Minimum width to prevent weird behavior */
}

/* Cell constraints */
td {
    padding: 10px !important;
    vertical-align: middle !important;
    word-wrap: break-word;
    max-width: 200px;
}

/* Add these to style.css */
.loading-small {
    padding: 10px;
    text-align: center;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.no-categories {
    padding: 15px;
    text-align: center;
    color: #7f8c8d;
    border: 1px dashed #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

.no-categories i {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #ddd;
}

.no-categories small {
    display: block;
    margin-top: 5px;
    font-size: 0.8rem;
}

.error-loading {
    padding: 15px;
    text-align: center;
    color: #e74c3c;
    border: 1px solid #f8d7da;
    border-radius: 5px;
    background: #f8d7da;
}

.error-loading i {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.empty-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.empty-products i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 20px;
}

.loading-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.loading-products i {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 20px;
}

.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #e74c3c;
}

/* Product detail page styles */
.product-detail-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin: 2rem 0;
}

.product-images .main-image {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.product-images .main-image img {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.product-price h2 {
    color: var(--secondary);
    font-size: 2.5rem;
    margin: 1rem 0;
}

.price-includes {
    background: #e8f5e9;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid var(--success);
}

.price-includes p {
    margin: 8px 0;
    color: var(--success);
    display: flex;
    align-items: center;
    gap: 10px;
}

.shipping-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #34495e 100%);
    color: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.shipping-banner i {
    font-size: 2.5rem;
    color: var(--secondary);
}

.shipping-banner h4 {
    color: white;
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.shipping-banner p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.95rem;
}

.product-actions {
    display: flex;
    gap: 15px;
    margin: 30px 0;
    flex-wrap: wrap;
    align-items: center;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-selector input {
    width: 60px;
    padding: 10px;
    text-align: center;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-weight: 600;
    font-size: 1rem;
}

.btn-add-to-cart, .btn-buy-now {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.btn-add-to-cart:hover {
    background: #1a252f;
    transform: translateY(-2px);
}

.btn-buy-now {
    background: var(--secondary);
    color: white;
}

.btn-buy-now:hover {
    background: #d35400;
    transform: translateY(-2px);
}

.stock-info {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;
}

.in-stock {
    color: var(--success);
    font-weight: 600;
}

.low-stock {
    color: var(--warning);
    font-weight: 600;
}

.related-products {
    margin-top: 4rem;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

@media (max-width: 992px) {
    .product-detail-container {
        grid-template-columns: 1fr;
    }
    
    .product-images .main-image img {
        height: 300px;
    }
    
    .product-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .quantity-selector {
        justify-content: center;
        margin-bottom: 15px;
    }
    
    .btn-add-to-cart, .btn-buy-now {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .product-price h2 {
        font-size: 2rem;
    }
    
    .shipping-banner {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    
    .related-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}