/* Static site styles (moved out of inline <style> blocks).
 * Theme colours from admin settings stay inline in layouts/main.php.
 * Linked with ?v=filemtime, so edits bust the Cloudflare/browser cache. */

/* ═══ Layout (layouts/main.php) ═══ */
/* ─── Typography Polish ─────────────────────────────────── */
h1, h2, h3 {
    letter-spacing: -0.02em;
    line-height: 1.15;
}

/* ─── Mobile Header Bar ─────────────────────────────────── */
.mobile-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid #e2e8f0;
    backdrop-filter: blur(8px);
}
@media (min-width: 768px) {
    .mobile-header-bar {
        display: none !important;
    }
    #desktop-header {
        display: block !important;
    }
    #desktop-nav {
        display: block !important;
    }
}
@media (max-width: 767px) {
    #desktop-header {
        display: none !important;
    }
    #desktop-nav {
        display: none !important;
    }
    .mobile-header-bar {
        display: flex !important;
    }
}

/* ─── Slide-in Drawer ───────────────────────────────────── */
#drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
#drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}
#drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(288px, 85vw);
    height: 100%;
    background: #fff;
    box-shadow: -8px 0 32px rgba(0,0,0,0.15);
    z-index: 61;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}
#drawer-panel.open {
    transform: translateX(0);
}
body.drawer-open {
    overflow: hidden;
}

/* ─── Micro-Animations ──────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInLeft {
    from { opacity: 0; transform: translateX(-24px); }
    to   { opacity: 1; transform: translateX(0); }
}
.animate-fadein {
    opacity: 0;
    animation: fadeInUp 0.55s ease-out forwards;
}
.animate-fadein-left {
    opacity: 0;
    animation: fadeInLeft 0.55s ease-out forwards;
}

/* Stagger delays for child elements */
.stagger > *:nth-child(1) { animation-delay: 0s; }
.stagger > *:nth-child(2) { animation-delay: 0.08s; }
.stagger > *:nth-child(3) { animation-delay: 0.16s; }
.stagger > *:nth-child(4) { animation-delay: 0.24s; }
.stagger > *:nth-child(5) { animation-delay: 0.32s; }
.stagger > *:nth-child(6) { animation-delay: 0.40s; }

/* Card hover glow */
.card-product:hover {
    box-shadow: 0 8px 30px rgba(0, 91, 191, 0.15);
    transform: translateY(-3px);
}
.card-product {
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

/* Product card: horizontal on mobile, vertical on sm+ */
.product-card-inner {
    display: flex;
    flex-direction: row;
    height: 100%;
}
.product-thumb {
    display: flex;
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: 112px;
    width: 112px;
    height: 112px;
    min-width: 112px;
    max-width: 112px;
    min-height: 112px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #dbeafe, #ffedd5);
}
.product-badge-mobile { display: inline-flex; }
.product-badge-desktop { display: none; }
.product-desc { display: none !important; }
.product-btn-full { display: none; }
.product-btn-short { display: inline-flex; align-items: center; justify-content: center; }

@media (min-width: 640px) {
    .product-card-inner {
        flex-direction: column;
    }
    .product-thumb {
        flex-basis: auto;
        width: 100%;
        height: auto;
        min-width: 0;
        max-width: none;
        min-height: 0;
        aspect-ratio: 1 / 1;
    }
    .product-badge-mobile { display: none; }
    .product-badge-desktop { display: flex; flex-wrap: wrap; }
    .product-desc { 
        display: -webkit-box !important; 
        -webkit-line-clamp: 2; 
        -webkit-box-orient: vertical; 
    }
    .product-btn-full { display: inline; }
    .product-btn-short { display: none; }
}


/* Add to cart button pulse */
@keyframes cartPulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}
.cart-added {
    animation: cartPulse 0.35s ease-out;
}

/* ─── Footer Trust Badges ───────────────────────────────── */
.trust-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
}
.trust-badge .icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
}

/* ═══ Product page notice (store/product.php) ═══ */
/* Product-page important notice — colours are CSS vars for easy tweaking */
.product-notice{
    --pn-bg:#fffbeb; --pn-border:#f59e0b; --pn-text:#92400e; --pn-icon:#f59e0b; --pn-glow:245,158,11;
    display:flex; gap:.75rem; align-items:flex-start;
    padding:1rem 1.15rem; border-radius:.75rem;
    background:var(--pn-bg); border:2px solid var(--pn-border); color:var(--pn-text);
    font-weight:500;
    animation:pnIn .5s ease-out both, pnPulse 2.6s ease-in-out .5s infinite;
}
.product-notice svg{flex-shrink:0; width:1.5rem; height:1.5rem; color:var(--pn-icon)}
.product-notice .product-notice__body{flex:1; min-width:0}
.product-notice .product-notice__body :where(a){text-decoration:underline; font-weight:700}
.product-notice .product-notice__body :where(p,ul,ol):last-child{margin-bottom:0}
@keyframes pnIn{from{opacity:0; transform:translateY(10px)} to{opacity:1; transform:translateY(0)}}
@keyframes pnPulse{
    0%,100%{box-shadow:0 0 0 0 rgba(var(--pn-glow),0)}
    50%{box-shadow:0 0 0 6px rgba(var(--pn-glow),.18)}
}
@media (prefers-reduced-motion:reduce){ .product-notice{animation:none} }

