/**
 * product-popup.css
 * Shared product popup styling — used by /js/product-popup.js
 */

/* ============================================ */
/* POPUP OVERLAY & CONTAINER                    */
/* ============================================ */
.shared-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: sharedPopupFadeIn 0.25s ease;
}
.shared-popup-overlay.active { display: flex; }

@keyframes sharedPopupFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.shared-popup-content {
    background: var(--card-light);
    border-radius: 24px;
    max-width: 900px;
    width: 95%;
    height: 90vh;
    max-height: 90vh;
    overflow: hidden;
    position: relative;
    padding: 0;
    animation: sharedPopupSlideIn 0.3s ease;
    display: flex;
    flex-direction: column;
}
body.dark .shared-popup-content { background: var(--card-dark); }

@keyframes sharedPopupSlideIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.shared-popup-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    z-index: 5;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: inherit;
}
body.dark .shared-popup-close {
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.08);
}
.shared-popup-close:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.15);
}

/* ============================================ */
/* POPUP HEADER                                 */
/* ============================================ */
.shared-popup-header {
    text-align: center;
    padding: 32px 24px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
    background: var(--card-light);
}
body.dark .shared-popup-header {
    border-bottom-color: var(--border-dark);
    background: var(--card-dark);
}

.shared-popup-header img {
    max-width: 180px;
    max-height: 150px;
    object-fit: contain;
    display: block;
    margin: 0 auto 16px auto;
    border-radius: 12px;
}

.shared-popup-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-light);
}
body.dark .shared-popup-header h2 { color: var(--text-dark); }

.shared-popup-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    margin: 12px 0 4px 0;
}
body.dark .shared-popup-price { color: #60a5fa; }

/* Price note (under "From: $X") */
.shared-popup-price-note {
    font-size: 12px;
    color: #94a3b8;
    margin: 6px auto 0 auto;
    font-style: italic;
    letter-spacing: 0.2px;
    max-width: 460px;
    line-height: 1.5;
}
body.dark .shared-popup-price-note { color: #94a3b8; }

/* Condition badge */
.shared-popup-condition {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}
.shared-popup-condition-new {
    background: #dcfce7;
    color: #166534;
}
body.dark .shared-popup-condition-new {
    background: #052e16;
    color: #86efac;
}
.shared-popup-condition-refurbished {
    background: #fef3c7;
    color: #92400e;
}
body.dark .shared-popup-condition-refurbished {
    background: #451a03;
    color: #fcd34d;
}

/* ============================================ */
/* POPUP BODY                                   */
/* ============================================ */
.shared-popup-body {
    padding: 20px 32px 16px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scroll-behavior: smooth;
    background: var(--card-light);
}
body.dark .shared-popup-body { background: var(--card-dark); }

.shared-popup-body::-webkit-scrollbar { width: 4px; }
.shared-popup-body::-webkit-scrollbar-track { background: var(--bg-light); }
.shared-popup-body::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 4px; }
body.dark .shared-popup-body::-webkit-scrollbar-track { background: var(--bg-dark); }

/* ---- Specs sections ---- */
.specs-section {
    margin-bottom: 24px;
}
.specs-section h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border-light);
}
body.dark .specs-section h4 {
    color: #60a5fa;
    border-bottom-color: var(--border-dark);
}

.specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 24px;
    margin-bottom: 0;
}
@media (max-width: 768px) {
    .specs-grid { grid-template-columns: 1fr; }
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    gap: 12px;
}
body.dark .spec-item { border-bottom-color: var(--border-dark); }

.spec-label {
    font-weight: 600;
    color: var(--text-light);
    flex-shrink: 0;
}
body.dark .spec-label { color: var(--text-dark); }

.spec-value {
    color: #666;
    text-align: right;
    word-break: break-word;
}
body.dark .spec-value { color: #cbd5e1; }

/* ---- Overview paragraph ---- */
.shared-popup-body p {
    color: var(--text-light);
    line-height: 1.6;
    font-size: 14px;
}
body.dark .shared-popup-body p { color: var(--text-dark); }

/* ============================================ */
/* RETAILER TABS                                */
/* ============================================ */
.retailer-tabs-container {
    margin: 16px 0 12px 0;
}
.retailer-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-light);
    overflow-x: auto;
    scrollbar-width: none;
}
body.dark .retailer-tabs { border-bottom-color: var(--border-dark); }
.retailer-tabs::-webkit-scrollbar { display: none; }

