/* ══════════════════════════════════════════════════════════════════════════════
   Store Addon — store.css
   Full light/dark theme support. Uses the same palette as the main site.
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── Page Layout ──────────────────────────────────────────────────────────── */
.store-page {
    padding: 40px 0 60px;
    min-height: 60vh;
}

.store-page-header {
    text-align: center;
    margin-bottom: 40px;
}

.store-page-title {
    font-size: 2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgb(220, 211, 202);
    margin-bottom: 8px;
}

.store-page-subtitle {
    color: rgb(140, 160, 130);
    font-size: 0.95rem;
    letter-spacing: 1px;
}

/* ── Category Tabs ────────────────────────────────────────────────────────── */
.store-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 36px;
}

.store-tab {
    padding: 8px 22px;
    border-radius: 2px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    border: 1px solid rgba(100, 160, 80, 0.3);
    background: rgba(10, 20, 10, 0.55);
    color: rgb(140, 180, 110);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    user-select: none;
}

.store-tab:hover {
    background: rgba(60, 120, 40, 0.25);
    border-color: rgba(100, 160, 80, 0.6);
    color: rgb(180, 210, 140);
}

.store-tab.active {
    background: rgba(60, 120, 40, 0.4);
    border-color: rgba(100, 180, 80, 0.7);
    color: rgb(200, 230, 150);
}

/* ── Product Grid ─────────────────────────────────────────────────────────── */
.store-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* ── Product Card ─────────────────────────────────────────────────────────── */
.store-card {
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(60, 120, 60, 0.3);
    background: rgba(14, 22, 14, 0.85);
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.15s;
}

.store-card:hover {
    border-color: rgba(100, 170, 80, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.store-card-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    display: block;
    background: rgba(20, 30, 20, 0.8);
    padding: 8px;
}

.store-card-img-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: rgba(20, 30, 20, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.store-card-img-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.25;
    color: rgb(140, 180, 110);
}

.store-card-body {
    padding: 16px 16px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.store-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: rgb(210, 220, 195);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.store-card-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 2px 7px;
    border-radius: 2px;
    background: rgba(60, 140, 60, 0.25);
    border: 1px solid rgba(80, 160, 60, 0.4);
    color: rgb(140, 210, 100);
}

.store-card-sub-badge {
    font-size: 0.75rem;
    color: rgb(130, 155, 115);
    font-weight: 400;
}

.btn-store-details {
    width: 100%;
    padding: 6px 12px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 2px;
    border: 1px solid rgba(80, 140, 60, 0.3);
    background: transparent;
    color: rgb(120, 160, 90);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-align: center;
    margin-top: 4px;
}

.btn-store-details:hover {
    background: rgba(60, 120, 40, 0.2);
    border-color: rgba(100, 170, 70, 0.5);
    color: rgb(160, 210, 110);
}

.store-card-footer {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid rgba(60, 100, 40, 0.25);
    gap: 10px;
}

.store-card-price {
    font-size: 1.05rem;
    font-weight: 700;
    color: rgb(180, 220, 130);
}

.store-card-price .original {
    font-size: 0.8rem;
    color: rgb(110, 130, 100);
    text-decoration: line-through;
    margin-right: 4px;
    font-weight: 400;
}

.store-card-price .free {
    color: rgb(100, 200, 120);
}

.store-card-out-of-stock {
    font-size: 0.78rem;
    color: rgb(180, 90, 70);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-store-buy {
    padding: 7px 16px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 2px;
    border: 1px solid rgba(100, 180, 80, 0.55);
    background: rgba(10, 20, 10, 0.7);
    color: rgb(160, 210, 100);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.btn-store-buy:hover:not(:disabled) {
    background: rgba(60, 120, 40, 0.4);
    border-color: rgba(130, 200, 80, 0.75);
    color: rgb(190, 230, 130);
}

.btn-store-buy:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ── Loading / Error / Empty States ─────────────────────────────────────────── */
.store-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: rgb(130, 150, 115);
}

.store-state svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    display: block;
    opacity: 0.4;
}

.store-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(100, 160, 80, 0.15);
    border-top-color: rgb(140, 200, 100);
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.store-error-msg {
    color: rgb(200, 110, 90);
    font-size: 0.9rem;
}

.store-no-config {
    max-width: 520px;
    margin: 0 auto;
    padding: 36px 28px;
    border: 1px dashed rgba(100, 160, 80, 0.3);
    border-radius: 6px;
    text-align: center;
}

.store-no-config h3 {
    color: rgb(200, 210, 185);
    margin-bottom: 12px;
}

.store-no-config p {
    color: rgb(140, 155, 125);
    font-size: 0.9rem;
    line-height: 1.6;
}

.store-no-config code {
    background: rgba(20, 35, 20, 0.8);
    border: 1px solid rgba(80, 120, 60, 0.4);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.85em;
    color: rgb(160, 210, 120);
}

/* ── Overlay (checkout / full store embed) ─────────────────────────────────── */
.store-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.82);
    align-items: center;
    justify-content: center;
}

