/* --- Single Sale Item 3-Column Layout (Premium Design) --- */

/* Grid Container */
.product-layout-container {
    display: grid;
    grid-template-columns: 1fr; /* Mobile default */
    gap: 30px;
    margin: 40px 0;
    align-items: start; /* Align columns to top, let them grow naturally */
}

/* Allow children to stretch without overflow cutting off content */
.product-layout-container > * {
    min-height: 0;
}

/* --- Columns --- */
.product-card-column {
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure full height */
}

.product-center-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100%; /* Ensure full height */
}

.product-graph-column {
    display: flex;
    flex-direction: column;
    height: 100%; /* Ensure full height */
}

/* --- Left Column: Product Card Adjustments --- */
.product-card-column .sale-item-card {
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    height: 100%; /* Fill parent column height (in 3-column stretch layout) */
}

.product-card-column .related-sale-item-card__image {
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px; /* Further reduced for tighter spacing */
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 1/1;
}

.product-card-column .related-sale-item-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card-column .related-sale-item-card__title {
    font-size: 1.4rem; /* Heading - Keep larger */
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 4px; /* Further reduced for tighter spacing */
    color: #1e293b;
}

.product-card-column .related-sale-item-card__maker {
    font-size: 1rem; /* Standardized to 1rem */
    color: #64748b;
    margin-bottom: 8px; /* Further reduced for tighter spacing */
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons in Left Column */
.product-card-column .product-sale-info-item {
    margin-top: auto; /* Push buttons to bottom of card */
}

.product-card-column .product-salepage-btn {
    width: 100%;
    justify-content: space-between;
    padding: 14px 20px;
    border-radius: 12px;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
    font-size: 1rem; /* Ensure button text is 1rem */
}

.product-card-column .product-salepage-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* --- Center Column Components --- */

/* Price Info Box */
.product-price-info-box {
    background: #ffffff !important; /* Force white background */
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1); /* Match card shadow */
    position: relative;
    overflow: hidden;
    flex: 0 0 auto; /* Don't stretch excessively, but take needed space */
    margin-bottom: 0; /* Gap handled by parent grid/flex gap */
}

/* .product-price-info-box::before {
    content: '';
    position: absolute;
    
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(to bottom, #3b82f6, #60a5fa);
} */

