:root {
    --pd-radius-lg: 4px;
    --pd-radius: 3px;
    --pd-shadow: 0 2px 8px rgba(0,0,0,0.05);
    --pd-shadow-sm: 0 1px 4px rgba(0,0,0,0.03);
    --pd-spacing-sm: .375rem;
    --pd-spacing-md: .625rem;
    --pd-spacing-lg: .875rem;
    --pd-spacing-xl: 1rem;
    --pd-transition: all .2s ease;

    /* Use global color variables */
    --primary-color: var(--primary-blue);
    --primary-dark: var(--primary-blue-dark);
    --primary-light: var(--primary-blue-light);
    --danger-color: var(--warning-coral);
    --warning-color: var(--accent-gold);
    --success-color: var(--success-green);
    --info-color: var(--accent);
}

/* ==============================
   Product Image
============================== */
.product-image-container {
    position: relative;
    background: var(--surface);
    border-radius: var(--pd-radius);
    overflow: hidden;
    box-shadow: var(--pd-shadow-sm);
    margin-bottom: var(--pd-spacing-lg);
    border: 1px solid var(--border-light);
}
#image-slider { position: relative; width: 100%; }
.product-image {
    width: 100%; height: 100%; object-fit: cover;
    transition: var(--pd-transition); cursor: zoom-in;
}
.product-image:hover { opacity: 0.95; }

/* Image Navigation */
.image-nav {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,.9); border: 1px solid var(--border-light);
    width: 36px; height: 36px; border-radius: var(--pd-radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; color: var(--text-primary);
    cursor: pointer; transition: var(--pd-transition); z-index: 10;
}
.image-nav:hover {
    background: var(--primary-color); color: var(--white);
    border-color: var(--primary-color);
}
.image-nav.prev { left: 12px; }
.image-nav.next { right: 12px; }

/* Thumbnails */
.image-thumbnails {
    display: flex; gap: 8px; margin-top: 12px;
    overflow-x: auto; padding: 8px 0;
}
.thumbnail {
    width: 64px; height: 64px; object-fit: cover;
    border-radius: var(--pd-radius); cursor: pointer;
    transition: var(--pd-transition); border: 1px solid var(--border-light);
    flex-shrink: 0;
}
.thumbnail:hover, .thumbnail.active {
    border-color: var(--primary-color);
}

/* ==============================
   Product Info
============================== */
.product-info {
    padding: var(--pd-spacing-lg);
    background: var(--white);
    border-radius: var(--pd-radius);
    box-shadow: var(--pd-shadow-sm);
    height: fit-content;
    position: sticky;
    top: 84px;
    border: 1px solid var(--border-light);
}
.product-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: .5rem;
    line-height: 1.3;
    font-size: clamp(1.125rem, 3vw, 1.5rem);
}

/* Price */
.product-price {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    margin-bottom: var(--pd-spacing-lg);
    padding: .625rem .75rem;
    background: var(--surface);
    border-radius: var(--pd-radius);
    border: 1px solid var(--border-light);
    border-left: 2px solid var(--primary-color);
}
.current-price { color: var(--accent) !important; font-weight: 600; font-size: 1.25rem; }
.original-price { font-size: .95rem; }
.discount-badge { padding: 3px 8px; border-radius: var(--pd-radius); font-weight: 600; font-size: .75rem; }

/* ==============================
   Product Attributes
============================== */
.product-attributes {
    background: var(--surface);
    padding: var(--pd-spacing-md);
    border-radius: var(--pd-radius);
    margin-bottom: var(--pd-spacing-lg);
    border: 1px solid var(--border-light);
}
.attribute-group { margin-bottom: var(--pd-spacing-lg); }
.attribute-group:last-child { margin-bottom: 0; }
.attribute-group label {
    color: var(--text-primary); font-weight: 600;
    margin-bottom: .3rem; display: block; font-size: .9rem;
}
.attribute-values { display: flex; flex-wrap: wrap; gap: 8px; }

