/* Reepy - Base styles + 6 themes
 * Themes: dark-default | dark-violet | dark-emerald | light-default | light-azure | light-rose
 * Toggle via [data-theme] attribute on <html>.
 */

/* ---------- Theme tokens ---------- */
:root,
[data-theme="dark-default"] {
  --bg:        #0b0d12;
  --bg-2:      #11141b;
  --bg-3:      #161a23;
  --surface:   #1a1f2b;
  --surface-2: #20263424;
  --border:    #232a39;
  --text:      #e6e9f2;
  --text-muted:#8b94a7;
  --primary:   #6c8cff;
  --primary-2: #8aa2ff;
  --primary-fg:#0b0d12;
  --success:   #3ddc97;
  --warning:   #f5b248;
  --danger:    #ff6b81;
  --info:      #5fc8ff;
  --shadow:    0 8px 32px rgba(0,0,0,.45);
  --radius:    14px;
  --radius-sm: 8px;
}

[data-theme="dark-violet"] {
  --bg:#0d0a1a; --bg-2:#15102a; --bg-3:#1a1335; --surface:#1f1740; --surface-2:#2a1f56;
  --border:#2d2156; --text:#ece7ff; --text-muted:#988fbf;
  --primary:#a779ff; --primary-2:#bf9aff; --primary-fg:#15102a;
}

[data-theme="dark-emerald"] {
  --bg:#08120e; --bg-2:#0d1c16; --bg-3:#102420; --surface:#152d26; --surface-2:#1a3a30;
  --border:#1d3d33; --text:#e6f5ee; --text-muted:#85a89a;
  --primary:#3ddc97; --primary-2:#65e8af; --primary-fg:#08120e;
}

[data-theme="light-default"] {
  --bg:#f7f8fb; --bg-2:#eef1f7; --bg-3:#e6eaf2; --surface:#ffffff; --surface-2:#f3f5fb;
  --border:#d8dde7; --text:#1c2030; --text-muted:#5a6478;
  --primary:#3a5cff; --primary-2:#5a78ff; --primary-fg:#ffffff;
  --success:#0f9b6c; --warning:#d68b1a; --danger:#dc3a55; --info:#1f8fc4;
  --shadow:0 4px 24px rgba(20,28,52,.08);
}

[data-theme="light-azure"] {
  --bg:#eef6ff; --bg-2:#e0eeff; --bg-3:#d2e6ff; --surface:#ffffff; --surface-2:#f0f7ff;
  --border:#c7daf3; --text:#0e1e3a; --text-muted:#456185;
  --primary:#1071e5; --primary-2:#2b8af2; --primary-fg:#ffffff;
}

[data-theme="light-rose"] {
  --bg:#fff5f7; --bg-2:#ffe9ee; --bg-3:#ffdce4; --surface:#ffffff; --surface-2:#fff0f3;
  --border:#f3c8d1; --text:#3a0e1c; --text-muted:#854557;
  --primary:#d83a6b; --primary-2:#e85a87; --primary-fg:#ffffff;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); text-decoration: underline; }

/* ---------- Bootstrap overrides ---------- */
.btn { border-radius: var(--radius-sm); font-weight: 500; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: var(--primary-fg); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-google { background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: .65rem 1rem; font-weight: 500; }
.btn-google:hover { background: var(--surface-2); color: var(--text); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.card-header { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.table { color: var(--text); }
.table thead th { background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 600; }
.table > :not(caption) > * > * { background-color: transparent; color: var(--text); border-bottom-color: var(--border); }
.form-control, .form-select { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.form-control:focus, .form-select:focus { background: var(--surface-2); border-color: var(--primary); color: var(--text); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary) 25%, transparent); }
.input-group-text { background: var(--surface-2); border-color: var(--border); color: var(--text-muted); }
.text-muted { color: var(--text-muted) !important; }
hr { border-color: var(--border); }
.dropdown-menu { background: var(--surface); border-color: var(--border); }
.dropdown-item { color: var(--text); }
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.alert-danger { background: color-mix(in srgb, var(--danger) 15%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--text); }
.alert-success { background: color-mix(in srgb, var(--success) 15%, transparent); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--text); }

/* ---------- Logo mark ---------- */
.reepy-logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--primary-fg); font-weight: 800; font-family: ui-monospace, monospace;
}
.reepy-logo-lg { width: 56px; height: 56px; border-radius: 12px; font-size: 1.6rem; }

