/* Product Details Page Styles - Refined & Modern */

/* --- Card Styles (Vertical) - Matching components_v2.css exactly --- */
.product-grid-vertical {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.card-vertical {
    background: var(--color-gray-900);
    /* Standard card bg from components_v2 */
    border: 1px solid var(--color-gray-800);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition-base);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--color-white);
    position: relative;
    box-shadow: none;
    /* components_v2 cards usually start flat or with specific shadow */
}

/* Match products.html hover effect */
.card-vertical:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-bronze);
    border-color: rgba(176, 141, 87, 0.3);
}

.card-vertical__image-wrapper {
    width: 100%;
    aspect-ratio: 4/5;
    overflow: hidden;
    /* Premium Glow Effect - Option 1 (Light Mode) */
    background: radial-gradient(circle at center, rgba(176, 141, 87, 0.25) 0%, #e0e0e0 100%) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    position: relative;
    border-bottom: 1px solid var(--color-gray-200);
}

[data-theme="dark"] .card-vertical__image-wrapper {
    /* Premium Glow Effect - Option 1 (Dark Mode) */
    background: radial-gradient(circle at center, rgba(176, 141, 87, 0.5) 0%, #2a2a2a 100%) !important;
    border-bottom: 1px solid var(--color-gray-800);
}

.card-vertical__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform var(--duration-500) var(--ease-premium);
    /* For transparent images, use drop shadow for depth */
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.2));
}

.card-vertical:hover .card-vertical__image {
    transform: scale(1.05);
}

.card-vertical__content {
    padding: var(--space-6);
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: space-between;
    background: transparent;
    /* Inherit from card */
}

.card-vertical__code {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: var(--font-medium);
    letter-spacing: var(--tracking-wider);
    text-transform: uppercase;
    color: var(--color-bronze);
    background: rgba(176, 141, 87, 0.1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(176, 141, 87, 0.2);
    margin-bottom: var(--space-4);
}

.card-vertical__title {
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--color-white);
    margin-bottom: var(--space-3);
    transition: color 0.3s ease;
}

.card-vertical:hover .card-vertical__title {
    color: var(--color-white);
    /* Consistent with products.html */
}

.card-vertical__action {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--color-gray-400);
    padding-top: 1rem;
    border-top: 1px dashed var(--color-gray-800);
    transition: color 0.3s ease;
}

.card-vertical:hover .card-vertical__action {
    color: var(--color-bronze);
}

/* --- Theme Handling via Variables (No explicit light/dark overrides needed) --- */
/* Since we use --color-gray-900 etc, these automatically flip in light mode via variables.css */

/* Dark Mode Specific Tweaks for Images if needed */
[data-theme="dark"] .card-vertical__image {
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.05));
}

[data-theme="dark"] .product-detail-visual {
    background: radial-gradient(circle at center, rgba(176, 141, 87, 0.4) 0%, var(--color-gray-900) 80%) !important;
    border-color: var(--color-gray-800);
}

[data-theme="dark"] .product-detail-visual img {
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.05));
}

/* Technical Drawing Styles */
.technical-drawing-wrapper {
    background: var(--color-white);
    /* Usually needs to be white for drawings */
    border: 1px solid var(--color-gray-800);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

[data-theme="dark"] .technical-drawing-wrapper {
    background: var(--color-gray-100);
    /* Light gray for readability in dark mode */
}

[data-theme="dark"] .technical-drawing-wrapper img {
    mix-blend-mode: multiply;
}

/* --- Detail Page Specifics --- */
.product-detail-header {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    /* Align vertically with clear layout */
    justify-content: space-between;
    /* Title Left, Image Right */
    gap: 4rem;
    /* Space between title area and image */
    flex-wrap: wrap;
    /* Be safe for smaller screens */
}

/* Ensure title wrapper takes available space but doesn't shrink too much */
.product-title-wrapper {
    flex: 1;
    min-width: 300px;
}

.product-breadcrumb {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.product-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.product-breadcrumb a:hover {
    color: var(--primary);
}

.product-breadcrumb span {
    margin: 0 0.5rem;
    opacity: 0.5;
}

.product-title-wrapper h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-heading);
}

