/* ============================================================
   Qevranoxa - Professional Theme Enhancement Layer
   Loaded after style.css. Refines typography, depth, motion,
   and adds Support Center components. Safe to disable.
   ============================================================ */

/* ------------------------------------------------------------
   Foundations
   ------------------------------------------------------------ */
:root {
  --focus-ring: 0 0 0 3px rgba(16, 185, 129, 0.35);
  --grad-brand: linear-gradient(135deg, #10b981 0%, #059669 55%, #047857 100%);
  --grad-hero-mesh:
    radial-gradient(ellipse 80% 60% at 85% -10%, rgba(16, 185, 129, 0.16), transparent 60%),
    radial-gradient(ellipse 60% 50% at -10% 30%, rgba(59, 130, 246, 0.08), transparent 55%),
    linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}

::selection {
  background: rgba(16, 185, 129, 0.22);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 6px;
}

body {
  font-size: 15px;
  letter-spacing: -0.006em;
}

h1 { letter-spacing: -0.03em; }
h2 { letter-spacing: -0.025em; }
h3 { letter-spacing: -0.015em; }

/* Slim branded scrollbars */
* { scrollbar-width: thin; scrollbar-color: #cbd5e1 transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
*::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------------------------------------
   Navigation - frosted glass, gradient active state
   ------------------------------------------------------------ */
.nav {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

.nav-links > a,
.dropdown > button {
  position: relative;
  font-weight: 600;
}

.nav-links > a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 2px;
  height: 2.5px;
  border-radius: 999px;
  background: var(--grad-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease-out-quint);
}

.nav-links > a:hover::after,
.nav-links > a.active::after {
  transform: scaleX(1);
}

.brand .mark {
  transition: transform 0.25s var(--ease-out-quint);
}
.brand:hover .mark {
  transform: rotate(-6deg) scale(1.06);
}

/* ------------------------------------------------------------
   Hero & public sections
   ------------------------------------------------------------ */
.hero {
  background: var(--grad-hero-mesh);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at 50% 0%, black 30%, transparent 75%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: clamp(2rem, 4.4vw, 3.3rem);
  font-weight: 800;
}

.hero h1 .highlight {
  background: linear-gradient(120deg, #10b981 10%, #0d9488 60%, #0284c7 110%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tag-pill {
  backdrop-filter: blur(6px);
  border: 1px solid rgba(16, 185, 129, 0.28) !important;
  box-shadow: 0 4px 18px rgba(16, 185, 129, 0.12);
}

.hero-widget-card {
  box-shadow: 0 24px 70px -20px rgba(15, 23, 42, 0.45), 0 8px 24px -12px rgba(16, 185, 129, 0.25) !important;
}

/* Section rhythm */
.section { padding: clamp(56px, 8vw, 96px) clamp(16px, 3vw, 24px); }

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 6px 14px;
  border-radius: 999px;
}

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  position: relative;
  overflow: hidden;
  transition: transform 0.18s var(--ease-out-quint), box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn-primary {
  background: var(--grad-brand);
  box-shadow: 0 6px 16px -6px rgba(5, 150, 105, 0.55);
}

.btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 10px 22px -8px rgba(5, 150, 105, 0.6);
  filter: saturate(1.08);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost:hover {
  border-color: var(--primary-light);
  color: var(--primary-deep);
  background: var(--primary-faint);
}

.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.55s ease;
  pointer-events: none;
}

.btn-primary:hover::after { left: 130%; }

/* ------------------------------------------------------------
   Cards & tiles
   ------------------------------------------------------------ */
.card {
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s var(--ease-out-quint);
}

a.feature-card,
button.feature-card {
  transition: transform 0.22s var(--ease-out-quint), box-shadow 0.22s ease, border-color 0.22s ease;
}

a.feature-card:hover,
button.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(16, 185, 129, 0.35);
}

a.feature-card:hover .ico,
button.feature-card:hover .ico {
  transform: scale(1.08);
}

.feature-card .ico {
  transition: transform 0.22s var(--ease-out-quint);
}

.stat-tile {
  position: relative;
  overflow: hidden;
}