/* ---------- Top nav ---------- */
.reepy-nav { background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.reepy-nav .navbar-brand, .reepy-nav .nav-link { color: var(--text); }
.reepy-nav .nav-link:hover { color: var(--primary); }
.reepy-main { min-height: calc(100vh - 220px); }

/* ---------- Hero ---------- */
.hero { padding: 3rem 0; }
.badge-pill {
  display: inline-block; padding: .35rem .75rem; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary); font-size: .85rem; font-weight: 500;
}
.hero-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; box-shadow: var(--shadow);
}
.hero-card-row { display: flex; gap: 1rem; padding: .75rem 0; align-items: flex-start; border-bottom: 1px solid var(--border); }
.hero-card-row:last-child { border-bottom: 0; }
.hero-card-row i { font-size: 1.5rem; color: var(--primary); flex-shrink: 0; }

/* ---------- Footer ---------- */
.reepy-footer { background: var(--bg-2); border-top: 1px solid var(--border); color: var(--text-muted); }
.reepy-footer h6 { color: var(--text); }
.reepy-footer a { color: var(--text-muted); }
.reepy-footer a:hover { color: var(--primary); }

/* ---------- Auth section ---------- */
.auth-section { padding: 3rem 0; min-height: 70vh; display: flex; align-items: center; }
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.5rem; box-shadow: var(--shadow); }

/* ---------- Sidebar layout ---------- */
.reepy-sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 260px;
  background: var(--bg-2); border-right: 1px solid var(--border);
  overflow-y: auto; z-index: 1040; transition: transform .25s ease;
  display: flex; flex-direction: column;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.sidebar-brand { display: flex; align-items: center; gap: .5rem; color: var(--text); font-weight: 600; }
.sidebar-brand:hover { text-decoration: none; color: var(--text); }
.sidebar-nav { padding: .75rem; flex: 1; }
.sidebar-section { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 1rem .75rem .35rem; }
.sidebar-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .75rem; border-radius: var(--radius-sm);
  color: var(--text); font-size: .92rem;
}
.sidebar-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar-link.active { background: color-mix(in srgb, var(--primary) 18%, transparent); color: var(--primary); }
.sidebar-link i { width: 18px; }
.sidebar-footer { padding: .75rem; border-top: 1px solid var(--border); }
.sidebar-toggle {
  position: fixed; top: 12px; left: 12px; z-index: 1050;
  width: 40px; height: 40px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}

/* Content area, offset by sidebar */
.reepy-content { margin-left: 260px; padding: 1.5rem 1.75rem; }
.content-header { margin-bottom: 1.25rem; }

@media (max-width: 991px) {
  .reepy-sidebar { transform: translateX(-100%); }
  .reepy-sidebar.open { transform: translateX(0); }
  .reepy-content { margin-left: 0; padding-top: 60px; }
}

/* ---------- KPI cards ---------- */
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem; position: relative; overflow: hidden;
}
.kpi-icon { position: absolute; top: .75rem; right: .75rem; font-size: 1.4rem; color: var(--text-muted); opacity: .4; }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.kpi-label { font-size: .8rem; color: var(--text-muted); }
.kpi-primary  .kpi-icon { color: var(--primary); }
.kpi-success  .kpi-icon { color: var(--success); }
.kpi-info     .kpi-icon { color: var(--info); }
.kpi-warning  .kpi-icon { color: var(--warning); }
.kpi-danger   .kpi-icon { color: var(--danger); }

/* ---------- Empty state ---------- */
.empty-state {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 3rem 2rem; text-align: center;
}