.retailer-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.25s ease;
    white-space: nowrap;
    font-family: inherit;
}
body.dark .retailer-tab { color: #94a3b8; }
.retailer-tab:hover { color: var(--primary); }
.retailer-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
body.dark .retailer-tab.active {
    color: #60a5fa;
    border-bottom-color: #60a5fa;
}
.retailer-tab .retailer-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 4px;
}
.retailer-tab .retailer-badge {
    font-size: 10px;
    background: #dcfce7;
    color: #166534;
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 600;
}
body.dark .retailer-tab .retailer-badge {
    background: #052e16;
    color: #86efac;
}
.retailer-tab .retailer-badge.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}
body.dark .retailer-tab .retailer-badge.out-of-stock {
    background: #450a0a;
    color: #fca5a5;
}

.retailer-panels { margin-top: 8px; }
.retailer-panel { display: none; }
.retailer-panel.active { display: block; animation: sharedPopupFadeIn 0.3s ease; }

.retailer-panel .variant-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}
.retailer-panel .variant-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border: 2px solid var(--border-light);
    border-radius: 10px;
    transition: all 0.3s ease;
    gap: 12px;
    flex-wrap: wrap;
    cursor: pointer;
    position: relative;
    background: var(--card-light);
}
body.dark .retailer-panel .variant-item {
    border-color: var(--border-dark);
    background: var(--card-dark);
}
.retailer-panel .variant-item:hover {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}
body.dark .retailer-panel .variant-item:hover { background: rgba(59, 130, 246, 0.08); }
.retailer-panel .variant-item.active {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.08);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
body.dark .retailer-panel .variant-item.active {
    background: rgba(59, 130, 246, 0.12);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.retailer-panel .variant-item .variant-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}