.stat-tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.stat-tile:hover::before { opacity: 1; }
.stat-tile.green::before { opacity: 1; }

.stat-tile .value {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ------------------------------------------------------------
   Tables
   ------------------------------------------------------------ */
.table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--line-light);
}

.table tbody tr {
  transition: background 0.15s ease;
}

.table tbody tr:hover {
  background: var(--primary-faint);
}

.table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.table-wrap { position: relative; }
.table-wrap::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 28px;
  background: linear-gradient(270deg, #ffffff 20%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.table-wrap.is-scrollable::after { opacity: 1; }

/* ------------------------------------------------------------
   Badges & status
   ------------------------------------------------------------ */
.badge {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.badge-pending .badge-dot {
  animation: vp-pulse-dot 1.6s ease-in-out infinite;
}

@keyframes vp-pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
input.form-control,
select,
textarea,
.field input,
.field select,
.field textarea {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: var(--focus-ring) !important;
}

.field label {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hint { color: var(--muted-light); }

/* ------------------------------------------------------------
   Alerts
   ------------------------------------------------------------ */
.alert {
  border-left-width: 4px;
  border-left-style: solid;
}

.alert-success { border-left-color: var(--success); }
.alert-error, .alert-danger { border-left-color: var(--danger); }
.alert-info { border-left-color: var(--info); }
.alert-warn, .alert-warning { border-left-color: var(--warn); }

/* ------------------------------------------------------------
   Dashboard sidebar & shell
   ------------------------------------------------------------ */
.sidebar {
  background: linear-gradient(180deg, #0b132b 0%, #0f172a 55%, #111c33 100%);
}

.sidebar a,
.sidebar .nav-link-btn {
  border-radius: 10px;
  margin: 2px 10px;
  padding: 6px 12px;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s var(--ease-out-quint);
}

/* Compact separators between menu groups */
.sidebar .sep {
  margin: 6px 14px !important;
  opacity: 0.5;
}

.sidebar a:hover,
.sidebar .nav-link-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  transform: translateX(2px);
  color: #ffffff;
}

.sidebar a.active {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.22), rgba(16, 185, 129, 0.08));
  color: #ffffff;
  box-shadow: inset 3px 0 0 var(--primary);
}

.mobile-top-header {
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
}

/* ------------------------------------------------------------
   AI chat widget refinement
   ------------------------------------------------------------ */
.flw-ai-card {
  box-shadow: 0 30px 80px -20px rgba(15, 23, 42, 0.45), 0 12px 32px -16px rgba(16, 185, 129, 0.3);
}

.flw-ai-head {
  background: var(--grad-brand);
}

.flw-ai-head .flw-title,
.flw-ai-head .flw-sub { color: #ffffff !important; }
.flw-ai-head .flw-sub { opacity: 0.85; }

.flw-avatar {
  background: rgba(255, 255, 255, 0.18) !important;
  color: #ffffff !important;
}

.flw-btn-icon {
  color: rgba(255, 255, 255, 0.92) !important;
  background: rgba(255, 255, 255, 0.14) !important;
  transition: background 0.16s ease, transform 0.16s ease;
}
.flw-btn-icon:hover { background: rgba(255, 255, 255, 0.26) !important; transform: scale(1.06); }

.flw-msg-bubble {
  line-height: 1.55;
}

.flw-msg.bot .flw-msg-bubble {
  background: #f1f5f9;
  border: 1px solid var(--line);
}

.flw-typing span {
  animation: vp-typing-bounce 1.2s infinite;
}
.flw-typing span:nth-child(2) { animation-delay: 0.15s; }
.flw-typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes vp-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.flw-topic-card {
  transition: transform 0.18s var(--ease-out-quint), box-shadow 0.18s ease, border-color 0.18s ease;
}
.flw-topic-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: rgba(16, 185, 129, 0.4);
}

.flw-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0 6px;
}

.flw-chip {
  appearance: none;
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: #ffffff;
  color: #047857;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s var(--ease-out-quint), box-shadow 0.15s ease;
}