/* ---------- Error pages ---------- */
.error-page { min-height: 70vh; display: flex; align-items: center; }
.error-code { font-size: 6rem; font-weight: 800; line-height: 1; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Phase 1A sections ---------- */
.section { padding: 1.5rem 0; }
.section-alt { background: var(--bg-2); }
.x-small { font-size: .75rem; }

/* Step + feature cards */
.step-card, .feature-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; height: 100%;
}
.step-card i, .feature-card i { font-size: 1.6rem; color: var(--primary); }

/* Pricing cards */
.pricing-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.5rem; height: 100%; position: relative;
}
.pricing-featured {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary), var(--shadow);
}
.pricing-badge {
  position: absolute; top: -10px; right: 16px;
  background: var(--primary); color: var(--primary-fg);
  font-size: .7rem; font-weight: 600; padding: .2rem .55rem; border-radius: 999px;
}
.pricing-price { display: flex; align-items: baseline; gap: .15rem; margin: .5rem 0; }
.pricing-currency { font-size: 1rem; color: var(--text-muted); }
.pricing-amount { font-size: 2.4rem; font-weight: 800; line-height: 1; }

/* Testimonials */
.testimonial-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; height: 100%;
}
.testimonial-stars { color: var(--warning); margin-bottom: .5rem; }
.testimonial-content { font-style: italic; color: var(--text); }
.testimonial-author { display: flex; align-items: center; gap: .75rem; margin-top: 1rem; }
.testimonial-avatar {
  width: 40px; height: 40px; border-radius: 999px; object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
}
.testimonial-avatar-fallback {
  background: var(--surface-2); color: var(--text-muted); font-weight: 700;
}

/* Blog cards */
.blog-card-link { color: inherit; text-decoration: none; display: block; height: 100%; }
.blog-card-link:hover { color: inherit; text-decoration: none; }
.blog-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  height: 100%; overflow: hidden; transition: transform .15s, border-color .15s;
}
.blog-card-link:hover .blog-card { transform: translateY(-2px); border-color: var(--primary); }
.blog-cover { height: 160px; background-size: cover; background-position: center; background-color: var(--surface-2); }
.blog-card-body { padding: 1rem; }
.blog-hero-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); }
.blog-content { font-size: 1.05rem; line-height: 1.7; }
.blog-content h2, .blog-content h3 { margin-top: 2rem; }
.blog-content img { max-width: 100%; border-radius: var(--radius-sm); margin: 1rem 0; }
.blog-content code { background: var(--surface-2); padding: .15rem .4rem; border-radius: 4px; font-size: .9em; }
.blog-content pre { background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 1rem; overflow-x: auto; }
.blog-content blockquote {
  border-left: 3px solid var(--primary); padding-left: 1rem; color: var(--text-muted); margin: 1rem 0;
}

/* Legal content typography */
.legal-content { font-size: 1rem; line-height: 1.7; }
.legal-content h2, .legal-content h3 { margin-top: 2rem; margin-bottom: .75rem; }
.legal-content p { margin-bottom: 1rem; }
.legal-content ul, .legal-content ol { margin-bottom: 1rem; padding-left: 1.5rem; }

/* How it works numbered steps */
.howstep {
  display: flex; gap: 1.25rem; padding: 1.5rem 0; border-bottom: 1px solid var(--border);
}
.howstep:last-child { border-bottom: 0; }
.howstep-num {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: var(--primary-fg); font-weight: 800; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
}
.howstep-body { flex: 1; }
.howstep-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.howstep-head i { font-size: 1.2rem; color: var(--primary); }

/* Job list */
.job-list { display: flex; flex-direction: column; gap: .5rem; }
.job-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; color: inherit; text-decoration: none;
  transition: border-color .15s, transform .15s;
}
.job-row:hover { border-color: var(--primary); color: inherit; text-decoration: none; transform: translateY(-1px); }
.job-row-main { flex: 1; }
.job-row-cta { flex-shrink: 0; }

/* CTA section */
.cta-section {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 12%, transparent),
    color-mix(in srgb, var(--primary-2) 8%, transparent)
  );
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ---------- Phase 1B: promo widget ---------- */
.reepy-promo {
  position: fixed;
  z-index: 1060;
  font-family: inherit;
}
.reepy-promo[hidden] { display: none !important; }

