/* ==========================================================
   DropAI — theme layer on top of Bootstrap 5
   Mobile-first; everything below is responsive by default.
   ========================================================== */

:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-light: #eef2ff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --ok: #059669;
  --warn: #d97706;
  --bad: #dc2626;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .1);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, .07), 0 2px 4px -2px rgba(15, 23, 42, .05);
  --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, .1), 0 8px 10px -6px rgba(15, 23, 42, .06);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: .95rem;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-outline-brand { border-color: var(--brand); color: var(--brand); }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { background: #fff; border-bottom: 1px solid var(--line); font-weight: 600; }

.stat-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 1.1rem; height: 100%; }
.stat-card .stat-label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin-top: .25rem; }
.stat-card .stat-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-size: 1.15rem; }

/* ---------- Layout: dashboard shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 1045;
  overflow-y: auto; transform: translateX(-100%); transition: transform .22s ease;
}
.sidebar.open { transform: translateX(0); }
.sidebar .brand { padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 1.1rem; color: var(--brand); display: flex; align-items: center; gap: .5rem; }
.sidebar .nav-section { padding: .85rem 1.25rem .35rem; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.sidebar .nav-link { color: #334155; padding: .6rem 1.25rem; display: flex; align-items: center; gap: .7rem; border-left: 3px solid transparent; font-size: .9rem; }
.sidebar .nav-link:hover { background: var(--brand-light); color: var(--brand); text-decoration: none; }
.sidebar .nav-link.active { background: var(--brand-light); color: var(--brand); border-left-color: var(--brand); font-weight: 600; }
.sidebar .nav-link i { width: 18px; text-align: center; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: .7rem 1rem; position: sticky; top: 0; z-index: 1030; }
.content { padding: 1.1rem; flex: 1; }

.sidebar-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1040; display: none; }
.sidebar-backdrop.show { display: block; }

@media (min-width: 992px) {
  .sidebar { transform: translateX(0); }
  .main-area { margin-left: 260px; }
  .content { padding: 1.5rem 2rem; }
  .sidebar-backdrop { display: none !important; }
  .sidebar-toggle { display: none !important; }
}

/* ---------- Product cards ---------- */
.product-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; height: 100%; display: flex; flex-direction: column; transition: box-shadow .18s ease, transform .18s ease; }
.product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.product-thumb { aspect-ratio: 1 / 1; background: #f1f5f9; display: grid; place-items: center; overflow: hidden; }
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb .placeholder-icon { font-size: 2rem; color: #cbd5e1; }
.product-card .body { padding: .8rem; flex: 1; display: flex; flex-direction: column; }
.product-card .title { font-weight: 600; font-size: .9rem; line-height: 1.35; margin-bottom: .3rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card .price { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.product-card .compare { text-decoration: line-through; color: var(--muted); font-size: .82rem; margin-left: .35rem; }

.price-ladder { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; }
.price-ladder .step { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; }
.price-ladder .step .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; }
.price-ladder .step .val { font-weight: 700; font-size: .95rem; }

/* ---------- Badges & pills ---------- */
.badge-soft { border-radius: 999px; padding: .3em .7em; font-size: .72rem; font-weight: 600; }
.badge-soft.ok { background: #d1fae5; color: #065f46; }
.badge-soft.warn { background: #fef3c7; color: #92400e; }
.badge-soft.bad { background: #fee2e2; color: #991b1b; }
.badge-soft.info { background: #dbeafe; color: #1e40af; }
.badge-soft.muted { background: #f1f5f9; color: #475569; }
.badge-soft.brand { background: var(--brand-light); color: var(--brand); }

/* ---------- Tables ---------- */
.table { font-size: .875rem; }
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table thead th { background: #f8fafc; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .3rem; }
.form-control, .form-select { border-radius: 10px; border-color: var(--line); font-size: .9rem; padding: .5rem .75rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.form-text { font-size: .78rem; }
.input-group-text { border-radius: 10px; background: #f8fafc; border-color: var(--line); font-size: .85rem; }

/* ---------- Hero ---------- */
.hero { background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%); color: #fff; padding: 3.5rem 0; }
.hero h1 { font-weight: 800; line-height: 1.15; }
.hero .lead { opacity: .92; }
@media (min-width: 768px) { .hero { padding: 5rem 0; } }

/* ---------- Pricing ---------- */
.plan-card { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 1.6rem; height: 100%; display: flex; flex-direction: column; position: relative; transition: border-color .18s ease, box-shadow .18s ease; }
.plan-card:hover { border-color: var(--brand); box-shadow: var(--shadow-lg); }
.plan-card.featured { border-color: var(--brand); box-shadow: var(--shadow-lg); }
.plan-card .plan-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--brand); color: #fff; padding: .25rem .9rem; border-radius: 999px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.plan-card .plan-price { font-size: 2.1rem; font-weight: 800; line-height: 1; }
.plan-card ul { list-style: none; padding: 0; margin: 1rem 0; flex: 1; }
.plan-card ul li { padding: .38rem 0; display: flex; gap: .55rem; align-items: flex-start; font-size: .88rem; }
.plan-card ul li i { color: var(--ok); margin-top: .18rem; flex-shrink: 0; }

/* ---------- Storefront ---------- */
.store-banner { height: 150px; background: linear-gradient(135deg, var(--brand), #7c3aed); background-size: cover; background-position: center; }
@media (min-width: 768px) { .store-banner { height: 240px; } }
.store-logo { width: 86px; height: 86px; border-radius: 18px; border: 4px solid #fff; background: #fff; object-fit: cover; box-shadow: var(--shadow); margin-top: -46px; }

/* ---------- Referral link box ---------- */
.copy-box { display: flex; gap: .4rem; }
.copy-box input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; background: #f8fafc; }

/* ---------- AI panel ---------- */
.ai-panel { background: linear-gradient(135deg, #eef2ff, #faf5ff); border: 1px solid #ddd6fe; border-radius: var(--radius); }
.ai-answer { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .8rem; font-size: .88rem; white-space: pre-wrap; }

/* ---------- Chat widget ---------- */
.chat-fab { position: fixed; right: 16px; bottom: 16px; width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: #fff; border: 0; box-shadow: var(--shadow-lg); z-index: 1050; font-size: 1.3rem; }
.chat-panel { position: fixed; right: 12px; bottom: 80px; width: calc(100vw - 24px); max-width: 360px; max-height: 65vh; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 1050; display: none; flex-direction: column; overflow: hidden; }
.chat-panel.open { display: flex; }
.chat-log { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .55rem; }
.chat-msg { max-width: 85%; padding: .5rem .75rem; border-radius: 12px; font-size: .85rem; line-height: 1.45; }
.chat-msg.user { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: #f1f5f9; border-bottom-left-radius: 4px; white-space: pre-wrap; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding-left: 1.6rem; padding-bottom: .9rem; border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: .3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.timeline li.done::before { background: var(--ok); }
.timeline li.pending::before { background: #cbd5e1; }

/* ---------- Misc ---------- */
.text-muted-sm { color: var(--muted); font-size: .8rem; }
.divider { height: 1px; background: var(--line); margin: 1rem 0; }
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty-state i { font-size: 2.6rem; color: #cbd5e1; display: block; margin-bottom: .6rem; }
.sticky-summary { position: sticky; top: 1rem; }
.cursor-pointer { cursor: pointer; }
.spinner-inline { width: 1rem; height: 1rem; border-width: .15em; }

@media print {
  .sidebar, .topbar, .no-print, .chat-fab, .chat-panel { display: none !important; }
  .main-area { margin-left: 0 !important; }
}