.product-description {
    font-size: 1.1rem;
    color: var(--text-body);
    max-width: 800px;
}

.product-detail-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
    margin-bottom: 4rem;
}

.product-detail-visual {
    background-color: #faf8f5;
    /* Cream background (Clean Style) */
    background-image: none;
    border-radius: var(--radius-2xl);
    border: 1px solid var(--color-bronze);
    padding: 0;
    /* Remove padding to fully fill the box */
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 0, 0, 0.2);
    /* High elevation shadow */
    position: relative;
    overflow: hidden;

    /* Dynamic Sizing to match Layout */
    width: 40%;
    max-width: 500px;
    height: auto;
    aspect-ratio: 16/10;
    /* Shorter, landscape rectangular shape */
    margin: 0;
}

.product-detail-visual img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: drop-shadow(0 0 20px rgba(0, 0, 0, 0.1));
    /* Elevation shadow */
    z-index: 1;
    /* Slightly transparent per user request */
}

.technical-drawing-wrapper {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 0 auto 2rem auto;
    /* Center horizontally */
    display: flex;
    justify-content: center;
    width: 40%;
    /* Reduced container width */
}

.technical-drawing-wrapper img {
    width: 100%;
    /* Fill the smaller container */
    height: auto;
    display: block;
}

/* --- Technical Specs Table --- */
/* --- Technical Specs Table Redesign (Perfectionist) --- */
.product-specs-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    background: #f8f9fa;
    /* Light mode distinct bg */
    margin-top: 1rem;
    position: relative;
}

[data-theme="dark"] .product-specs-table-wrapper {
    background: #1e1e1e;
    /* Dark mode distinct bg */
    border-color: #333333;
}

.product-specs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.95rem;
    white-space: nowrap;
}

.product-specs-table th,
.product-specs-table td {
    padding: 1.25rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    /* Clean light border */
}

[data-theme="dark"] .product-specs-table th,
[data-theme="dark"] .product-specs-table td {
    border-bottom: 1px solid #333333;
    /* Dark border */
}

/* Sticky Header */
.product-specs-table th {
    background: #f7f3ee;
    /* Solid equivalent of hover color (on white) for sticky opacity safety */
    color: var(--color-bronze);
    /* Dark text for contrast */
    font-weight: 800;
    /* Extra bold for headers */
    text-transform: uppercase;
    border-bottom: 1px solid #dee2e6;
    /* Match row borders */
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- Table Features Styles --- */
.table-controls {
    display: flex;
    justify-content: flex-end;
    /* Right aligned */
    margin-bottom: 1rem;
}

.table-search-input-wrapper {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.table-search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    /* Space for icon */
    border: 2px solid rgba(176, 141, 87, 0.4) !important;
    /* Soft premium bronze border */
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    transition: var(--transition-base);
    background: var(--bg-card);
    color: var(--text-body);
}

.table-search-input:focus {
    outline: none;
    border-color: var(--color-bronze);
    box-shadow: 0 0 0 3px rgba(176, 141, 87, 0.1);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

/* Sort Icons */
/* Default state for all sortable headers (skips first child usually) */
.product-specs-table th:not(:first-child) {
    cursor: pointer;
    padding-right: 1.5rem;
    /* Space for icon */
    position: relative;
    /* For icon positioning */
}

.product-specs-table th:not(:first-child)::after {
    content: "⇅";
    /* Double vertical arrow for 'sortable' hint */
    position: absolute;
    right: 0.5rem;
    opacity: 0.3;
    /* Subtle by default */
    font-size: 0.8em;
}

.product-specs-table th:not(:first-child):hover::after {
    opacity: 0.7;
    /* brighter on hover */
}

th.sort-asc::after {
    content: "▲" !important;
    opacity: 1 !important;
    color: var(--color-bronze);
    /* Highlight active sort */
}

th.sort-desc::after {
    content: "▼" !important;
    opacity: 1 !important;
    color: var(--color-bronze);
}

[data-theme="dark"] .product-specs-table th {
    background: #000000;
    /* Even darker for dark mode header */
    color: var(--color-bronze);
    /* Bronze text for premium feel */
}

/* Zebra Striping */
.product-specs-table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.02);
    /* Very subtle gray */
}