.flw-chip:hover {
  background: var(--primary-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.flw-chip-escalate {
  border-color: rgba(37, 211, 102, 0.55);
  color: #128c4b;
}

/* ------------------------------------------------------------
   Chat widget placement — phones, notches, keyboards, PWA nav
   ------------------------------------------------------------ */
@media (max-width: 640px) {
  body.page-pricing .flw-ai-launcher {
    bottom: calc(78px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .flw-ai-launcher {
    right: calc(14px + env(safe-area-inset-right, 0px)) !important;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* App-like sheet on phones */
  .flw-ai-card,
  .flw-ai-card.open {
    right: 10px !important;
    left: auto !important;
    width: min(94vw, 340px) !important;
    max-width: none !important;
    height: 70vh;
    height: min(72dvh, 500px) !important;
    max-height: none !important;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Dashboard pages: lift above the 64px mobile PWA navigation bar. */
  body.has-bottom-nav .flw-ai-launcher {
    right: 16px !important;
    bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
  }
  body.has-bottom-nav .flw-ai-card,
  body.has-bottom-nav .flw-ai-card.open {
    width: min(92vw, 330px) !important;
    height: 56vh;
    height: min(56dvh, 430px) !important;
    bottom: calc(130px + env(safe-area-inset-bottom, 0px)) !important;
  }

  /* Keep scrollable page content clear of the floating bubble and nav bar,
     so buttons near the end of long pages (e.g. Profile) stay tappable. */
  body.has-bottom-nav .main {
    padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px));
  }

  /* Public pages: footer links must not hide behind the bubble either. */
  .site-foot {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  }
}

/* Landscape phones: keep the card fully on screen beside the keyboard. */
@media (max-height: 520px) and (orientation: landscape) {
  .flw-ai-card,
  .flw-ai-card.open {
    top: 12px;
    bottom: auto;
    height: calc(100vh - 90px);
    height: calc(100dvh - 90px);
    width: min(60vw, 380px);
  }
}

/* ------------------------------------------------------------
   Support Center components
   ------------------------------------------------------------ */
.ticket-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.ticket-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.ticket-status.open { background: var(--warn-soft); color: var(--warn-text); }
.ticket-status.open::before { animation: vp-pulse-dot 1.6s infinite; }
.ticket-status.answered { background: var(--info-soft); color: var(--info-text); }
.ticket-status.closed { background: var(--success-soft); color: var(--success-text); }

.ticket-priority {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 6px;
}
.ticket-priority.low { background: var(--line-light); color: var(--muted); }
.ticket-priority.normal { background: var(--info-soft); color: var(--info-text); }
.ticket-priority.high { background: var(--danger-soft); color: var(--danger-text); }

.ticket-category {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: var(--line-light);
  border: 1px solid var(--line);
  padding: 3px 10px;
  border-radius: 999px;
}

.thread { display: grid; gap: 14px; }

.thread-msg {
  max-width: min(88%, 720px);
  padding: 13px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.6;
  box-shadow: var(--shadow-xs);
  word-break: break-word;
}

.thread-msg.user {
  justify-self: end;
  background: var(--primary-soft);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-bottom-right-radius: 5px;
}

.thread-msg.staff {
  justify-self: start;
  background: #eef2ff;
  border: 1px solid #dbe3ff;
  border-bottom-left-radius: 5px;
}

.thread-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 7px;
}

.staff-chip {
  display: inline-block;
  background: var(--navy);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 5px;
}

/* ------------------------------------------------------------
   Motion & accessibility
   ------------------------------------------------------------ */
.reveal {
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------
   Responsive refinements
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  body { font-size: 14.5px; }

  .stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .stat-tile { padding: 14px !important; }
  .stat-tile .value { font-size: clamp(15px, 12cqi, 19px) !important; }

  .hero-inner { padding-top: 40px; padding-bottom: 40px; }

  .thread-msg { max-width: 94%; }

  .btn { min-height: 42px; }
  .btn-sm { min-height: 36px; }
}

@media (max-width: 420px) {
  .stat-row { grid-template-columns: 1fr 1fr !important; }
}

/* Fallback for engines without container query support (cqi is dropped there). */
@supports not (container-type: inline-size) {
  @media (max-width: 420px) {
    .stat-tile .value { font-size: 15px !important; }
  }
}