.attribute-value-btn {
    border: 1px solid var(--border-light);
    background: var(--white); color: var(--text-primary);
    padding: 6px 10px; border-radius: var(--pd-radius);
    transition: var(--pd-transition); font-weight: 500;
    position: relative; overflow: hidden; font-size: .85rem;
}
.attribute-value-btn:hover {
    border-color: var(--primary-color); color: var(--primary-color);
}
.attribute-value-btn.active {
    background: var(--primary-color); border-color: var(--primary-color); color: var(--white);
}
.attribute-value-btn.out-of-stock { opacity: .55; cursor: not-allowed; }
.attribute-value-btn.out-of-stock::after {
    content:''; position:absolute; top:50%; left:0; right:0; height:2px;
    background: var(--danger-color); transform: translateY(-50%);
}

/* Reset Attributes */
#reset-attributes {
    background: var(--white);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
    transition: var(--pd-transition);
}
#reset-attributes:hover { background: var(--danger-color); border-color: var(--danger-color); color: var(--white); }

/* ==============================
   Quantity & Add to Cart
============================== */
.quantity-selector { margin-bottom: .75rem; }
.quantity-selector .input-group { max-width: 180px; }
.quantity-selector .btn,
.quantity-selector .form-control { border-radius: var(--pd-radius); }

/* Main buttons */
.btn-accent {
    background: var(--accent);
    color: var(--white) !important;
    border: 1px solid var(--accent);
    border-radius: var(--pd-radius);
    font-weight: 600;
    padding: 10px 16px;
    transition: all .2s ease;
}
.btn-accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn-ghost-secondary {
    background: var(--white);
    color: var(--secondary) !important;
    border: 1px solid var(--secondary);
    border-radius: var(--pd-radius);
    font-weight: 600;
    padding: 10px 16px;
    transition: all .2s ease;
}
.btn-ghost-secondary:hover {
    background: var(--secondary); color: var(--white) !important;
}
.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn-row .btn { min-height: 44px; }
#add-to-cart-btn:disabled, #buy-now-btn:disabled {
    opacity: .6; cursor: not-allowed; box-shadow: none !important; transform: none !important;
}

/* ==============================
   Stock Status
============================== */
.stock-status { display:flex; align-items:center; gap:8px; }
.stock-status .badge {
    font-size: .85rem; padding:.45rem .75rem;
    border-radius: 999px; font-weight:600; display:flex; align-items:center; gap:6px;
}

/* ==============================
   Product Details, Tabs, Table
============================== */
.product-details {
    background: var(--white);
    border-radius: var(--pd-radius);
    padding: 1rem;
    box-shadow: var(--pd-shadow-sm);
    margin-top: 1.25rem;
    border: 1px solid var(--border-light);
}

/* Breadcrumb */
.breadcrumb-compact {
    background: var(--white); border: 1px solid var(--border-light);
    border-radius: var(--pd-radius); padding: .5rem .75rem;
    box-shadow: var(--pd-shadow-sm);
}
.breadcrumb-compact .breadcrumb-item a { color: var(--text-primary); font-weight: 500; }
.breadcrumb-compact .breadcrumb-item.active { color: var(--text-primary); font-weight: 600; }

/* Tabs */
.tabs-slim {
    border: none; border-radius: var(--pd-radius) var(--pd-radius) 0 0;
    overflow: hidden; background: var(--primary-blue);
}
.tabs-slim .nav-link {
    color: rgba(255,255,255,.9); border: none;
    font-weight: 500; font-size: .85rem; padding: .625rem .875rem;
    transition: background .2s;
}
.tabs-slim .nav-link:hover { background: rgba(255,255,255,.1); }
.tabs-slim .nav-link.active { background: var(--accent-gold); color: var(--white); }

/* Content */
.content-compact { padding: .875rem 0; }
.section-title {
    font-size: .95rem; font-weight: 600;
    border-left: 2px solid var(--accent-gold);
    padding-left: .5rem; margin-bottom: .625rem;
    color: var(--text-primary);
}
.content-text { line-height: 1.6; font-size: .875rem; color: var(--text-secondary); }