/* Price Info Box Title */
.product-price-info-box h3 {
    margin: 0 0 20px 0;
    font-size: 1.1rem; /* Heading - Keep slightly larger */
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-price-info-box h3::before {
    content: '#';
    color: #3b82f6;
    font-size: 1.2em;
}

.product-price-info-box dl {
    margin: 0;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px 24px;
    align-items: center;
}

.product-price-info-box dt {
    font-weight: 700;
    color: #64748b;
    font-size: 1rem; /* Standardized to 1rem */
    white-space: nowrap;
}

.product-price-info-box dd {
    margin: 0;
    color: #334155;
    font-size: 1rem; /* Standardized to 1rem */
    text-align: right;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

.product-price-info-box .price-value {
    font-size: 1.6rem; /* Value - Keep larger for emphasis */
    color: #ef4444;
    font-weight: 800;
}

/* Tag Box */
.product-tag-box {
    background: #ffffff !important; /* Force white background */
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1); /* Match card shadow */
    /* flex: 1 removed - let content determine height */
    display: flex;
    flex-direction: column;
}

.product-tag-box h3 {
    margin: 0 0 20px 0;
    font-size: 1.1rem; /* Heading - Keep slightly larger */
    font-weight: 800;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-tag-box h3::before {
    content: '#';
    color: #3b82f6;
    font-size: 1.2em;
}

.product-tag-group {
    margin-bottom: 20px;
}

.product-tag-group:last-child {
    margin-bottom: 0;
}

.product-tag-label {
    display: block;
    font-weight: 700;
    font-size: 1rem; /* Standardized to 1rem */
    color: #94a3b8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.product-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.product-tag-item {
    display: inline-flex;
    align-items: center;
    background: #f8fafc;
    color: #475569;
    font-size: 1rem; /* Standardized to 1rem */
    padding: 6px 12px;
    border-radius: 999px;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    font-weight: 500;
}

.product-tag-item:hover {
    background: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

/* --- Right Column: Graph --- */
.product-graph-column .price-history-graph-section {
    flex: 1; /* Use flex: 1 to fill the column height */
    border-radius: 20px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1); /* Match card shadow */
    background: #fff;
    padding: 24px;
    display: flex;
    flex-direction: column;
    height: 100%; /* Stretch to match tallest column on desktop */
    min-height: 0; /* Let parent decide the row height */
}

.product-graph-column h2 {
    font-size: 1.2rem; /* Heading - Keep larger */
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 20px;
    text-align: center;
}

#price-history-chart-placeholder {
    flex: 1;
    position: relative;
    width: 100%;
}

/* --- Responsive Breakpoints --- */
@media (min-width: 1024px) {
    .product-layout-container {
        grid-template-columns: repeat(3, minmax(0, 1fr)); /* Even columns */
        gap: 40px;
        align-items: stretch; /* ALL columns stretch to match the tallest (left or center) */
    }
    
    /* Let the graph inherit the tallest column height without enforcing its own */
    .product-graph-column .price-history-graph-section {
        min-height: 0;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .product-layout-container {
        grid-template-columns: repeat(2, minmax(0, 1fr)); /* Row 1: Left (Card) | Right (Price+Tags stack) */
        grid-template-rows: auto auto; /* Row 1: Card & Center | Row 2: Graph */
        gap: 24px;
        align-items: start; /* Natural height for 2-column layout */
    }
    
    .product-card-column {
        grid-column: 1; /* Left column */
        grid-row: 1;
    }
    
    .product-card-column .sale-item-card {
        height: auto; /* Natural height in 2-column layout */
    }
    
    .product-center-column {
        grid-column: 2; /* Right column */
        grid-row: 1;
        display: flex;
        flex-direction: column; /* Stack price info and tags vertically */
        gap: 24px;
        height: auto; /* Natural height */
    }
    
    .product-graph-column {
        grid-column: 1 / -1; /* Full width on second row */
        grid-row: 2;
        height: auto; /* Natural height */
    }
    
    .product-graph-column .price-history-graph-section {
        min-height: 320px; /* Comfortable tablet height */
        height: auto;
    }
}

@media (max-width: 767px) {
    .product-layout-container {
        gap: 24px;
        display: flex;
        flex-direction: column;
        align-items: stretch; /* Natural height - no stretching on mobile */
    }
    
    .product-card-column,
    .product-center-column,
    .product-graph-column {
        height: auto;
    }
    
    .product-card-column .sale-item-card {
        height: auto; /* Natural height on mobile */
    }
    
    .product-price-info-box dl {
        gap: 12px 16px;
    }
    
    .product-price-info-box .price-value {
        font-size: 1.4rem;
    }
    
    .product-graph-column .price-history-graph-section {
        min-height: 240px; /* Trimmed height for single-column stacking */
    }
}

/* --- Specificity bump to override legacy style-user rules loaded via deferred JS --- */
body.single-sale_item .product-layout-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    margin: 40px 0;
    align-items: start;
}

body.single-sale_item .product-card-column,
body.single-sale_item .product-center-column,
body.single-sale_item .product-graph-column {
    display: flex;
    flex-direction: column;
    height: 100%;
}

@media (min-width: 1024px) {
    body.single-sale_item .product-layout-container {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 40px;
        align-items: stretch;
    }
    body.single-sale_item .product-graph-column .price-history-graph-section {
        min-height: 0;
        height: 100%;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    body.single-sale_item .product-layout-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto auto;
        gap: 24px;
        align-items: start;
    }
    body.single-sale_item .product-card-column .sale-item-card {
        height: auto;
    }
    body.single-sale_item .product-center-column {
        display: flex;
        flex-direction: column;
        gap: 24px;
        height: auto;
    }
    body.single-sale_item .product-graph-column {
        grid-column: 1 / -1;
        grid-row: 2;
        height: auto;
    }
    body.single-sale_item .product-graph-column .price-history-graph-section {
        min-height: 320px;
        height: auto;
    }
}

@media (max-width: 767px) {
    body.single-sale_item .product-layout-container {
        display: flex;
        flex-direction: column;
        gap: 24px;
        align-items: stretch;
    }
    body.single-sale_item .product-card-column,
    body.single-sale_item .product-center-column,
    body.single-sale_item .product-graph-column {
        height: auto;
    }
    body.single-sale_item .product-graph-column .price-history-graph-section {
        min-height: 240px;
    }
}

/* --- Sale Item Comments --- */
.sale-item-comments {
    margin-top: 48px;
    padding: 32px;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    box-shadow: 0 12px 30px -18px rgba(15, 23, 42, 0.25);
    position: relative;
    overflow: hidden;
}

/* Unresolved Alert */
.sale-item-comments__alert {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    padding: 12px 18px;
    border-radius: 14px;
    margin-bottom: 24px;
    color: #9f1239;
    font-size: 0.95rem;
    animation: fadeInDown 0.5s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.sale-item-comments__alert-icon {
    font-size: 1.2rem;
}

.sale-item-comments__alert-text {
    flex: 1;
}

.sale-item-comments__alert-filter-btn {
    background: #ffffff;
    border: 1px solid #fda4af;
    color: #e11d48;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sale-item-comments__alert-filter-btn:hover {
    background: #ffe4e6;
    transform: translateY(-1px);
}

/* Header */
.sale-item-comments__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.sale-item-comments__title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sale-item-comments__title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 24px;
    background: #3b82f6;
    border-radius: 3px;
}

.sale-item-comments__summary-pills {
    display: flex;
    gap: 10px;
}

.summary-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #475569;
    box-shadow: 0 4px 10px -5px rgba(0,0,0,0.05);
}