.reepy-promo-popup,
.reepy-promo-exit_intent {
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  padding: 1rem;
}
.reepy-promo-popup .reepy-promo-card,
.reepy-promo-exit_intent .reepy-promo-card {
  max-width: 440px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
  text-align: center;
}

.reepy-promo-banner {
  top: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}
.reepy-promo-banner .reepy-promo-card {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0.75rem 3rem 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  text-align: left;
}
.reepy-promo-banner .reepy-promo-headline { margin: 0; font-size: 1rem; }
.reepy-promo-banner .reepy-promo-content  { margin: 0; flex: 1; font-size: .9rem; }
.reepy-promo-banner .reepy-promo-image { display: none; }

.reepy-promo-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
}
.reepy-promo-close:hover { background: var(--surface-2); color: var(--text); }

.reepy-promo-image {
  max-width: 100%;
  max-height: 180px;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}
.reepy-promo-headline {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
}
.reepy-promo-content {
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.reepy-promo-cta {
  margin-top: 0.5rem;
}

/* ---------- Phase 2A: workspace cards + keyword tags ---------- */
.workspace-card-link { color: inherit; text-decoration: none; display: block; height: 100%; }
.workspace-card-link:hover { color: inherit; text-decoration: none; }
.workspace-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  height: 100%;
  transition: transform .15s, border-color .15s;
}
.workspace-card-link:hover .workspace-card {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.kw-tag {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text);
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .75rem;
  margin: .125rem;
  border: 1px solid var(--border);
}
.kw-tag-exclude {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.kw-tag-sub {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
  color: var(--primary);
}

/* ---------- Phase 2B: mentions Kanban ---------- */
.kanban-row { align-items: stretch; }
.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 100%;
  display: flex;
  flex-direction: column;
}
.kanban-col-header {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.kanban-col-body {
  padding: .5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-height: 70vh;
  overflow-y: auto;
}
.mention-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem;
  font-size: .875rem;
  transition: border-color .15s;
}
.mention-card:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }

.dot {
  display: inline-block;
  width: .6rem;
  height: .6rem;
  border-radius: 50%;
  margin-right: .25rem;
  vertical-align: middle;
}
.dot-primary   { background: var(--primary); }
.dot-success   { background: var(--success); }
.dot-secondary { background: var(--text-muted); }
.dot-info      { background: #5bc0de; }

.btn-xs {
  padding: .15rem .4rem;
  font-size: .75rem;
  line-height: 1.2;
}
.x-small { font-size: .75rem; }

/* ---------- Phase 3A: reply card ---------- */
.reply-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem;
  font-size: .875rem;
}
.reply-card .reply-body {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: .5rem .65rem;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: .8125rem;
  line-height: 1.5;
}
.dot-warning { background: var(--warning, #f0ad4e); }
.dot-info    { background: #5bc0de; }

/* ---------- Phase 7: launch polish ---------- */

/* Mobile sidebar slide-in fix */
@media (max-width: 991.98px) {
  .reepy-sidebar { transition: transform .25s ease; }
  .reepy-content { padding: 1rem; }
  .content-header h1 { font-size: 1.5rem; }
  .pricing-card .pricing-amount { font-size: 2.25rem; }
  table.table-sm td, table.table-sm th { padding: .35rem .5rem; }
}

/* Dark theme contrast nudges (improves AA on small text) */
[data-theme="dark-default"] .text-muted,
[data-theme="dark"] .text-muted { color: #b8c0cc !important; }
[data-theme="dark-default"] .form-text,
[data-theme="dark"] .form-text { color: #aab2bf; }
[data-theme="dark-default"] code,
[data-theme="dark"] code { color: #e6c07b; }

/* Maintenance/beta full-page visual is inline in site-mode middleware */

/* Tables: avoid overflow on narrow screens */
.table-responsive table th, .table-responsive table td { white-space: normal; }
.x-small { font-size: .72rem; }