.store-overlay.open {
    display: flex;
}

.store-overlay-inner {
    width: min(960px, 96vw);
    height: min(760px, 92vh);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    background: #0d1a0d;
    border: 1px solid rgba(80, 140, 60, 0.35);
}

.store-overlay-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(10, 20, 10, 0.95);
    border-bottom: 1px solid rgba(80, 140, 60, 0.25);
    flex-shrink: 0;
}

.store-overlay-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgb(160, 190, 130);
}

.store-overlay-close {
    background: none;
    border: none;
    cursor: pointer;
    color: rgb(160, 180, 140);
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 3px;
    transition: color 0.15s;
}

.store-overlay-close:hover { color: rgb(210, 100, 80); }
.store-overlay-close svg { width: 20px; height: 20px; }

.store-overlay iframe {
    flex: 1;
    width: 100%;
    border: none;
}

.store-overlay-loading {
    position: absolute;
    inset: 48px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0d1a0d;
    flex-direction: column;
    gap: 12px;
    color: rgb(140, 170, 110);
    font-size: 0.9rem;
}

/* ── "External" fallback link inside overlay ─────────────────────────────── */
.store-overlay-fallback {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 14px;
    height: 100%;
    padding: 40px;
    color: rgb(150, 170, 130);
}

.store-overlay-fallback a {
    color: rgb(160, 210, 100);
    font-weight: 700;
    text-decoration: underline;
}


/* ══════════════════════════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES
   ══════════════════════════════════════════════════════════════════════════════ */

[data-theme="light"] .store-page-title {
    color: #1a2a1a;
}

[data-theme="light"] .store-page-subtitle {
    color: #4a6a3a;
}

[data-theme="light"] .store-tab {
    border-color: rgba(60, 110, 50, 0.4);
    background: rgba(220, 238, 210, 0.6);
    color: #2a5a20;
}

[data-theme="light"] .store-tab:hover {
    background: rgba(180, 220, 160, 0.6);
    border-color: rgba(60, 130, 50, 0.7);
    color: #1a4010;
}

[data-theme="light"] .store-tab.active {
    background: rgba(140, 200, 100, 0.35);
    border-color: rgba(60, 150, 50, 0.8);
    color: #0e300a;
}

[data-theme="light"] .store-card {
    background: #f4faf4;
    border-color: #b0ccb0;
}

[data-theme="light"] .store-card:hover {
    border-color: #7ab47a;
    box-shadow: 0 6px 24px rgba(60, 120, 60, 0.12);
}

[data-theme="light"] .store-card-img-placeholder {
    background: #e8f4e8;
}

[data-theme="light"] .store-card-img-placeholder svg {
    color: #6a9a6a;
}

[data-theme="light"] .store-card-name {
    color: #1a2a1a;
}

[data-theme="light"] .btn-store-details {
    border-color: rgba(60, 110, 50, 0.35);
    color: #3a6a28;
}

[data-theme="light"] .btn-store-details:hover {
    background: rgba(100, 160, 70, 0.12);
    color: #1a4010;
}

[data-theme="light"] .store-card-footer {
    border-top-color: rgba(90, 140, 80, 0.2);
}

[data-theme="light"] .store-card-price {
    color: #2a6a1a;
}

[data-theme="light"] .store-card-price .original {
    color: #8a9a80;
}