.summary-pill__value {
    color: #0f172a;
    font-weight: 800;
}

.summary-pill__star {
    color: #f59e0b;
}

/* Form Wrapper */
.sale-item-comments__form-wrapper {
    margin-bottom: 32px;
}

/* Form Main Card */
.sale-item-comment-form {
    background: #ffffff;
    border-radius: 22px;
    border: 1px solid #e2e8f0;
    padding: 0; /* Padding handled by children */
    box-shadow: 0 10px 25px -18px rgba(15, 23, 42, 0.3);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sale-item-comment-form:focus-within {
    box-shadow: 0 15px 35px -15px rgba(59, 130, 246, 0.2);
    border-color: #bfdbfe;
}

/* Tabs */
.sale-item-comment-form__tabs {
    display: flex;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.sale-item-comment-form__tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.sale-item-comment-form__tab:hover {
    color: #3b82f6;
    background: #eef2ff;
}

.sale-item-comment-form__tab.is-active {
    color: #3b82f6;
    background: #ffffff;
    border-bottom-color: #3b82f6;
}

/* Form Panel */
.sale-item-comment-form__panel {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Rating Field */
.sale-item-comment-form__rating {
    display: flex;
    align-items: center;
    justify-content: center; /* Center stars */
    gap: 12px;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    padding: 10px;
    border-radius: 12px;
    transition: all 0.3s ease;
    opacity: 1;
    max-height: 100px;
}

.sale-item-comment-form__rating.is-hidden {
    opacity: 0;
    max-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
    border: none;
}

.sale-item-comment-form__label {
    font-weight: 700;
    color: #b45309;
    font-size: 0.9rem;
}

.sale-item-comment-form__stars {
    display: inline-flex;
    flex-direction: row-reverse;
    gap: 6px;
}

.sale-item-comment-form__stars input {
    display: none;
}

.sale-item-comment-form__stars label {
    color: #d1d5db; /* Gray default */
    font-size: 1.6rem;
    cursor: pointer;
    transition: transform 0.1s ease, color 0.1s ease;
    line-height: 1;
    margin: 0;
}

.sale-item-comment-form__stars label:hover,
.sale-item-comment-form__stars label:hover ~ label,
.sale-item-comment-form__stars input:checked ~ label {
    color: #f59e0b;
}

.sale-item-comment-form__stars label:active {
    transform: scale(0.9);
}

/* Chat Input Area */
.sale-item-comment-form__chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.sale-item-comment-form__chat:focus-within {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.sale-item-comment-form__chat textarea {
    border: none;
    background: transparent;
    padding: 4px; /* Reset padding */
    min-height: 80px;
    resize: none;
    font-size: 1rem;
    line-height: 1.6;
    width: 100%;
}

.sale-item-comment-form__chat textarea:focus {
    outline: none;
    box-shadow: none;
}

.sale-item-comment-form__chat-actions {
    display: flex;
    justify-content: flex-end;
}

.sale-item-comment-submit {
    background: #3b82f6;
    border: none;
    color: #ffffff;
    padding: 8px 20px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sale-item-comment-submit::after {
    content: '➤';
    font-size: 0.8em;
}

.sale-item-comment-submit:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

/* Overlay */
.sale-item-comment-form.is-locked .sale-item-comment-form__panel {
    /* pointer-events: none; removed to allow tab switching if needed, strictly locked by overlay */
    filter: blur(2px);
    opacity: 0.6;
}

.sale-item-comment-form__overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    /* justify-content: center;  Removed center to allow top alignment with padding */
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sale-item-comment-form.is-unlocked .sale-item-comment-form__overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sale-item-comment-form__overlay-card {
    background: #ffffff;
    width: 90%;
    max-width: 400px;
    padding: 30px 24px;
    border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.3);
    border: 1px solid #e2e8f0;
    text-align: center;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

.sale-item-comment-form.is-unlocked .sale-item-comment-form__overlay-card {
    transform: translateY(20px);
}

.sale-item-comment-form__overlay-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.sale-item-comment-form__overlay-card h4 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 800;
    color: #1e293b;
}

.sale-item-comment-form__overlay-card p {
    margin: 0 0 20px;
    color: #64748b;
    font-size: 0.95rem;
}

.sale-item-comment-form__overlay-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
    text-align: left;
}

body.single-sale_item .sale-item-comment-form__overlay-fields input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    font-size: 1rem;
    transition: all 0.2s ease;
}

body.single-sale_item .sale-item-comment-form__overlay-fields input:focus {
    background: #ffffff;
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

body.single-sale_item .sale-item-comment-form__overlay-button {
    width: 100%;
    background: #0f172a;
    color: #ffffff;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

body.single-sale_item .sale-item-comment-form__overlay-button:hover {
    background: #1e293b;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(15, 23, 42, 0.5);
}

body.single-sale_item .sale-item-comment-form__overlay-button:disabled {
    background: #94a3b8;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Comment List */
body.single-sale_item .sale-item-comments__list {
    margin-top: 40px;
}

/* Honeypot */
body.single-sale_item .sale-item-comment-form__hp {
    position: absolute;
    left: -9999px;
    height: 0;
    overflow: hidden;
}
    border: none;
    background: transparent;
}

body.single-sale_item .sale-item-comment-form__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body.single-sale_item .sale-item-comments__list {
    margin-top: 24px;
}

body.single-sale_item .sale-item-comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.single-sale_item .sale-item-comment {
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid #e2e8f0;
    padding: 18px;
    box-shadow: 0 10px 20px -18px rgba(15, 23, 42, 0.35);
}

body.single-sale_item .sale-item-comment__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #64748b;
}

body.single-sale_item .sale-item-comment__badge {
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    color: #ffffff;
}

body.single-sale_item .sale-item-comment__badge--review {
    background: #3b82f6;
}

body.single-sale_item .sale-item-comment__badge--question {
    background: #f97316;
}

body.single-sale_item .sale-item-comment__badge--comment {
    background: #94a3b8;
}

body.single-sale_item .sale-item-comment__author {
    font-weight: 700;
    color: #0f172a;
}

body.single-sale_item .sale-item-comment__content {
    color: #334155;
    line-height: 1.7;
}

body.single-sale_item .sale-item-comment__actions {
    margin-top: 12px;
}

body.single-sale_item .sale-item-comment__actions a {
    color: #3b82f6;
    font-weight: 700;
    text-decoration: none;
}

body.single-sale_item .sale-item-comments__pager {
    margin-top: 16px;
    text-align: center;
}

body.single-sale_item .sale-item-comments__empty,
body.single-sale_item .sale-item-comments__closed {
    text-align: center;
    color: #94a3b8;
    margin: 16px 0 0;
}

body.single-sale_item .ermu-star-rating {
    position: relative;
    display: inline-block;
    font-size: 1rem;
    line-height: 1;
}

body.single-sale_item .ermu-star-rating__bg,
body.single-sale_item .ermu-star-rating__fill {
    display: block;
    white-space: nowrap;
}

body.single-sale_item .ermu-star-rating__bg {
    color: #e2e8f0;
}

body.single-sale_item .ermu-star-rating__fill {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    color: #f59e0b;
}

body.single-sale_item .ermu-star-rating__value {
    margin-left: 6px;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.95rem;
}

@media (max-width: 767px) {
    body.single-sale_item .sale-item-comments {
        padding: 24px;
    }

    body.single-sale_item .sale-item-comments__summary {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}
