/* ─── components.css ─────────────────────────────────────────────────────────
   Shared UI components: navbar, footer, chat widget, review modal.
   Applies to every page.
   ─────────────────────────────────────────────────────────────────────────── */

/* ─── Navbar ─────────────────────────────────────────────────────────────────*/
.navbar {
  position:    fixed;
  top: 0; left: 0; right: 0;
  z-index:     1000;
  background:  rgba(5, 5, 8, 0.75);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition:  background 0.3s ease;
}
.navbar.scrolled { background: rgba(5, 5, 8, 0.97); }

.navbar-inner {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  height:          var(--nav-h);
  gap:             1rem;
}
.nav-logo {
  display:     flex;
  align-items: center;
  flex-shrink: 0;
  font-size:   1.35rem;
  font-weight: 800;
  color:       var(--accent);
  letter-spacing: -0.02em;
}
.nav-logo span { color: var(--accent2); }
.nav-logo-img {
  height:        54px;
  width:         54px;
  object-fit:    contain;
  border-radius: 10px;
  display:       block;
  filter:        drop-shadow(0 0 8px rgba(124,92,252,0.4));
}
.footer-logo-img {
  height: 72px;
  width:  72px;
  border-radius: 12px;
}

.nav-links {
  display:         flex;
  align-items:     center;
  gap:             0.15rem;
  flex:            1;
  justify-content: center;
}
.nav-links a {
  padding:     0.38rem 0.8rem;
  border-radius: 8px;
  font-size:   0.88rem;
  font-weight: 500;
  color:       var(--text-muted);
  transition:  color 0.2s, background 0.2s;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active { color: var(--text); background: var(--glass); }

.nav-right {
  display:     flex;
  align-items: center;
  gap:         0.65rem;
  flex-shrink: 0;
}

/* Language switcher */
.lang-switcher { position: relative; }
.lang-btn {
  display:     flex;
  align-items: center;
  gap:         0.3rem;
  padding:     0.38rem 0.7rem;
  border:      1px solid var(--border);
  border-radius: 8px;
  font-size:   0.83rem;
  color:       var(--text-muted);
  background:  var(--glass);
  transition:  all 0.2s;
  white-space: nowrap;
}
.lang-btn:hover { color: var(--text); border-color: var(--accent); }

.lang-dropdown {
  position:   absolute;
  top:        calc(100% + 6px);
  right:      0;
  background: var(--surface);
  border:     1px solid var(--border);
  border-radius: var(--radius);
  min-width:  130px;
  overflow:   hidden;
  display:    none;
  box-shadow: var(--shadow);
  z-index:    1100;
}
.lang-dropdown.open { display: block; }
.lang-dropdown button {
  display:    flex;
  align-items: center;
  gap:        0.45rem;
  width:      100%;
  padding:    0.58rem 1rem;
  font-size:  0.87rem;
  color:      var(--text-muted);
  text-align: left;
  transition: background 0.2s, color 0.2s;
}
.lang-dropdown button:hover  { background: var(--glass); color: var(--text); }
.lang-dropdown button.active { color: var(--accent); }

/* Hamburger */
.hamburger {
  display:        none;
  flex-direction: column;
  gap:            5px;
  padding:        6px;
  border-radius:  8px;
}
.hamburger span {
  display:       block;
  width:         22px;
  height:        2px;
  background:    var(--text);
  border-radius: 2px;
  transition:    all 0.3s ease;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Mobile nav */
.mobile-nav {
  display:        none;
  flex-direction: column;
  padding:        0.85rem 1.5rem 1.25rem;
  gap:            0.2rem;
  border-top:     1px solid var(--border);
  background:     rgba(5, 5, 8, 0.98);
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
  padding:      0.6rem 0.75rem;
  border-radius: 8px;
  font-size:    0.93rem;
  color:        var(--text-muted);
  transition:   color 0.2s, background 0.2s;
}
.mobile-nav a:hover { color: var(--text); background: var(--glass); }
.mobile-nav-bottom  { display: flex; gap: 0.75rem; margin-top: 0.75rem; flex-wrap: wrap; }

@media (max-width: 768px) {
  .nav-links     { display: none; }
  .hamburger     { display: flex; }
  .nav-trial-btn { display: none; }
  .nav-logo-img  { height: 46px; width: 46px; }
  .navbar-inner  { height: 58px; }
}
@media (max-width: 480px) {
  .lang-btn .lang-label { display: none; }
  .nav-logo-img { height: 42px; width: 42px; }
  .navbar-inner { height: 54px; }
  .mobile-nav a { font-size: 1rem; padding: 0.75rem 1rem; min-height: 48px; display: flex; align-items: center; }
}

/* ─── Footer ─────────────────────────────────────────────────────────────────*/
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding:    4rem 0 2rem;
}
.footer-grid {
  display:               grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap:                   3rem;
  margin-bottom:         3rem;
}
.footer-brand p { margin-top: 0.75rem; font-size: 0.9rem; max-width: 260px; }
.footer-social  { display: flex; gap: 0.65rem; margin-top: 1.2rem; }
.social-btn {
  display:         flex;
  align-items:     center;
  justify-content: center;
  width:  38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1.1rem;
  transition: all 0.25s ease;
}
.social-btn:hover {
  border-color: var(--accent);
  background:   rgba(124, 92, 252, 0.1);
  transform:    translateY(-2px);
}
.footer-col h4 {
  font-size:      0.82rem;
  font-weight:    700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color:          var(--text-muted);
  margin-bottom:  1rem;
}
.footer-col li { margin-bottom: 0.6rem; }
.footer-col a  { font-size: 0.9rem; color: var(--text-muted); transition: color 0.2s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom {
  display:         flex;
  align-items:     center;
  justify-content: space-between;
  padding-top:     2rem;
  border-top:      1px solid var(--border);
  font-size:       0.84rem;
  color:           var(--text-muted);
  flex-wrap:       wrap;
  gap:             0.75rem;
}

@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr 1fr; gap: 2rem; } .footer-brand { grid-column: 1 / -1; } }
@media (max-width: 600px) { .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; } }
@media (max-width: 400px) { .footer-grid { grid-template-columns: 1fr; } }