/* ═══ Chat widget (partials/chat_widget.php) ═══ */
.chat-widget { position: fixed; bottom: 24px; right: 24px; z-index: 9999; font-family: system-ui, sans-serif; }
.chat-toggle { width: 56px; height: 56px; border-radius: 28px; background: var(--color-brand, #2563eb); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 16px rgba(0,0,0,0.2); transition: transform 0.2s; }
.chat-toggle:hover { transform: scale(1.06); }
.chat-toggle svg { width: 28px; height: 28px; color: #fff; }
.chat-toggle .unread-dot { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; border-radius: 7px; background: #ef4444; border: 2px solid #fff; }
.chat-window { display: none; position: absolute; bottom: 72px; right: 0; width: 380px; max-height: 560px; background: #fff; border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,0.15); flex-direction: column; overflow: hidden; }
.chat-window.open { display: flex; }
.chat-header { background: var(--color-brand, #2563eb); color: #fff; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; }
.chat-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.chat-header button { background: none; border: none; color: #fff; cursor: pointer; font-size: 20px; line-height: 1; padding: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 300px; }
.chat-messages .bubble { max-width: 80%; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.chat-messages .bubble.user { align-self: flex-end; background: var(--color-brand, #2563eb); color: #fff; border-bottom-right-radius: 4px; }
.chat-messages .bubble.admin { align-self: flex-start; background: #f1f5f9; color: #1e293b; border-bottom-left-radius: 4px; }
.chat-messages .bubble .time { font-size: 10px; opacity: 0.6; margin-top: 4px; display: block; }
.chat-input-area { display: none; padding: 12px 16px; border-top: 1px solid #e2e8f0; gap: 8px; }
.chat-input-area.active { display: flex; }
.chat-input-area input { flex: 1; padding: 10px 14px; border: 1px solid #e2e8f0; border-radius: 20px; font-size: 14px; outline: none; }
.chat-input-area input:focus { border-color: var(--color-brand, #2563eb); }
.chat-input-area button { background: var(--color-brand, #2563eb); color: #fff; border: none; border-radius: 20px; padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chat-closed-banner { display: none; padding: 16px 20px; text-align: center; color: #94a3b8; font-size: 13px; }
.chat-closed-banner.show { display: block; }

/* Wizard Styles */
.chat-wizard { padding: 10px 20px 20px; overflow-y: auto; max-height: 420px; }
.chat-wizard .wiz-title { font-size: 15px; font-weight: 700; color: #1e293b; margin: 0 0 4px; }
.chat-wizard .wiz-sub { font-size: 13px; color: #64748b; margin: 0 0 16px; }
.chat-wizard .wiz-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid #e2e8f0; border-radius: 12px; cursor: pointer; transition: all 0.15s; font-size: 14px; color: #334155; margin-bottom: 8px; background: #fff; }
.chat-wizard .wiz-option:hover { border-color: var(--color-brand, #2563eb); background: #f0f5ff; }
.chat-wizard .wiz-option .wiz-emoji { font-size: 20px; flex-shrink: 0; }
.chat-wizard .wiz-option .wiz-label { font-weight: 600; }
.chat-wizard .wiz-option .wiz-desc { font-size: 12px; color: #94a3b8; font-weight: 400; }
.chat-wizard .wiz-back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: #64748b; cursor: pointer; border: none; background: none; padding: 0; margin-bottom: 14px; font-weight: 500; }
.chat-wizard .wiz-back:hover { color: var(--color-brand, #2563eb); }
.chat-wizard .wiz-field { margin-bottom: 14px; }
.chat-wizard .wiz-field label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 4px; }
.chat-wizard .wiz-field input, .chat-wizard .wiz-field select { width: 100%; padding: 10px 12px; border: 1.5px solid #e2e8f0; border-radius: 10px; font-size: 14px; outline: none; box-sizing: border-box; background: #fff; }
.chat-wizard .wiz-field input:focus, .chat-wizard .wiz-field select:focus { border-color: var(--color-brand, #2563eb); }
.chat-wizard .wiz-submit { width: 100%; padding: 12px; background: var(--color-brand, #2563eb); color: #fff; border: none; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 4px; }
.chat-wizard .wiz-submit:hover { opacity: 0.9; }
.chat-wizard .wiz-order-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px; cursor: pointer; transition: all 0.15s; margin-bottom: 8px; }
.chat-wizard .wiz-order-item:hover { border-color: var(--color-brand, #2563eb); background: #f0f5ff; }
.chat-wizard .wiz-order-item.selected { border-color: var(--color-brand, #2563eb); background: #eff6ff; }
.chat-wizard .wiz-order-item .order-num { font-weight: 700; font-size: 14px; color: #1e293b; }
.chat-wizard .wiz-order-item .order-meta { font-size: 12px; color: #64748b; }
.chat-wizard .wiz-order-item .order-status { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.chat-wizard .wiz-order-item .order-status.pending { background: #fef3c7; color: #92400e; }
.chat-wizard .wiz-order-item .order-status.paid { background: #d1fae5; color: #065f46; }
.chat-wizard .wiz-order-item .order-status.cancelled { background: #fee2e2; color: #991b1b; }
.chat-wizard .wiz-loading { text-align: center; padding: 20px; color: #94a3b8; font-size: 13px; }
.chat-wizard .wiz-no-order-link { display: block; text-align: center; font-size: 13px; color: var(--color-brand, #2563eb); cursor: pointer; margin-top: 8px; text-decoration: underline; }

@media (max-width: 480px) {
  .chat-window { width: calc(100vw - 32px); right: -8px; max-height: 80vh; }
}

/* ═══ Highlight badge (product_badge() in app/Common.php) ═══ */
/* Card: ribbon on top-left of thumbnail (wishlist heart is top-right) */
.product-ribbon{
    position:absolute; top:.5rem; left:.5rem; z-index:2;
    max-width:calc(100% - 3.5rem); overflow:hidden; white-space:nowrap; text-overflow:ellipsis;
    padding:.2rem .55rem; border-radius:.375rem;
    font-size:.68rem; font-weight:800; line-height:1.3; letter-spacing:.02em; text-transform:uppercase;
    color:#fff; box-shadow:0 2px 8px rgba(0,0,0,.25); pointer-events:none;
}
.product-ribbon::after{
    content:""; position:absolute; top:0; left:-60%; width:40%; height:100%;
    background:linear-gradient(100deg,transparent,rgba(255,255,255,.55),transparent);
    transform:skewX(-20deg); animation:badgeShine 3.2s ease-in-out infinite;
}
/* Product page: pill above the title */
.product-highlight{
    position:relative; overflow:hidden; display:inline-flex; align-items:center; gap:.35rem;
    margin-bottom:.75rem; padding:.4rem .9rem; border-radius:999px;
    font-size:.875rem; font-weight:800; letter-spacing:.02em; text-transform:uppercase; color:#fff;
    animation:badgePulse 2.4s ease-in-out infinite;
}
.product-highlight::after{
    content:""; position:absolute; top:0; left:-60%; width:35%; height:100%;
    background:linear-gradient(100deg,transparent,rgba(255,255,255,.5),transparent);
    transform:skewX(-20deg); animation:badgeShine 3.2s ease-in-out infinite;
}
.product-ribbon--hot,.product-highlight--hot{background:linear-gradient(135deg,#ef4444,#f97316); --badge-glow:239,68,68}
.product-ribbon--new,.product-highlight--new{background:linear-gradient(135deg,#16a34a,#22c55e); --badge-glow:22,163,74}
.product-ribbon--info,.product-highlight--info{background:linear-gradient(135deg,#2563eb,#0ea5e9); --badge-glow:37,99,235}
.product-ribbon--special,.product-highlight--special{background:linear-gradient(135deg,#7c3aed,#c026d3); --badge-glow:124,58,237}
/* Only "hot" cards shine; other card ribbons stay calm so a grid isn't too busy */
.product-ribbon:not(.product-ribbon--hot)::after{display:none}
@keyframes badgeShine{0%,60%{left:-60%} 100%{left:130%}}
@keyframes badgePulse{
    0%,100%{box-shadow:0 0 0 0 rgba(var(--badge-glow),.45)}
    50%{box-shadow:0 0 0 7px rgba(var(--badge-glow),0)}
}
@media (prefers-reduced-motion:reduce){
    .product-ribbon::after,.product-highlight::after{display:none}
    .product-highlight{animation:none}
}

/* ═══ Product page title (store/product.php) ═══ */
/* 768px+: 2.4rem = 38.4px (20% smaller than the old md:text-5xl 3rem). Mobile keeps text-3xl. */
@media (min-width:768px){
    .product-title{font-size:2.4rem; line-height:1}
}