/* Table */
.table-compact td { padding: .625rem; font-size: .85rem; }
.table-compact td.bg-light { width: 35%; font-weight: 600; }
.table-compact tr:hover { background: rgba(var(--accent-rgb),.03); }

/* ==============================
   Certificate Viewer
============================== */
.viewer-compact .pdf-controls,
.viewer-compact .image-controls {
    padding: .5rem .625rem;
    background: var(--surface);
    border-radius: var(--pd-radius);
    border: 1px solid var(--border-light);
}
.frame-slim { min-height: 400px; border-radius: var(--pd-radius); overflow: hidden; }
.pdf-frame { height: 400px; }

/* ==============================
   Animations
============================== */
/* Product Specifications in Gallery */
.product-specifications {
    border: 1px solid var(--border-light);
    border-radius: var(--pd-radius);
    background: var(--surface);
    padding: var(--pd-spacing-md);
}

.specifications-header h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.spec-table {
    font-size: 0.825rem;
}

.spec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--border-light);
}

.spec-row:last-child {
    border-bottom: none;
}

.spec-label {
    font-weight: 500;
    color: var(--text-secondary);
    flex: 0 0 40%;
}

.spec-value {
    font-weight: 500;
    color: var(--text-primary);
    text-align: right;
    flex: 1;
}

/* Expandable Content */
.expandable-content {
    position: relative;
    transition: max-height 0.3s ease-out;
}

.expandable-content.collapsed {
    overflow: hidden;
    position: relative;
}

.expand-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(transparent, var(--white));
    pointer-events: none;
    z-index: 1;
}

.expand-toggle {
    color: var(--accent) !important;
    font-weight: 600;
    border: none;
    background: transparent;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.expand-toggle:hover {
    color: var(--accent-hover) !important;
    text-decoration: none;
}

.expand-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.2);
    border-radius: 3px;
}

.expand-toggle i {
    transition: transform 0.3s ease;
    margin-right: 0.25rem;
}

/* Show expand text by default, hide collapse text */
.expand-toggle .expand-text {
    display: inline-flex;
    align-items: center;
}

.expand-toggle .collapse-text {
    display: none;
}

/* When expanded, hide expand text and show collapse text */
.expand-toggle.expanded .expand-text {
    display: none !important;
}

.expand-toggle.expanded .collapse-text {
    display: inline-flex !important;
    align-items: center;
}

.expand-toggle.expanded i {
    transform: rotate(180deg);
}

/* Tab content improvements */
.content-text {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.content-text img {
    max-width: 100%;
    height: auto;
}

.content-text table {
    width: 100%;
    table-layout: auto;
}

@media (max-width: 768px) {
    .expand-overlay {
        height: 40px;
    }

    .expand-toggle {
        font-size: 0.8rem;
    }
}

/* ==============================
   Responsive
============================== */
@media (max-width: 991.98px) {
    .product-info { position: static; margin-top: var(--pd-spacing-lg); padding: var(--pd-spacing-md); }
    .product-title { font-size: clamp(1.125rem, 4vw, 1.375rem); }
    .current-price { font-size: 1.125rem; }
    .spec-row { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
    .spec-label, .spec-value { text-align: left; flex: none; }
}
@media (max-width: 767.98px) {
    .product-details { padding: var(--pd-spacing-md); }
    .product-info { padding: var(--pd-spacing-md); }
    .add-to-cart-section { padding: var(--pd-spacing-md); }
    .attribute-values { gap: 4px; }
    .attribute-value-btn { padding: 5px 8px; font-size: .8rem; }
    .product-actions { justify-content: center; }
}
@media (max-width: 575.98px) {
    .product-price { flex-direction: column; align-items: flex-start; gap: 4px; }
    .current-price { font-size: 1.125rem; }
    .image-thumbnails { gap: 4px; }
    .thumbnail { width: 56px; height: 56px; }
    .btn-row .btn { flex: 1 1 100%; }
    .add-to-cart-section .row { flex-direction: column; }
}

