    /* Left-align quick stats and make like button rounded on mobile */
    .specs-key-info .quick-stats {
        align-items: center;
        text-align: left !important;
        padding-left: 0 !important;
    }
    .specs-key-info .quick-stats .stat-item {
        text-align: left !important;
        font-size: 1rem !important;
        font-weight: 500;
        padding: 0.2rem 0 0.2rem 3.3rem !important;
        margin: 0 !important;
    }
    .like-button {
        border-radius: 24px !important;
        background: #f1f3f5 !important;
        width: auto !important;
        min-width: 44px;
        display: flex;
        align-items: center;
        padding: 0.4rem 1rem !important;
        margin-bottom: 0.5rem !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    }
    .like-button svg {
        margin-right: 0.5rem;
    }
/* === Main Layout Grid === */
.detail-page-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    grid-template-areas:
        "sidebar main"
        "comments comments";
    gap: 2rem;
    max-width: 100%;
    margin: 2rem auto;
    padding: 0 1rem;
    overflow-x: hidden;
    box-sizing: border-box;
    width: 100%;
}

.detail-sidebar { grid-area: sidebar; }
.detail-main-content { 
    grid-area: main;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden; /* Prevent children from causing overflow */
}

/* Add data-product-type attribute to the main content div */
.detail-main-content[data-product-type] {
    width: 100%;
}
.detail-comments-section { grid-area: comments; grid-column: 1 / -1; }

/* === Sidebar Styles === */
.sidebar-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 1px solid #e9ecef;
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #343a40;
}

.related-devices-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    overflow-x: hidden; /* For mobile scrolling */
}

.related-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 0.85rem;
    color: #495057;
    text-decoration: none;
    transition: transform 0.2s;
    flex: 0 0 auto; /* For mobile scrolling */
}
.related-item:hover { transform: translateY(-3px); }
.related-item img {
    width: 100%;
    height: 70px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    background: #fff;
    border-radius: 8px;
    padding: 5px;
}

.popular-scroller {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding-bottom: 1rem; /* For scrollbar */
}
.popular-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-size: 0.85rem;
    color: #495057;
    text-decoration: none;
    flex: 0 0 100px; /* Fixed width for items */
}
.popular-item img {
    width: 100px;
    height: 70px;
    object-fit: contain;
    margin-bottom: 0.5rem;
    background: #fff;
    border-radius: 8px;
}