[data-theme="dark"] .product-specs-table tbody tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
    /* Subtle light overlay */
}

/* Hover Effect */
.product-specs-table tbody tr:hover {
    background-color: rgba(176, 141, 87, 0.1) !important;
    /* Bronze highlight */
    transition: background-color 0.2s ease;
}

.product-specs-table td {
    color: var(--text-body);
    vertical-align: middle;
    transition: color 0.2s ease;
}

/* Cell Borders (Vertical Separation for Header) */
.product-specs-table th:not(:last-child) {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.product-specs-table td {
    color: var(--text-body);
    vertical-align: middle;
}

/* First Column Bold */
.product-specs-table td:first-child {
    font-weight: 700;
    color: var(--text-heading);
}

/* Last row border removal for clean card look */
.product-specs-table tr:last-child td {
    border-bottom: none;
}

/* Row Hover Effect */
.product-specs-table tbody tr {
    transition: all 0.3s ease;
    position: relative;
}

.product-specs-table tbody tr:hover {
    background-color: #faf8f5;
    /* Cream hover effect matched to header */
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg), var(--shadow-bronze);
    z-index: 1;
}

/* Dark Mode Table Layout */
[data-theme="dark"] .product-specs-table-wrapper {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .product-specs-table th {
    background: var(--color-gray-800);
    /* Override cream bg */
    color: var(--color-gray-400);
}

[data-theme="dark"] .product-specs-table td {
    border-bottom-color: var(--color-gray-800);
    color: var(--color-gray-300);
}

[data-theme="dark"] .product-specs-table td:first-child {
    color: var(--color-white);
}

[data-theme="dark"] .product-specs-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

/* Responsive Adjustments */
/* Responsive Adjustments & Mobile Perfection */
@media (max-width: 900px) {
    .product-detail-hero {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {

    /* 1. Compact Mobile Hero */
    .product-detail-hero {
        display: flex;
        flex-direction: column-reverse;
        /* Info on top of visual visually? No, usually Visual then Title? or Title then Visual? Desktop is Info(Left) Visual(Right). Stacked: Info then Visual. */
        /* User wanted side-by-side to save space */
        flex-direction: row;
        align-items: center;
        gap: 1rem;
        padding: 0 0.5rem;
    }

    .product-detail-visual {
        display: flex !important;
        width: 100%;
        margin-top: 2rem;
        /* Show image on mobile */
    }

    .product-detail-info h1 {
        font-size: 1.5rem;
        /* Smaller title */
        margin-bottom: 0.5rem;
    }

    .breadcrumb {
        font-size: 0.75rem;
    }

    /* 2. Touch Friendly Search */
    .table-search-input-wrapper {
        max-width: 100%;
        /* Full width */
    }

    .table-search-input {
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
        /* Larger touch target */
        font-size: 1rem;
        /* Readable font without zoom */
    }

    /* 3. Sticky Columns for Table */
    /* Checkbox Column */
    /* Code Column (2nd) */
    .product-specs-table th:nth-child(2),
    .product-specs-table td:nth-child(2) {
        position: sticky;
        left: 35px;
        /* Slightly overlap the checkbox column to prevent gaps */
        /* Checkbox column is usually ~40px wide including padding. 
           If we set this too high, gap. Too low, overlap. 
           Better to clear the gap by ensuring background coverage. */
        z-index: 15;
        background-color: #f8f9fa;
        border-right: 2px solid var(--border-color);
        /* Separator */
        border-left: 1px solid var(--border-color);
        /* Ensure left edge is defined */
    }

    /* Checkbox Column (1st) */
    .product-specs-table th:first-child,
    .product-specs-table td:first-child {
        position: sticky;
        left: 0;
        z-index: 16;
        /* Higher z-index to stay on top if overlapped */
        width: 40px;
        /* Force fixed width */
        min-width: 40px;
        max-width: 40px;
        background-color: #f8f9fa;
    }

    /* Dark Mode Sticky Backgrounds */
    [data-theme="dark"] .product-specs-table th:first-child,
    [data-theme="dark"] .product-specs-table td:first-child,
    [data-theme="dark"] .product-specs-table th:nth-child(2),
    [data-theme="dark"] .product-specs-table td:nth-child(2) {
        background-color: var(--bg-card);
        /* Match dark card bg */
        border-right-color: var(--color-gray-700);
    }

    /* Sticky Header on top of Sticky Columns? Header z-index is 10. Sticky Cols need to be lower than header? 
       Actually Sticky Header (th) needs to be z-index 20 to cover sticky Body cols (td). 
       The th intersection (top-left) needs z-index 30.
    */

    .product-specs-table th {
        z-index: 20;
        /* Ensure header covers body scroll */
    }

    .product-specs-table th:first-child,
    .product-specs-table th:nth-child(2) {
        z-index: 30;
        /* Top-left corner must be highest */
    }

    /* 4. Compact Table Content */
    .product-specs-table th,
    .product-specs-table td {
        font-size: 0.75rem;
        /* Smaller font for mobile */
        padding: 0.5rem 0.4rem;
        /* Tighter padding */
    }

    .product-specs-table th {
        font-size: 0.7rem;
        /* Even smaller for headers */
        letter-spacing: 0;
    }

    /* Code Column Optimization */
    .product-specs-table th:nth-child(2),
    .product-specs-table td:nth-child(2) {
        max-width: 120px;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* --- Dark Mode Image Handling (For Transparent Images) --- */
[data-theme="dark"] .card-vertical__image-wrapper {
    background: #363636;
    /* Seamless with card background */
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .card-vertical__image {
    /* No blend mode needed for transparent images */
    mix-blend-mode: normal;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.05));
}

/* Dark Mode: Dimmed Light Mode Style (Cream Paper + Dark Overlay) - No Grid */
[data-theme="dark"] .product-detail-visual {
    background-color: #000000 !important;
    background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)) !important;
    background-size: 100% 100% !important;
    background-repeat: no-repeat !important;
    border-color: var(--color-bronze);

    /* Dark Mode Elevation (Bronze Glow instead of black shadow) */
    box-shadow: 0 0 50px rgba(176, 141, 87, 0.8), 0 0 20px rgba(176, 141, 87, 0.1) !important
}

[data-theme="dark"] .product-detail-visual img {
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.05));
    opacity: 0.8;
}

