/* =========================================================
   CouponsArena – Store detail (storedetail.css)
   Original compact layout, Dark Premium Purple/Magenta Theme with Dots
   ========================================================= */
:root {
    --brand-primary: #a855f7; 
    --brand-primary-dark: #7e22ce;
    --brand-primary-light: #d8b4fe;
    --brand-accent: #ec4899;
    --brand-deep-purple: #3b0764;

    /* Dark Theme Backgrounds */
    --bg-body: #08050e; 
    --bg-surface: rgba(26, 11, 46, 0.5); 
    --bg-surface-hover: rgba(126, 34, 206, 0.15);
    --bg-dark: #050505;
    --bg-dark-accent: #1a0b2e;

    /* Text Colors */
    --text-main: #ffffff;
    --text-body: #d1d5db;
    --text-muted: #9ca3af;
    --text-light: #ffffff;
    --text-light-muted: #e5e7eb;

    /* Borders */
    --border-light: rgba(255, 255, 255, 0.08);
    --border-dark: rgba(126, 34, 206, 0.3);

    /* Gradients & Shadows */
    --gradient-brand: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-brand: 0 4px 14px 0 rgba(168, 85, 247, 0.25);

    --radius: 14px;
}

/* Fix white background globally */
body {
    background-color: #08050e !important;
    margin: 0;
    padding: 0;
}

/* =========================================
   THE MAGIC: Gradient + Dots Texture
   ========================================= */
.store-detail-page { 
    background-color: var(--bg-body);
    
    /* 1. The repeating dots pattern 
       2. The deep purple/magenta gradient overlay */
    background-image: 
        radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(180deg, #050505 0%, #2e0a4f 50%, #08050e 100%);
    background-size: 20px 20px, 100% 100%;
    background-position: top left, center;
    background-attachment: fixed; /* Keeps background in place while scrolling */
    
    color: var(--text-body); 
    padding: 1rem 0 3rem; 
    min-height: calc(100vh - 80px); /* Adjust if your navbar height is different */
    width: 100%;
}

.store-detail-page [hidden] { display: none !important; }
.sd-wrap { padding: 0 1.5rem; position: relative; z-index: 1; }

/* ---------- Breadcrumb ---------- */
.sd-breadcrumb { margin-bottom: 1rem; }
.sd-breadcrumb .breadcrumb {
    display: flex; flex-wrap: wrap; margin: 0; padding: .65rem 1rem;
    background: var(--bg-surface); border: 1px solid var(--border-light);
    border-radius: var(--radius); box-shadow: var(--shadow-sm); font-size: .9rem;
    backdrop-filter: blur(10px);
}
.sd-breadcrumb .breadcrumb-item { font-weight: 700; }
.sd-breadcrumb .breadcrumb-item a { color: var(--brand-primary); text-decoration: none; transition: color 0.2s; }
.sd-breadcrumb .breadcrumb-item a:hover { color: var(--brand-accent); }
.sd-breadcrumb .breadcrumb-item.active { color: var(--text-main); }
.sd-breadcrumb .breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }
.sd-breadcrumb .text-muted { color: var(--text-muted) !important; }

/* ---------- Generic card ---------- */
.sd-card {
    background: var(--bg-surface); 
    border: 1px solid var(--border-light);
    border-radius: var(--radius); 
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

/* ---------- Store header ---------- */
.store-header { position: relative; overflow: hidden; margin-bottom: 1.25rem; padding: 1rem 1.2rem 1rem 1.4rem; }
.store-header::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--gradient-brand);
}
.store-header-inner { display: flex; align-items: center; gap: 1rem; }
.store-logo {
    flex: 0 0 64px; width: 64px; height: 64px; object-fit: contain; padding: .3rem;
    background: #fff; border: 1px solid var(--border-light); border-radius: 12px;
}
.store-logo-fallback {
    flex: 0 0 64px; width: 64px; height: 64px; display: grid; place-items: center;
    color: #fff; font-size: 1.6rem; font-weight: 800; background: var(--gradient-brand); border-radius: 12px;
}
.store-title { margin: 0 0 .25rem; color: var(--text-main); font-size: 1.35rem; font-weight: 800; line-height: 1.25; }
.store-description { margin: 0; color: var(--text-light-muted); font-size: .86rem; line-height: 1.5; }

