/* Custom CSS Variables (Assuming these are also in style.css) */
:root {
    --primary-color: #005A9C;
    --secondary-color: #333333;
    --accent-color: #00AEEF;
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #4a4a4a;
    --border-color: #e9ecef;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

/* Dark Mode Variables (Essential for color change) */
[data-theme='dark'] {
    --bg-color: #1a1a1a;
    --card-bg: #2c2c2c;
    --text-color: #cccccc;
    --secondary-color: #f8f9fa;
    --border-color: #444;
    --primary-color: #00AEEF; /* Brighter blue for visibility */
    --accent-color: #007bff;
    --shadow: 0 5px 15px rgba(255, 255, 255, 0.05);
}


/* --- Product Header & Section Titles --- */

.product-header {
    text-align: center;
    padding: 60px 0 40px;
}

.main-title {
    font-size: 2.8rem;
    color: var(--secondary-color);
    margin-bottom: 10px;
    transition: color 0.3s;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-color);
    max-width: 800px;
    margin: 0 auto;
    transition: color 0.3s;
}

.product-section {
    margin-bottom: 70px;
}

.product-section h2 {
    text-align: center;
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-bottom: 40px;
    position: relative;
    padding-bottom: 15px;
    transition: color 0.3s;
}

.product-section h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--accent-color);
    transition: background-color 0.3s;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

/* --- Product Card Styling --- */
.product-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.card-image-container {
    height: 220px;
    overflow: hidden;
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover img {
    transform: scale(1.05);
}

.card-content {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-content h3 {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 10px;
    transition: color 0.3s;
}

.product-summary {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-color);
    flex-grow: 1;
    margin-bottom: 20px;
    transition: color 0.3s;
}

.details-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-top: auto;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.details-btn:hover {
    background-color: var(--accent-color);
    transform: scale(1.03);
}

/* --- Product Detail Modal Styles --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 9999; /* High Z-index */
    opacity: 0;
    transition: opacity 0.4s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    max-width: 1100px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.4s ease, background-color 0.3s;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--border-color);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    color: var(--secondary-color);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.modal-close-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.modal-product-title {
    font-size: 2.2rem;
    color: var(--primary-color);
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.modal-spec-section {
    margin-bottom: 30px;
}

.modal-spec-section h4 {
    font-size: 1.4rem;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.spec-table th, .spec-table td {
    border: 1px solid var(--border-color);
    padding: 12px;
    text-align: left;
    color: var(--text-color);
}

.spec-table th {
    background-color: var(--bg-color);
    font-weight: 600;
    width: 30%;
}

.spec-list {
    list-style: none;
    padding-left: 0;
}

.spec-list li {
    background-color: var(--bg-color);
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 8px;
    border-left: 4px solid var(--accent-color);
    color: var(--text-color);
}

.modal-note {
    margin-top: 30px;
    padding: 15px;
    background-color: #e7f5ff; /* Light blue background */
    border-left: 5px solid var(--primary-color);
    border-radius: 4px;
    font-style: italic;
    font-size: 0.9rem;
    color: #333;
}

/* Dark Mode Modal Overrides */
[data-theme='dark'] .modal-content {
    border: 1px solid #555;
}
[data-theme='dark'] .spec-table th {
    background-color: #383838;
}
[data-theme='dark'] .spec-list li {
    background-color: #383838;
}
[data-theme='dark'] .modal-note {
    background-color: #1a2a3a;
    color: #cccccc;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .main-title {
        font-size: 2.2rem;
    }
    .subtitle {
        font-size: 1rem;
    }
    .modal-content {
        padding: 25px 20px;
    }
    .modal-product-title {
        font-size: 1.8rem;
    }
    .spec-table th, .spec-table td {
        display: block;
        width: 100%;
    }
    .spec-table th {
        border-bottom: none;
        padding-bottom: 5px;
    }
    .spec-table td {
        padding-top: 5px;
        margin-bottom: 10px;
    }
}
/* --- Responsive Adjustments for Mobile View --- */
@media (max-width: 768px) {
    
    /* 1. General Layout Fix */
    .main-title {
        font-size: 2rem;
    }
    .subtitle {
        font-size: 0.9rem;
    }
    .product-grid {
        gap: 20px;
    }

    /* 2. Modal Overlay & Content Sizing */
    .modal-content {
        padding: 20px 15px; /* Reduce padding on small screens */
        max-width: 95%; /* Modal takes almost full screen width */
        width: 95%;
        margin: 5% auto; /* Keep it centered */
        max-height: 95vh;
    }
    .modal-product-title {
        font-size: 1.6rem;
        margin-bottom: 15px;
    }

    /* 3. Specs Container (Ensure sections are stacked) */
    .product-specs-container {
        grid-template-columns: 1fr; /* Force single column layout */
        gap: 0;
    }
    .modal-spec-section {
        padding: 0;
        margin-bottom: 15px;
    }
    
    /* 4. Critical Table Stacking Fix (Removes Horizontal Scroll) */
    .spec-table {
        display: block; /* Allows the table structure to be manipulated */
        width: 100%;
    }
    .spec-table thead, .spec-table tbody, .spec-table th, .spec-table td, .spec-table tr {
        display: block; /* Forces all table elements to be blocks */
    }
    
    .spec-table tr {
        margin-bottom: 10px;
        border: 1px solid var(--border-color); /* Separates rows */
        border-radius: 5px;
    }
    
    .spec-table th {
        text-align: right; /* Align header right for key-value feel */
        width: 100%;
        border: none;
        padding: 8px 12px 2px;
        font-size: 0.8rem;
        font-weight: normal;
        background-color: var(--bg-color);
        color: var(--primary-color);
    }
    
    .spec-table td {
        text-align: left;
        width: 100%;
        border: none;
        padding: 2px 12px 8px;
    }
    
    /* Hide the original table border on TH/TD */
    .spec-table th, .spec-table td {
        border-bottom: 1px solid var(--border-color);
    }

    /* 5. Image Scaling */
    .detail-product-img {
        max-height: 250px;
    }
}
/* Product Card Hover Enhancements */

/* 1. Animation for Image Lift and Shadow */
.product-card:hover .card-image-container img {
    /* Slightly lift the image up on hover */
    transform: translateY(-8px) scale(1.03); 
    /* Add a subtle shadow to give it a "floating" or "lifted" feel */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2); 
}

/* 2. Smooth Transition for all animations */
.product-card .card-image-container img {
    /* Apply a smooth transition to the transform and box-shadow properties */
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* 3. Enhanced Card Hover Effect (Optional, but looks great) */
.product-card:hover {
    /* Slight overall lift and border change for a polished look */
    border: 1px solid var(--primary-color, #007bff); /* Assuming you have a CSS variable for your primary color */
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}

.product-card {
    /* Smooth transition for the overall card */
    transition: border 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

/* Ensure the image takes up full space in its container */
.product-card .card-image-container img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}