[data-theme="light"] .btn-store-buy {
    background: transparent;
    border-color: rgba(50, 110, 50, 0.6);
    color: #2a5a1a;
}

[data-theme="light"] .btn-store-buy:hover:not(:disabled) {
    background: rgba(80, 140, 60, 0.15);
    border-color: rgba(50, 130, 50, 0.8);
    color: #1a4010;
}

[data-theme="light"] .store-state {
    color: #5a7a50;
}

[data-theme="light"] .store-no-config {
    border-color: rgba(80, 140, 60, 0.4);
}

[data-theme="light"] .store-no-config h3 {
    color: #1a2a1a;
}

[data-theme="light"] .store-no-config p {
    color: #4a6040;
}

[data-theme="light"] .store-no-config code {
    background: #e8f4e8;
    border-color: rgba(80, 140, 60, 0.4);
    color: #2a5a1a;
}

[data-theme="light"] .store-error-msg {
    color: rgb(160, 60, 50);
}

[data-theme="light"] .store-overlay-inner {
    background: #f4faf4;
    border-color: rgba(80, 140, 60, 0.35);
}

[data-theme="light"] .store-overlay-bar {
    background: #e8f4e8;
    border-bottom-color: rgba(80, 140, 60, 0.3);
}

[data-theme="light"] .store-overlay-title {
    color: #2a4a20;
}

[data-theme="light"] .store-overlay-loading {
    background: #f4faf4;
    color: #3a5a30;
}

/* ══════════════════════════════════════════════════════════════════════════════
   Product Detail Modal
   ══════════════════════════════════════════════════════════════════════════════ */

.store-detail-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0, 0, 0, 0.82);
    align-items: flex-start;
    justify-content: center;
    padding: 20px 16px 40px;
    overflow-y: auto;
}

.store-detail-overlay.open {
    display: flex;
}

.store-detail-modal {
    width: min(820px, 100%);
    border-radius: 8px;
    background: #0f1c0f;
    border: 1px solid rgba(80, 140, 60, 0.35);
    overflow: hidden;
    margin: auto;
    position: relative;
}

/* ── Modal header bar ──────────────────────────────────────────────────────── */
.store-detail-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: rgba(10, 20, 10, 0.95);
    border-bottom: 1px solid rgba(80, 140, 60, 0.2);
}

.store-detail-bar-title {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgb(150, 180, 120);
}

.store-detail-close {
    background: none;
    border: none;
    cursor: pointer;
    color: rgb(150, 170, 130);
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 3px;
    transition: color 0.15s;
}

.store-detail-close:hover { color: rgb(210, 90, 70); }
.store-detail-close svg { width: 20px; height: 20px; }

/* ── Modal body ────────────────────────────────────────────────────────────── */
.store-detail-body {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 0;
}

@media (max-width: 600px) {
    .store-detail-body {
        grid-template-columns: 1fr;
    }
}

/* Left: image + price/buy */
.store-detail-left {
    padding: 24px 20px;
    border-right: 1px solid rgba(80, 140, 60, 0.15);
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(8, 16, 8, 0.5);
}

.store-detail-img {
    width: 100%;
    border-radius: 4px;
    display: block;
    object-fit: contain;
    background: rgba(20, 35, 20, 0.6);
}

.store-detail-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgb(210, 225, 190);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Purchase type toggle */
.store-detail-type {
    display: flex;
    gap: 6px;
}

.store-detail-type-btn {
    flex: 1;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 3px;
    border: 1px solid rgba(80, 140, 60, 0.3);
    background: rgba(10, 20, 10, 0.5);
    color: rgb(120, 150, 100);
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.store-detail-type-btn.active,
.store-detail-type-btn:hover {
    background: rgba(50, 100, 40, 0.4);
    border-color: rgba(100, 170, 70, 0.6);
    color: rgb(180, 220, 130);
}

.store-detail-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.store-detail-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: rgb(180, 225, 120);
}

.store-detail-price-orig {
    font-size: 0.9rem;
    color: rgb(110, 130, 100);
    text-decoration: line-through;
}

.store-detail-price-per {
    font-size: 0.8rem;
    color: rgb(120, 150, 100);
}