/* ---------- Coupon cards ---------- */
.coupon-card {
    position: relative; display: flex; flex-direction: column; height: 100%;
    padding: 1rem .9rem .8rem; text-align: center;
    background: var(--bg-surface); border: 1px solid var(--border-light);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease, background .25s ease;
    animation: fadeInUp .45s ease backwards;
    backdrop-filter: blur(10px);
}
.coupon-card::before {
    content: ''; position: absolute; left: 14px; right: 14px; top: 0; height: 3px;
    background: var(--gradient-brand); border-radius: 0 0 4px 4px; opacity: 0; transition: opacity .25s ease;
}
.coupon-card:hover { 
    transform: translateY(-3px); 
    border-color: var(--brand-primary); 
    background: var(--bg-surface-hover);
    box-shadow: var(--shadow-md), var(--shadow-brand); 
}
.coupon-card:hover::before { opacity: 1; }
.coupon-card.is-expired { opacity: .6; }

.coupon-store-img { width: 50px; height: 50px; margin: 0 auto .6rem; object-fit: contain; border-radius: 8px; background: #fff; padding: 2px; }
.coupon-title { margin: 0 0 .4rem; color: var(--text-main); font-size: .9rem; font-weight: 700; line-height: 1.35; }
.coupon-description { margin: 0 0 .7rem; color: var(--text-light-muted); font-size: .78rem; line-height: 1.4; }

.coupon-action { margin-top: auto; }
.reveal-btn, .deal-btn {
    display: flex; align-items: center; justify-content: center; gap: .45rem; width: 100%;
    padding: .5rem .8rem; color: #fff; font-size: .82rem; font-weight: 600; text-decoration: none;
    border: 0; border-radius: 999px; cursor: pointer;
    transition: transform .2s ease, filter .2s ease, box-shadow .2s ease;
}
.reveal-btn { background: var(--gradient-brand); box-shadow: var(--shadow-brand); }
.deal-btn { background: linear-gradient(135deg, #7e22ce 0%, #4c1d95 100%); box-shadow: 0 4px 14px rgba(76, 29, 149, .3); }
.reveal-btn:hover, .deal-btn:hover { color: #fff; transform: translateY(-1px); filter: brightness(1.1); }

.code-box {
    display: flex; overflow: hidden; border: 1.5px dashed var(--brand-primary);
    border-radius: 10px; background: rgba(126, 34, 206, .15);
}
.code-box input {
    flex: 1; min-width: 0; padding: .45rem .4rem; text-align: center;
    color: var(--text-main); font-family: 'Courier New', monospace; font-size: .85rem; font-weight: 800; letter-spacing: .04em;
    background: transparent; border: 0; outline: 0;
}
.btn-copy {
    flex: 0 0 38px; display: grid; place-items: center; color: #fff; font-size: .8rem;
    background: var(--brand-primary); border: 0; cursor: pointer; transition: background .2s ease;
}
.btn-copy:hover { background: var(--brand-accent); }
.btn-copy.is-copied { background: #16a34a; }
.copy-ok { margin-top: .3rem; color: #16a34a; font-size: .72rem; font-weight: 700; }

.coupon-footer {
    display: flex; align-items: center; justify-content: space-between;
    margin-top: .7rem; padding-top: .55rem; border-top: 1px solid var(--border-light);
    color: var(--text-muted); font-size: .78rem; font-weight: 600;
}
.coupon-footer i { margin-right: .3rem; }
.coupon-footer .clicks i { color: var(--brand-primary); }
.coupon-footer .expiry { color: var(--text-muted); }
.coupon-footer .expiry i { color: var(--text-muted); }
.coupon-footer .expiry.is-past, .coupon-footer .expiry.is-past i { color: #ef4444; }

/* Empty */
.empty-state { padding: 3rem 1.5rem; text-align: center; background: var(--bg-surface); border: 1.5px dashed var(--border-dark); border-radius: var(--radius); }
.empty-icon {
    width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 1rem;
    color: #fff; font-size: 1.4rem; background: var(--gradient-brand); border-radius: 18px; box-shadow: var(--shadow-brand);
}
.empty-state h4 { color: var(--text-main); font-weight: 800; font-size: 1.15rem; }
.empty-state p { max-width: 440px; margin: 0 auto; font-size: .9rem; color: var(--text-light-muted); }

/* ---------- Content / related articles ---------- */
.content-card { position: relative; overflow: hidden; margin-top: 2rem; padding: 1.8rem 2rem; }
.content-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--gradient-brand); }
.section-title { margin: 0 0 1.2rem; color: var(--text-main); font-size: 1.35rem; font-weight: 800; }
.section-title::after { content: ''; display: block; width: 44px; height: 4px; margin-top: .5rem; border-radius: 4px; background: var(--gradient-brand); }

.store-article { color: var(--text-body); font-size: 1rem; line-height: 1.85; overflow-wrap: anywhere; }
.store-article > *:first-child { margin-top: 0; }
.store-article h1, .store-article h2, .store-article h3, .store-article h4 { margin: 1.8rem 0 .8rem; color: var(--text-main); font-weight: 800; line-height: 1.3; }
.store-article h1 { font-size: 1.6rem; }
.store-article h2 { font-size: 1.45rem; }
.store-article h3 { font-size: 1.2rem; }
.store-article p { margin: 0 0 1.1rem; }
.store-article a { color: var(--brand-primary); font-weight: 600; text-decoration: none; border-bottom: 1.5px solid rgba(168, 85, 247, .3); }
.store-article a:hover { color: var(--brand-accent); border-bottom-color: var(--brand-accent); }
.store-article img { display: block; max-width: 100%; height: auto; margin: 1.3rem auto; border-radius: 10px; }
.store-article ul, .store-article ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.store-article li { margin-bottom: .4rem; }
.store-article li::marker { color: var(--brand-primary); font-weight: 700; }
.store-article hr { margin: 1.8rem 0; border: 0; height: 1px; background: var(--border-light); opacity: 1; }
.store-article table { display: block; width: 100%; max-width: 100%; overflow-x: auto; margin: 1.4rem 0; border-collapse: collapse; }
.store-article th { padding: .6rem .9rem; text-align: left; color: #fff; background: var(--brand-deep-purple); }
.store-article td { padding: .55rem .9rem; border-top: 1px solid var(--border-light); }
.store-article blockquote {
    margin: 1.4rem 0; padding: 1rem 1.2rem; font-style: italic; color: var(--text-main);
    background: rgba(126, 34, 206, .15); border-left: 4px solid var(--brand-primary); border-radius: 0 10px 10px 0;
}

.article-item { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 0; border-bottom: 1px solid var(--border-light); }
.article-item:last-child { border-bottom: 0; padding-bottom: 0; }
.article-thumb { flex: 0 0 110px; width: 110px; height: 80px; overflow: hidden; border-radius: 10px; background: var(--border-light); }
.article-thumb img { width: 100%; height: 100%; object-fit: cover; }
.article-item h4 { margin: 0 0 .35rem; font-size: 1rem; font-weight: 700; line-height: 1.4; }
.article-item h4 a { color: var(--text-main); text-decoration: none; transition: color 0.2s; }
.article-item h4 a:hover { color: var(--brand-primary); }
.article-item p { margin: 0 0 .4rem; color: var(--text-light-muted); font-size: .88rem; line-height: 1.55; }
.read-link { display: inline-flex; align-items: center; gap: .4rem; color: var(--brand-primary); font-size: .84rem; font-weight: 700; text-decoration: none; transition: gap .2s ease, color 0.2s; }
.read-link:hover { color: var(--brand-accent); gap: .65rem; }

/* ---------- Sidebar ---------- */
.side-card { margin-bottom: 1.25rem; padding: 1.1rem 1.25rem; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .9rem; }
.side-title { display: flex; align-items: center; gap: .55rem; margin: 0; color: var(--text-main); font-size: .98rem; font-weight: 800; }
.side-title i { color: var(--brand-primary); }
.side-badge { padding: .18rem .7rem; color: #fff; font-size: .7rem; font-weight: 700; background: var(--gradient-brand); border-radius: 999px; }
.side-card h6.store-name { margin: 0 0 .6rem; color: var(--brand-primary); font-size: .95rem; font-weight: 800; }
.side-card p { margin: 0; color: var(--text-light-muted); font-size: .88rem; line-height: 1.8; }

.filter-list { display: grid; gap: .5rem; }
.filter-link {
    display: block; padding: .45rem .8rem; text-align: center;
    color: var(--text-main); font-size: .85rem; font-weight: 600; text-decoration: none;
    background: transparent; border: 1.5px solid var(--border-light); border-radius: 6px;
    transition: all .2s ease;
}
.filter-link:hover { color: var(--brand-primary); border-color: var(--brand-primary); background: rgba(126, 34, 206, .1); }
.filter-link.active { color: #fff; border-color: transparent; background: var(--gradient-brand); box-shadow: var(--shadow-brand); }

.share-card { text-align: center; }
.share-list { display: flex; justify-content: center; gap: .6rem; }
.share-btn {
    width: 34px; height: 34px; display: grid; place-items: center;
    color: #fff; font-size: .85rem; text-decoration: none; cursor: pointer; border: 0; border-radius: 50%;
    background: var(--brand-primary); transition: transform .2s ease, filter .2s ease;
}
.share-btn:hover { color: #fff; transform: translateY(-2px); filter: brightness(1.15); }
.share-btn.facebook { background: #1877f2; }
.share-btn.twitter { background: #0f1419; border: 1px solid var(--border-light); }
.share-btn.whatsapp { background: #25d366; }
.share-btn.copy-link { background: var(--gradient-brand); }
.share-btn.copied { background: #16a34a; }

.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.related-store {
    display: grid; place-items: center; min-height: 38px; padding: .45rem .5rem; text-align: center;
    color: var(--text-light-muted); font-size: .75rem; font-weight: 600; line-height: 1.3; text-decoration: none; overflow-wrap: anywhere;
    background: rgba(0, 0, 0, 0.2); border: 1px solid var(--border-light); border-radius: 8px;
    transition: all .2s ease;
}
.related-store:hover { color: #fff; border-color: transparent; background: var(--gradient-brand); box-shadow: var(--shadow-brand); }

/* ---------- Motion ---------- */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- Mobile: 2 coupons per row ---------- */
@media (max-width: 767px) {
    .store-detail-page { padding-top: .6rem; }
    .sd-wrap { padding: 0 .6rem; }
    .sd-breadcrumb .breadcrumb { padding: .55rem .8rem; font-size: .82rem; }

    .store-header { padding: .8rem .9rem .8rem 1.1rem; }
    .store-header-inner { align-items: flex-start; gap: .8rem; }
    .store-logo, .store-logo-fallback { flex-basis: 50px; width: 50px; height: 50px; }
    .store-title { font-size: 1.05rem; }
    .store-description { font-size: .78rem; }

    .coupons-row { --bs-gutter-x: .6rem; --bs-gutter-y: .6rem; }
    .coupon-card { padding: .8rem .6rem .6rem; }
    .coupon-store-img { width: 40px; height: 40px; margin-bottom: .45rem; }
    .coupon-title { font-size: .78rem; }
    .coupon-description { font-size: .72rem; }
    .reveal-btn, .deal-btn { padding: .4rem .5rem; font-size: .74rem; }
    .code-box input { font-size: .76rem; }
    .coupon-footer { font-size: .72rem; }

    .content-card { padding: 1.4rem 1.1rem; }
    .article-item { flex-direction: column; }
    .article-thumb { width: 100%; flex-basis: auto; height: 150px; }
}
@media (max-width: 400px) {
    .coupon-title { font-size: .74rem; }
    .reveal-btn, .deal-btn { font-size: .7rem; gap: .3rem; }
    .related-grid { grid-template-columns: 1fr; }
}