.retailer-panel .variant-item .variant-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-light);
}
body.dark .retailer-panel .variant-item .variant-name { color: var(--text-dark); }
.retailer-panel .variant-item .variant-specs {
    display: flex;
    gap: 6px;
    font-size: 12px;
    color: #94a3b8;
    flex-wrap: wrap;
}
.retailer-panel .variant-item .variant-specs .spec-tag {
    background: #f1f5f9;
    padding: 2px 10px;
    border-radius: 12px;
    color: #475569;
}
body.dark .retailer-panel .variant-item .variant-specs .spec-tag {
    background: #1e293b;
    color: #cbd5e1;
}
.retailer-panel .variant-item .variant-price {
    font-weight: 700;
    font-size: 16px;
    color: var(--primary);
}
body.dark .retailer-panel .variant-item .variant-price { color: #60a5fa; }

/* ---- Buy button inside retailer variant ---- */
.retailer-panel .variant-item .btn-buy-variant {
    padding: 10px 24px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
    border: none;
    border-radius: 8px;
    color: #1a1a2e;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.35);
    letter-spacing: 0.3px;
}
.retailer-panel .variant-item .btn-buy-variant:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.45);
    background: linear-gradient(135deg, #fcd34d, #f59e0b, #b45309);
}
.retailer-panel .variant-item .btn-buy-variant .btn-icon { font-size: 16px; }
.retailer-panel .variant-item .btn-buy-variant.out-of-stock-btn {
    background: linear-gradient(135deg, #64748b, #475569);
    box-shadow: 0 2px 8px rgba(100, 116, 139, 0.35);
    color: #fff;
}
.retailer-panel .variant-item .btn-buy-variant.out-of-stock-btn:hover {
    background: linear-gradient(135deg, #475569, #334155);
}

.retailer-panel .variant-item .availability-note {
    display: block;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 6px;
    font-style: italic;
}
body.dark .retailer-panel .variant-item .availability-note { color: #94a3b8; }

.retailer-panel .no-variants-msg {
    padding: 20px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}

/* ============================================ */
/* "Currently viewing:" label                   */
/* ============================================ */
.shared-selected-variant-label {
    font-size: 13px;
    color: #64748b;
    text-align: center;
    margin: 12px 0 16px 0;
    padding: 8px 12px;
    background: #f1f5f9;
    border-radius: 8px;
    display: block;
    width: 100%;
    box-sizing: border-box;
}
body.dark .shared-selected-variant-label {
    background: #1e293b;
    color: #cbd5e1;
}
.shared-selected-variant-label strong {
    color: var(--primary);
    font-weight: 700;
}
body.dark .shared-selected-variant-label strong { color: #60a5fa; }

/* ============================================ */
/* Category badges                              */
/* ============================================ */
.shared-category-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.shared-category-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #fff;
}
.shared-category-badge-work        { background: #3b82f6; }
.shared-category-badge-gaming      { background: #ef4444; }
.shared-category-badge-budget      { background: #f59e0b; color: #1e293b; }
.shared-category-badge-ultraportable { background: #8b5cf6; }
.shared-category-badge-school      { background: #10b981; }
.shared-category-badge-office      { background: #06b6d4; }
.shared-category-badge-creative    { background: #ec4899; }
.shared-category-badge-photography { background: #f97316; }
.shared-category-badge-premium     { background: #8b5cf6; }
.shared-category-badge-rugged      { background: #92400e; }
.shared-category-badge-media       { background: #06b6d4; }

/* ============================================ */
/* POPUP FOOTER                                 */
/* ============================================ */
.shared-popup-footer {
    padding: 16px 32px 24px;
    border-top: 1px solid var(--border-light);
    text-align: center;
    background: var(--bg-light);
    flex-shrink: 0;
}
body.dark .shared-popup-footer {
    border-top-color: var(--border-dark);
    background: var(--bg-dark);
}

.btn-track-price-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: #2563eb;
    border: 1px solid #2563eb;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
    cursor: pointer;
    font-family: inherit;
}
.btn-track-price-modal:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.btn-track-price-modal .bell-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    flex-shrink: 0;
}
body.dark .btn-track-price-modal {
    background: #3b82f6;
    border-color: #3b82f6;
}
body.dark .btn-track-price-modal:hover {
    background: #2563eb;
    border-color: #2563eb;
}

/* Footer Track Price section */
.shared-popup-track-section {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}
.shared-popup-track-title {
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    text-align: center;
}
body.dark .shared-popup-track-title { color: #94a3b8; }
.shared-popup-track-trust {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
    text-align: center;
    font-style: italic;
    line-height: 1.4;
}
body.dark .shared-popup-track-trust { color: #64748b; }
.shared-popup-track-section .btn-track-price-modal {
    width: 100%;
}

/* ============================================
   MOBILE
   ============================================ */
@media (max-width: 768px) {
    .shared-popup-content {
        max-width: 98%;
        width: 98%;
        border-radius: 16px;
        height: 95vh;
        max-height: 95vh;
    }
    .shared-popup-header { padding: 20px 16px 12px; }
    .shared-popup-header img { max-width: 120px; max-height: 100px; }
    .shared-popup-header h2 { font-size: 18px; }
    .shared-popup-price { font-size: 18px; }
    .shared-popup-body { padding: 12px 16px; }
    .shared-popup-footer { padding: 12px 16px 16px; }
    .retailer-tab { padding: 8px 12px; font-size: 12px; }
    .retailer-tab .retailer-icon { width: 18px; height: 18px; }
    .retailer-panel .variant-item {
        flex-direction: column;
        align-items: stretch;
    }
    .retailer-panel .variant-item .btn-buy-variant {
        width: 100%;
        justify-content: center;
    }
}

/* Footer actions: Track Price + View Full Specs side by side */
.shared-popup-footer-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: stretch;
    flex-wrap: wrap;
    margin-bottom: 8px;
}
.shared-popup-footer-actions .btn-track-price-modal {
    margin: 0;
    flex: 1 1 auto;
    min-width: 160px;
}

/* View Full Specs button (mirrors .btn-track-price-modal style but outlined) */
.btn-view-full-specs-modal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 10px;
    border: 2px solid var(--primary, #2563eb);
    background: transparent;
    color: var(--primary, #2563eb);
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1 1 auto;
    min-width: 160px;
}
.btn-view-full-specs-modal:hover {
    background: var(--primary, #2563eb);
    color: white;
    transform: translateY(-1px);
}

body.dark .btn-view-full-specs-modal {
    color: #60a5fa;
    border-color: #60a5fa;
}
body.dark .btn-view-full-specs-modal:hover {
    background: #60a5fa;
    color: #0f172a;
}