/* Tech drawings usually have white bg, so we invert or blend them */
[data-theme="dark"] .technical-drawing-wrapper {
    background: #e5e5e5;
    /* Keep light bg for readability of standard tech drawings */
}

[data-theme="dark"] .technical-drawing-wrapper img {
    mix-blend-mode: multiply;
}

/* --- Light Mode Image Handling (Cream Theme) --- */
[data-theme="light"] .card-vertical {
    background: #faf8f5;
    /* Warm off-white / cream */
    border-color: #e8e4dc;
}

[data-theme="light"] .card-vertical__image-wrapper {
    background: #363636;
    /* Transparent to show cream card bg */
    border-bottom-color: #e8e4dc;
}

[data-theme="light"] .card-vertical__content {
    background: #faf8f5;
}

/* [data-theme="light"] .product-detail-visual removed to enforce base Bronze border */

[data-theme="light"] .technical-drawing-wrapper {
    background: #fff;
    border-color: #e8e4dc;
}

/* --- Minimalist Pagination --- */
.pagination-container {
    display: flex;
    justify-content: center;
    /* Enforce centering */
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    /* Invisible border by default */
    background: transparent;
    color: var(--color-gray-500);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: var(--transition-fast);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--color-gray-100);
    color: var(--color-bronze);
}

.pagination-btn.active {
    background: var(--color-bronze);
    color: #ffffff !important;
    /* Force true white for contrast on bronze */
    font-weight: var(--font-bold);
    box-shadow: var(--shadow-sm);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Icons within buttons */
.pagination-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* Dots */
.pagination-dots {
    color: var(--color-gray-400);
    font-size: var(--text-sm);
    padding: 0 0.25rem;
}

/* Dark Mode Overrides */
[data-theme="dark"] .pagination-btn:hover:not(:disabled) {
    background: var(--color-gray-800);
    color: var(--color-bronze-light);
}

[data-theme="light"] .pagination-btn:hover:not(:disabled) {
    background: #f0f0f0;
}