.store-detail-servers {
    font-size: 0.78rem;
    color: rgb(110, 140, 90);
    line-height: 1.6;
}

.store-detail-servers strong {
    color: rgb(150, 180, 120);
    display: block;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.72rem;
}

.btn-store-detail-buy {
    width: 100%;
    padding: 11px 16px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-radius: 3px;
    border: 1px solid rgba(100, 180, 70, 0.6);
    background: rgba(40, 90, 30, 0.5);
    color: rgb(180, 230, 120);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-store-detail-buy:hover {
    background: rgba(60, 120, 40, 0.6);
    border-color: rgba(130, 200, 80, 0.8);
    color: rgb(210, 245, 160);
}

/* Right: description */
.store-detail-right {
    padding: 24px 24px 28px;
    overflow-y: auto;
    max-height: 80vh;
}

.store-detail-desc-heading {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgb(100, 140, 80);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(80, 140, 60, 0.2);
}

/* PayNow description HTML content */
.store-detail-desc {
    font-size: 0.88rem;
    color: rgb(180, 195, 165);
    line-height: 1.7;
}

.store-detail-desc h1,
.store-detail-desc h2,
.store-detail-desc h3,
.store-detail-desc h4 {
    color: rgb(200, 220, 170);
    font-weight: 700;
    margin: 16px 0 8px;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.store-detail-desc p {
    margin: 0 0 10px;
}

.store-detail-desc img {
    max-width: 100%;
    border-radius: 4px;
    margin: 8px 0;
    display: block;
}

.store-detail-desc ul,
.store-detail-desc ol {
    padding-left: 20px;
    margin: 0 0 10px;
}

.store-detail-desc li {
    margin-bottom: 4px;
}

.store-detail-desc strong {
    color: rgb(200, 215, 175);
}

/* Card cursor hint */
.store-card {
    cursor: pointer;
}

/* ── Light theme ────────────────────────────────────────────────────────────── */
[data-theme="light"] .store-detail-modal {
    background: #f4faf4;
    border-color: rgba(80, 140, 60, 0.4);
}

[data-theme="light"] .store-detail-bar {
    background: #e8f4e8;
    border-bottom-color: rgba(80, 140, 60, 0.3);
}

[data-theme="light"] .store-detail-bar-title { color: #2a4a20; }

[data-theme="light"] .store-detail-left {
    background: rgba(220, 240, 210, 0.4);
    border-right-color: rgba(80, 140, 60, 0.2);
}

[data-theme="light"] .store-detail-name { color: #1a2a1a; }

[data-theme="light"] .store-detail-type-btn {
    border-color: rgba(60, 110, 50, 0.4);
    background: rgba(200, 230, 190, 0.5);
    color: #3a6a28;
}

[data-theme="light"] .store-detail-type-btn.active,
[data-theme="light"] .store-detail-type-btn:hover {
    background: rgba(140, 200, 100, 0.3);
    border-color: rgba(60, 130, 50, 0.7);
    color: #1a4010;
}

[data-theme="light"] .store-detail-price { color: #2a6a1a; }
[data-theme="light"] .store-detail-price-per { color: #4a7a38; }
[data-theme="light"] .store-detail-servers { color: #4a6a38; }
[data-theme="light"] .store-detail-servers strong { color: #2a4a1a; }

[data-theme="light"] .btn-store-detail-buy {
    background: transparent;
    border-color: rgba(50, 110, 50, 0.6);
    color: #1a5010;
}

[data-theme="light"] .btn-store-detail-buy:hover {
    background: rgba(80, 140, 60, 0.15);
    color: #0e3808;
}

[data-theme="light"] .store-detail-right { background: #f4faf4; }
[data-theme="light"] .store-detail-desc-heading { color: #3a6a28; border-bottom-color: rgba(80,140,60,0.25); }

[data-theme="light"] .store-detail-desc { color: #2a3a22; }
[data-theme="light"] .store-detail-desc h1,
[data-theme="light"] .store-detail-desc h2,
[data-theme="light"] .store-detail-desc h3,
[data-theme="light"] .store-detail-desc h4 { color: #1a2a10; }
[data-theme="light"] .store-detail-desc strong { color: #1a2a10; }