/* === Main Specs Card === */
.specs-card {
    display: flex;
    gap: 2rem;
    background: linear-gradient(100deg, #ffffff 40%, #27c5a1 100%);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

.specs-hero-image {
    flex: 0 0 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.specs-hero-image img {
    width: 100%;
    height: auto;
    object-fit: contain;
}

.specs-key-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.key-specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.spec-item {
    min-width: 0;
    overflow-wrap: break-word;
}

.spec-item .spec-label {
    font-size: 0.8rem;
    color: #fd9904; /* Lighter for dark background */
    display: block;
    margin-bottom: 0.25rem;
    word-break: break-word;
}
.spec-item .spec-value {
    font-size: 0.95rem;
    font-weight: 400;
    color: #000000; /* White for dark background */
    word-break: break-word;
    overflow-wrap: break-word;
}

.quick-stats {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
    justify-content: flex-start;
}
.stat-item { font-size: 0.9rem; color: #000000; }

.like-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.like-button:hover { background: #e9ecef; }
.like-button svg { color: #868e96; }
.like-button.liked svg { color: #e5383b; }
/* === Comments Section === */
.specs-table {
    margin-top: 2rem;
    max-width: 400px; /* Default full width */
    margin-left: 50px;
    margin-right: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative; /* For future absolute-positioned ads */
    width: 100%;
}

/* Half width specs for PC pages only */
[data-product-type="pc"] .specs-table {
    max-width: 50%;
}

.spec-category {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
    box-sizing: border-box;
    width: 100%;
    max-height: fit-content;
    overflow: visible;
}

/* Ensure all spec cards have consistent height on PC page */
[data-product-type="pc"] .spec-category {
    min-height: auto;
    height: auto;
}

.spec-category-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: #007bff;
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e9ecef;
}

.spec-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f3f5;
    font-size: 0.95rem;
    box-sizing: border-box;
}
.spec-row:last-child {
    border-bottom: none;
}

.spec-row .spec-label {
    font-weight: 500;
    color: #495057;
}

/* === Comments Section === */
.detail-comments-section {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    margin-top: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}
.comments-title {
    margin-top: 0;
    font-size: 1.5rem;
}

.comment-form-container textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #ced4da;
    font-family: inherit;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.comment-form-actions {
    display: flex;
    justify-content: flex-end;
}
.post-button {
    background: #27c5a1;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}
.post-button:hover { background: #0056b3; }

.login-prompt {
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

.comments-list {
    margin-top: 2rem;
}
.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid #e9ecef;
}
.comment-item:last-child { border-bottom: none; }
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.comment-author {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.comment-date {
    font-size: 0.8rem;
    color: #6c757d;
}
.comment-body {
    margin: 0.5rem 0;
    line-height: 1.6;
}
.comment-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.comment-reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: #6c757d;
    transition: all 0.2s;
}
.comment-reaction-btn:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}
.comment-reaction-btn.active,
.comment-reaction-btn.like-btn.active {
    color: #e74c3c;
    border-color: #e74c3c;
}
.comment-reaction-btn.dislike-btn.active {
    color: #6c757d;
    border-color: #6c757d;
}
.comment-reaction-btn svg {
    width: 14px;
    height: 14px;
}
.reply-btn {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    transition: color 0.2s;
}
.reply-btn:hover {
    color: #0056b3;
    text-decoration: underline;
}
.reply-form {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}
.reply-textarea {
    width: 100%;
    min-height: 60px;
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid #ced4da;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    resize: vertical;
}
.reply-form-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.post-reply-btn,
.cancel-reply-btn {
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
}
.post-reply-btn {
    background: #007bff;
    color: white;
}
.post-reply-btn:hover {
    background: #0056b3;
}
.cancel-reply-btn {
    background: #6c757d;
    color: white;
}
.cancel-reply-btn:hover {
    background: #5a6268;
}
.replies-container {
    margin-left: 2rem;
    margin-top: 1rem;
    padding-left: 1rem;
    border-left: 2px solid #e9ecef;
}
.reply-item {
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
}
.reply-item .comment-header {
    margin-bottom: 0.25rem;
}
.reply-item .comment-body {
    margin-top: 0.25rem;
}
.reply-item .comment-reaction-btn svg {
    width: 12px;
    height: 12px;
}

/* === Responsive Styles === */
@media (max-width: 992px) {
    .detail-page-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "main"
            "sidebar"
            "comments";
        padding: 1rem;
    }

    .detail-sidebar {
        max-width: 600px;
        margin: 0 auto;
    }

    .specs-table {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        width: 100%;
        box-sizing: border-box;
    }

    .spec-category {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .specs-card {
        flex-direction: column;
        padding: 1.2rem;
        background: linear-gradient(180deg, #ffffff 0%, #27c5a1 300%);
        margin-bottom: 1rem;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        align-items: stretch;
        border-radius: 16px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.05);
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
    }
        /* Force all hero card footers to stack vertically and span full width */
        .specs-key-info .hero-links,
        .specs-key-info .links,
        .specs-key-info .actions,
        .specs-key-info .quick-stats {
            display: flex !important;
            flex-direction: column !important;
            align-items: flex-start !important;
            gap: 0.5rem !important;
            margin-top: 1.2rem !important;
            margin-bottom: 0 !important;
            width: 100% !important;
            box-sizing: border-box;
        }
        .specs-key-info .quick-stats {
            padding: 0 !important;
            border: none !important;
            grid-template-columns: none !important;
        }
        .specs-key-info .hero-links a,
        .specs-key-info .links a,
        .specs-key-info .actions a {
            margin: 0 !important;
            padding: 0.3rem 0.5rem !important;
            font-size: 1rem !important;
            width: auto;
            min-width: 0;
            text-align: left;
            display: block;
        }
        /* Remove any float or inline styles from stats/actions */
        .specs-key-info .actions > *,
        .specs-key-info .quick-stats > * {
            width: 100% !important;
            margin: 0 !important;
            box-sizing: border-box;
        }
    /* Ensure hero card links are left-aligned and spaced */
    .specs-key-info .hero-links, .specs-key-info .links, .specs-key-info .actions {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.5rem !important;
        margin-top: 1.2rem !important;
        margin-bottom: 0 !important;
        width: 100%;
    }
    .specs-key-info .hero-links a, .specs-key-info .links a, .specs-key-info .actions a {
        margin: 0 !important;
        padding: 0.3rem 0.5rem !important;
        font-size: 1rem !important;
        width: auto;
        min-width: 0;
        text-align: left;
    }

    .specs-key-info {
        min-height: auto;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        margin-top: 1.2rem;
        align-items: flex-start;
    }

    .specs-hero-image {
        width: 100%;
        max-width: 180px;
        margin: 0 auto 1.2rem auto;
        display: flex;
        justify-content: center;
        align-items: center;
        position: relative;
        z-index: 1;
        overflow-x: hidden;
    }

    .key-specs-grid {
        grid-template-columns: 1fr;
        gap: 0.7rem;
        position: relative;
        z-index: 1;
        width: 100%;
    }

    .spec-item .spec-label {
        font-size: 0.85rem;
        margin-bottom: 0.15rem;
        color: #007bff;
        font-weight: 600;
    }

    .spec-item .spec-value {
        font-size: 1rem;
        color: #222;
        font-weight: 500;
    }

    .specs-key-info h1, .specs-key-info h2, .specs-key-info h3 {
        font-size: 1.2rem;
        margin-bottom: 0.7rem;
        word-break: break-word;
    }

    /* Convert grid layouts to horizontal scroll on mobile */
    .related-devices-grid,
    .sidebar-card > div:not(.sidebar-title) {
        display: flex;
        overflow-x: auto;
        gap: 1rem;
        padding: 0.5rem 0.2rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        scroll-snap-type: x mandatory;
    }

    .related-devices-grid::-webkit-scrollbar,
    .sidebar-card > div:not(.sidebar-title)::-webkit-scrollbar {
        display: none;
    }

    .related-item,
    .sidebar-card .item {
        flex: 0 0 140px;
        scroll-snap-align: start;
    }

    .spec-row {
        grid-template-columns: 1fr;
        gap: 0.3rem;
        padding: 0.8rem 0;
        overflow-x: hidden;
    }

    .spec-row .spec-label {
        font-size: 0.9rem;
        color: #fd9904;
    }

    .spec-row .spec-value {
        font-size: 1rem;
        padding-left: 0.5rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .spec-category {
        overflow-x: hidden;
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .spec-category-title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .detail-comments-section {
        padding: 1.2rem;
        margin-top: 1rem;
        width: 100%;
        box-sizing: border-box;
    }

    .comments-title {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .comment-form-container textarea {
        min-height: 60px;
        font-size: 0.9rem;
        padding: 0.6rem;
    }

    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .comment-actions {
        flex-wrap: wrap;
        gap: 0.4rem;
        width: 100%;
    }

    .comment-reaction-btn {
        flex: 1;
        min-width: 70px;
        justify-content: center;
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .reply-btn {
        flex: 1;
        min-width: 70px;
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }

    .replies-container {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        margin-top: 0.5rem;
    }

    .reply-item {
        padding: 0.5rem 0;
        margin-bottom: 0.25rem;
    }

    .quick-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.7rem;
        padding: 1rem 0;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .stat-item {
        text-align: center;
        min-width: 100%;
    }

    .comments-section {
        padding: 1rem;
    }

    .comment-form-container {
        padding: 1rem;
    }

    .related-devices-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 0.8rem;
    }

    .related-item img {
        height: 60px;
    }

    .popular-scroller {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .popular-scroller::-webkit-scrollbar {
        display: none;
    }

    .specs-table {
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        padding: 0;
        width: 100%;
        box-sizing: border-box;
    }

    [data-product-type="pc"] .specs-table {
        max-width: 100%;
    }
}

/* Additional mobile fixes to prevent horizontal overflow and ensure hero card stacks cleanly */
@media (max-width: 768px) {
    .specs-card {
        overflow-x: hidden; /* ensure no horizontal scroll */
        gap: 1rem;
        align-items: flex-start;
    }

    /* Allow flex children to shrink to avoid forcing width */
    .specs-card > *,
    .specs-card * {
        min-width: 0;
        box-sizing: border-box;
    }

    .specs-hero-image {
        max-width: 160px;
        margin-bottom: 1rem;
    }

    .specs-hero-image img {
        max-width: 100%;
        height: auto;
        display: block;
    }

    /* Make key specs stack and wrap cleanly */
    .key-specs-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }

    /* Ensure specs table and categories never exceed viewport width */
    .specs-table,
    .spec-category {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}