/* ─── Chat widget ────────────────────────────────────────────────────────────*/
#chat-widget-root { position: fixed; bottom: 1.75rem; right: 1.75rem; z-index: 8000; }

/* Bubble */
.cw-bubble {
  width:         62px;
  height:        62px;
  background:    linear-gradient(135deg, var(--accent), #9b7dff);
  border-radius: 50%;
  display:       flex;
  align-items:   center;
  justify-content: center;
  overflow:      hidden;
  cursor:        pointer;
  box-shadow:    0 4px 24px rgba(124, 92, 252, 0.65);
  animation:     pulse 2.5s infinite;
  position:      relative;
  user-select:   none;
  transition:    transform 0.2s ease, box-shadow 0.2s;
}
.cw-bubble:hover { transform: scale(1.1); box-shadow: 0 8px 32px rgba(124,92,252,0.8); }
.cw-bubble-logo {
  width: 100%; height: 100%;
  object-fit: contain; border-radius: 50%;
}
.cw-bubble-fallback {
  font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.cw-bubble-badge {
  position:      absolute;
  top: -3px; right: -3px;
  background:    #ff4444;
  color:         #fff;
  width:         20px; height: 20px;
  border-radius: 50%;
  font-size:     0.68rem;
  font-weight:   800;
  display:       flex;
  align-items:   center; justify-content: center;
  border:        2px solid var(--bg);
}

/* Panel */
.cw-panel {
  position:       absolute;
  bottom:         74px;
  right:          0;
  width:          360px;
  height:         530px;
  background:     var(--surface);
  border:         1px solid var(--border);
  border-radius:  var(--radius-lg);
  box-shadow:     0 24px 70px rgba(0,0,0,0.7);
  display:        flex;
  flex-direction: column;
  overflow:       hidden;
  animation:      fadeInUp 0.25s ease;
}
.cw-panel[hidden] { display: none; }

/* Header */
.cw-header {
  display:         flex;
  align-items:     center;
  gap:             0.65rem;
  padding:         0.8rem 1rem;
  background:      linear-gradient(135deg, #5a3fd4, var(--accent), #9b7dff);
  flex-shrink:     0;
}
.cw-header-logo {
  width: 38px; height: 38px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
}
.cw-header-text  { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cw-logo   { font-weight: 800; font-size: 0.97rem; color: #fff; line-height: 1.2; }
.cw-status {
  font-size: 0.72rem; color: rgba(255,255,255,0.9);
  display: flex; align-items: center; gap: 0.3rem; margin-top: 0.1rem;
}
.cw-dot { width: 7px; height: 7px; background: #00e5b0; border-radius: 50%; animation: pulse 1.5s infinite; }
.cw-close { color: rgba(255,255,255,0.75); font-size: 1rem; padding: 0.35rem; border-radius: 6px; transition: all 0.2s; line-height: 1; flex-shrink: 0; }
.cw-close:hover { color: #fff; background: rgba(255,255,255,0.15); }

/* Messages area */
.cw-messages {
  flex:       1;
  overflow-y: auto;
  padding:    1rem 0.9rem;
  display:    flex;
  flex-direction: column;
  gap:        0.55rem;
  scroll-behavior: smooth;
}
.cw-messages::-webkit-scrollbar { width: 4px; }
.cw-messages::-webkit-scrollbar-thumb { background: rgba(124,92,252,0.3); border-radius: 2px; }

/* Message bubbles */
.cw-msg {
  display:   flex;
  align-items: flex-end;
  gap:       0.45rem;
  max-width: 88%;
  opacity:   0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.cw-msg.visible { opacity: 1; transform: none; }
.cw-msg--bot  { align-self: flex-start; }
.cw-msg--user { align-self: flex-end; flex-direction: row-reverse; max-width: 80%; }

.cw-msg-avatar {
  width:         28px; height: 28px;
  border-radius: 50%;
  background:    var(--accent-dim);
  border:        1px solid var(--border);
  overflow:      hidden;
  flex-shrink:   0;
  display:       flex;
  align-items:   center; justify-content: center;
  font-size:     0.9rem;
}
.cw-msg-avatar img { width: 100%; height: 100%; object-fit: contain; }

.cw-msg-bubble {
  padding:       0.6rem 0.85rem;
  border-radius: 16px;
  font-size:     0.86rem;
  line-height:   1.55;
  word-break:    break-word;
}
.cw-bot-name {
  display:     block;
  font-size:   0.7rem;
  font-weight: 600;
  color:       var(--accent);
  margin-bottom: 3px;
  letter-spacing: 0.01em;
}
.cw-msg--bot  .cw-msg-bubble {
  background:    var(--surface2);
  color:         var(--text);
  border-radius: 4px 16px 16px 16px;
  border:        1px solid var(--border);
}
.cw-msg--user .cw-msg-bubble {
  background:    linear-gradient(135deg, var(--accent), #9b7dff);
  color:         #fff;
  border-radius: 16px 16px 4px 16px;
}

/* Typing indicator */
.cw-typing-bubble {
  display:     flex;
  gap:         4px;
  align-items: center;
  padding:     0.7rem 1rem !important;
}
.cw-dot-anim {
  width: 6px; height: 6px;
  background:    var(--text-muted);
  border-radius: 50%;
  animation:     dotBounce 1.3s infinite ease-in-out;
}
.cw-dot-anim:nth-child(2) { animation-delay: 0.18s; }
.cw-dot-anim:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30%           { transform: translateY(-7px); opacity: 1; }
}

/* Quick replies area */
.cw-quick-area {
  padding:     0.6rem 0.85rem;
  display:     flex;
  flex-wrap:   wrap;
  gap:         0.4rem;
  border-top:  1px solid var(--border);
  background:  rgba(10,10,18,0.9);
  min-height:  0;
  max-height:  180px;
  overflow-y:  auto;
  flex-shrink: 0;
}
.cw-quick-area:empty { padding: 0; border-top: none; }

/* Flat pill buttons (contextual small sets) */
.cw-qr-btn {
  padding:       0.4rem 0.85rem;
  background:    rgba(255,255,255,0.04);
  border:        1px solid rgba(124,92,252,0.35);
  border-radius: 50px;
  font-size:     0.8rem;
  font-weight:   500;
  color:         var(--text);
  cursor:        pointer;
  transition:    all 0.15s ease;
  white-space:   nowrap;
}
.cw-qr-btn:hover {
  border-color: var(--accent);
  background:   var(--accent-dim);
  color:        var(--accent);
  transform:    translateY(-1px);
}

/* ─── Collapsible main menu ──────────────────────────────────────────────────*/
.cw-menu-wrap {
  width:    100%;
  position: relative;
}

/* Single trigger pill */
.cw-menu-trigger {
  width:         100%;
  padding:       0.5rem 0.9rem;
  background:    linear-gradient(135deg, rgba(124,92,252,0.15), rgba(155,125,255,0.08));
  border:        1px solid rgba(124,92,252,0.45);
  border-radius: var(--radius);
  color:         var(--text);
  font-size:     0.85rem;
  font-weight:   600;
  display:       flex;
  align-items:   center;
  justify-content: space-between;
  cursor:        pointer;
  transition:    all 0.2s ease;
  letter-spacing: 0.01em;
}
.cw-menu-trigger:hover,
.cw-menu-trigger.open {
  background:   var(--accent-dim);
  border-color: var(--accent);
  color:        var(--accent);
}
.cw-chevron {
  font-size:  0.75rem;
  transition: transform 0.25s ease;
  flex-shrink: 0;
}
.cw-menu-trigger.open .cw-chevron,
.cw-menu-wrap:hover .cw-chevron { transform: rotate(180deg); }

/* Expanded grid — hidden by default */
.cw-menu-grid {
  display:    grid;
  grid-template-columns: 1fr 1fr;
  gap:        0.35rem;
  max-height: 0;
  overflow:   hidden;
  transition: max-height 0.3s ease, margin-top 0.2s ease;
  margin-top: 0;
}
/* Open via JS class (mobile click) */
.cw-menu-grid.open {
  max-height:  260px;
  margin-top:  0.4rem;
}
/* Open via CSS hover (desktop/mouse) */
@media (hover: hover) {
  .cw-menu-wrap:hover .cw-menu-grid {
    max-height: 260px;
    margin-top: 0.4rem;
  }
  .cw-menu-wrap:hover .cw-menu-trigger {
    background:   var(--accent-dim);
    border-color: var(--accent);
    color:        var(--accent);
  }
}
/* Grid items are slightly smaller */
.cw-menu-grid .cw-qr-btn {
  border-radius: var(--radius);
  font-size:     0.78rem;
  padding:       0.42rem 0.6rem;
  text-align:    left;
  white-space:   normal;
  line-height:   1.3;
}

/* Input bar */
.cw-input-bar {
  display:     flex;
  align-items: center;
  gap:         0.5rem;
  padding:     0.7rem 0.9rem;
  border-top:  1px solid var(--border);
  background:  var(--surface);
  flex-shrink: 0;
}
.cw-input-field {
  flex:          1;
  background:    rgba(255,255,255,0.05);
  border:        1px solid var(--border);
  border-radius: 50px;
  padding:       0.52rem 1rem;
  color:         var(--text);
  font-size:     0.86rem;
  outline:       none;
  transition:    border-color 0.2s, background 0.2s;
  font-family:   inherit;
}
.cw-input-field:focus { border-color: var(--accent); background: rgba(124,92,252,0.06); }
.cw-input-field::placeholder { color: var(--text-muted); }
.cw-send-btn {
  width:         36px; height: 36px;
  background:    linear-gradient(135deg, var(--accent), #9b7dff);
  color:         #fff;
  border-radius: 50%;
  display:       flex;
  align-items:   center; justify-content: center;
  flex-shrink:   0;
  transition:    transform 0.2s, opacity 0.2s;
}
.cw-send-btn:hover  { transform: scale(1.1); }
.cw-send-btn:active { transform: scale(0.93); }
.cw-attach-btn {
  width:         32px; height: 32px;
  background:    transparent;
  border:        1px solid var(--border);
  border-radius: 50%;
  color:         var(--text-muted);
  font-size:     1rem;
  display:       flex;
  align-items:   center; justify-content: center;
  flex-shrink:   0;
  cursor:        pointer;
  transition:    background 0.2s, color 0.2s;
}
.cw-attach-btn:hover { background: rgba(124,92,252,0.15); color: var(--accent); border-color: var(--accent); }
.cw-msg-bubble--img { padding: 4px !important; background: transparent !important; border: none !important; }
.cw-msg-img {
  max-width:     220px;
  max-height:    220px;
  border-radius: 12px;
  display:       block;
  cursor:        pointer;
  object-fit:    cover;
  transition:    transform 0.15s;
}
.cw-msg-img:hover { transform: scale(1.03); }

/* ── Link action buttons inside bot messages ────────── */
.cw-link-btn {
  display:         inline-flex;
  align-items:     center;
  gap:             6px;
  margin:          4px 0;
  padding:         9px 16px;
  background:      linear-gradient(135deg, #5b4fcf, #7c5cfc);
  color:           #fff !important;
  border-radius:   22px;
  text-decoration: none;
  font-size:       0.82rem;
  font-weight:     600;
  letter-spacing:  0.01em;
  transition:      transform 0.15s, box-shadow 0.15s;
  box-shadow:      0 2px 8px rgba(91,79,207,0.35);
}
.cw-link-btn:hover {
  transform:   translateY(-1px);
  box-shadow:  0 4px 14px rgba(91,79,207,0.5);
}

/* ─── Mobile: full-screen panel ──────────────────────────────────────────────*/
@media (max-width: 600px) {
  #chat-widget-root { bottom: 1rem; right: 1rem; }
  .cw-panel {
    position:      fixed;
    inset:         0;
    width:         100%;
    height:        100%;
    bottom:        0;
    border-radius: 0;
  }
  .cw-bubble { width: 56px; height: 56px; }
}

/* ─── Review modal ───────────────────────────────────────────────────────────*/
#review-modal .modal-box { max-width: 520px; }
.review-star-picker { display: flex; gap: 0.4rem; margin: 0.75rem 0; }
.review-star-btn {
  font-size:  1.8rem;
  color:      #3a3a5c;
  transition: color 0.15s, transform 0.15s;
  line-height: 1;
}
.review-star-btn.active, .review-star-btn:hover { color: #f59e0b; transform: scale(1.15); }
