/* ==========================================================================
   Srigal AI - Global Styling & Mobile Responsive Design System
   Optimized for Mobile Browsers, Webkit In-App WebViews & Facebook Browser
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

:root {
  /* Color Palette - Dark Mode Default (Solid Colors) */
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-card: #172036;
  --bg-surface: #131b2e;
  
  --border-color: rgba(255, 255, 255, 0.12);
  --border-focus: #6366f1;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --primary-accent: #6366f1;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --secondary-accent: #38bdf8;
  --gold-accent: #fbbf24;
  --danger-color: #ef4444;
  --success-color: #10b981;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --font-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-base);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --vh: 1vh;
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-surface: #ffffff;

  --border-color: rgba(0, 0, 0, 0.1);
  --border-focus: #4f46e5;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --primary-accent: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --secondary-accent: #0284c7;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
}

/* --------------------------------------------------------------------------
   GLOBAL SCROLL CONTROL & UNIVERSAL Sleek Custom Scrollbar
   -------------------------------------------------------------------------- */

html, body, * {
    scrollbar-width: thin;
    scrollbar-color: var(--bg-card) transparent;
}

html {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
}

body {
    min-height: 100dvh;
    height: 100dvh;
    margin: 0;
    overflow: hidden;          /* page shell container layout */
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-base);
    padding-top: 0;
}

/* Universal Custom Webkit Scrollbar for all pages & scrollable elements */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--bg-card);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary-accent);
}

/* Universal Link & List Resets */
a, a:link, a:visited, a:hover, a:active {
  text-decoration: none;
}

ul, ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Prevent auto-zoom on iOS / WebKit focus */
input, textarea, select, button {
  font-family: inherit;
  font-size: 16px !important;
  outline: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* Overall App Shell */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;        /* exact viewport — no body-level scroll */
  width: 100%;
  overflow: hidden;
  padding-top: calc(60px + var(--safe-top));
  padding-bottom: var(--safe-bottom);
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Header Navigation (Guaranteed Fixed Top Header)
   -------------------------------------------------------------------------- */

header,
.site-header {
  position: fixed !important;  /* Pinned strictly to top of viewport */
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: auto;
  z-index: 10000;              /* Elevated z-index above all dynamic content */
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  padding: calc(12px + var(--safe-top)) 16px 12px 16px; /* Includes safe inset top */
  backdrop-filter: blur(12px);          /* Frosted glass effect */
  -webkit-backdrop-filter: blur(12px);  /* Safari/WebKit support */
  box-sizing: border-box;
}

.header-container {
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-sizing: border-box;
}

.brand-logo-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-icon-box {
  width: 40px;
  height: 40px;
  background: var(--primary-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
  box-shadow: var(--shadow-sm);
}

.brand-name-text {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.brand-gold { color: var(--gold-accent); }
.brand-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Desktop Navigation Menu */
#site-header-nav {
  display: block;
}

.header-nav-list {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.header-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.header-nav-link:hover,
.header-nav-link.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .header-nav-link {
  color: var(--text-main);
}

[data-theme="light"] .header-nav-link:hover,
[data-theme="light"] .header-nav-link.active {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.06);
}

.header-right-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.theme-toggle-btn,
.mobile-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mobile-toggle-btn {
  display: none;
}

.user-profile-chip,
.user-guest-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.user-profile-chip:hover,
.user-guest-chip:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

[data-theme="light"] .user-profile-chip,
[data-theme="light"] .user-guest-chip {
  border-color: rgba(0, 0, 0, 0.15);
  background: transparent;
  color: var(--text-main);
}

[data-theme="light"] .user-profile-chip:hover,
[data-theme="light"] .user-guest-chip:hover {
  background: rgba(0, 0, 0, 0.06);
}

.user-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Mobile Navigation Drawer
   -------------------------------------------------------------------------- */
.mobile-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1050;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-drawer-overlay.open {
  display: block;
  opacity: 1;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100dvh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 1100;
  display: none;
  flex-direction: column;
  padding: 24px;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
}

.mobile-nav-drawer.open {
  display: flex;
  transform: translateX(0);
}

/* --------------------------------------------------------------------------
   Main Workspace Layout & Direct Chat Shell
   -------------------------------------------------------------------------- */
.main-workspace {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 8px 12px 10px 12px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Welcome Screen Suggestions Row Stack */
.welcome-hero {
  text-align: center;
  padding: 20px 8px;
}

.welcome-icon-box {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  background: var(--primary-gradient);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.suggestions-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
  width: 100%;
}

.suggestion-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  text-align: center;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
  cursor: pointer;
  transition: all 0.2s ease;
}

.suggestion-card:hover {
  border-color: var(--primary-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.suggestion-card i {
  font-size: 18px;
  color: var(--gold-accent);
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggestion-card span {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-main);
  text-align: center;
  line-height: 1.5;
}

/* Hero Media Component */
.hero-image {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.hero-image img {
    display: block;
    width: 500px;
    max-width: 100%;
    height: auto;
    border-radius: 20px;
    object-fit: cover;
    transition: transform .3s ease;
}

.hero-image img:hover {
    transform: scale(1.03);
}

/* --------------------------------------------------------------------------
   Direct Workspace Chat Messages Stream
   -------------------------------------------------------------------------- */
.chat-messages-container,
#chat-messages-container {
  width: 100%;
  flex: 1;              /* grow to fill remaining space */
  min-height: 0;        /* critical: lets flex child shrink below content height */
  display: block;
  padding: 12px 4px;
  overflow-y: auto;     /* messages scroll here, not the page */
  overflow-x: hidden;
  /* Thin custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
  transition: scrollbar-color 0.3s ease;
  scroll-behavior: smooth;
}

.chat-messages-container.scrolling,
#chat-messages-container.scrolling {
  scrollbar-color: var(--primary-accent) transparent;
}

.chat-messages-container::-webkit-scrollbar,
#chat-messages-container::-webkit-scrollbar {
  width: 6px;
}
.chat-messages-container::-webkit-scrollbar-track,
#chat-messages-container::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: var(--radius-pill);
}
.chat-messages-container::-webkit-scrollbar-thumb,
#chat-messages-container::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-pill);
  transition: background 0.3s ease;
}
.chat-messages-container.scrolling::-webkit-scrollbar-thumb,
#chat-messages-container.scrolling::-webkit-scrollbar-thumb {
  background: var(--primary-accent);
}

/* Message Rows & Bubbles */
.message-row {
  display: flex;
  gap: 12px;
  max-width: 95%;   /* wider to accommodate code blocks */
  margin-bottom: 12px;
}

.message-row.user-row {
  margin-left: auto;
  flex-direction: row-reverse;
  margin-top: 20px;
  max-width: 78%;   /* user bubbles stay compact */
}

.message-row.assistant-row {
  margin-top: 20px;
  max-width: 95%;
}

.message-row:first-child {
  margin-top: 0;
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.message-avatar.user-avatar { background: var(--primary-gradient); color: #fff; }
.message-avatar.assistant-avatar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--gold-accent);
  box-shadow: var(--shadow-sm);
}

.jackal-avatar-svg {
  width: 22px;
  height: 22px;
  display: block;
}

.message-bubble {
  padding: 14px 18px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
  overflow-wrap: break-word;
  min-width: 0;
}

.user-bubble {
  background: var(--primary-gradient);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.assistant-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  /* allow assistant bubble to stretch wide for code blocks */
  max-width: 100%;
  overflow: visible;
}

.message-spacer {
    height: 16px;
}

/* Embedded Weather Card in Chat */
.chat-weather-card {
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
}

.chat-weather-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chat-weather-card .card-temp {
  font-size: 26px;
  font-weight: 800;
  color: var(--gold-accent);
}

.chat-weather-card .card-stats {
  display: flex;
  gap: 14px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Embedded Image Grid */
.chat-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.chat-image-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 4/3;
  cursor: pointer;
  border: 1px solid var(--border-color);
}

.chat-image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-image-card .image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85), transparent);
  opacity: 0;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  transition: opacity 0.2s ease;
  color: #fff;
  font-size: 12px;
}

.chat-image-card:hover .image-overlay { opacity: 1; }

/* Lightbox Modal */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.lightbox-modal.active { opacity: 1; pointer-events: auto; }

.lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 85vh;
}

.lightbox-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--radius-md);
}

.lightbox-close {
  position: absolute;
  top: -36px;
  right: 0;
  color: #fff;
  font-size: 30px;
}

/* Typing Indicator */
.typing-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.typing-indicator .dot {
  width: 6px;
  height: 6px;
  background: var(--primary-accent);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-indicator .dot:nth-child(1) { animation-delay: 0s; }
.typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* --------------------------------------------------------------------------
   Input Controls Box & Antigravity Model Selector Below Input
   -------------------------------------------------------------------------- */
.chat-input-wrapper {
  padding: 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  flex-shrink: 0;   /* never shrink — always visible at the bottom */
  margin-top: 8px;  /* small gap above the input box */
}

.input-box-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  width: 100%;
}

.input-box-row:focus-within {
  border-color: var(--border-focus);
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  resize: none;
  max-height: 100px;
  min-height: 28px;
  line-height: 1.4;
  font-size: 15px !important;
  min-width: 0;
}

.action-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.action-icon-btn:hover { color: var(--text-main); background: rgba(255,255,255,0.08); }

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease;
}

.send-btn:hover { transform: scale(1.05); }

/* Antigravity Model Selector Bar */
.input-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  width: 100%;
}

.antigravity-dropdown-container {
  position: relative;
  flex-shrink: 0;
}

.antigravity-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.antigravity-pill-btn:hover {
  border-color: var(--primary-accent);
}

.antigravity-dropdown-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 260px;
  max-width: 90vw;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 1000;
}

.antigravity-dropdown-menu.active {
  display: flex;
}

.antigravity-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s ease;
}

.antigravity-option:hover,
.antigravity-option.selected {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .antigravity-option:hover,
[data-theme="light"] .antigravity-option.selected {
  background: rgba(0, 0, 0, 0.05);
}

.opt-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-accent);
  flex-shrink: 0;
}

.opt-details { display: flex; flex-direction: column; }
.opt-title { font-size: 13px; font-weight: 600; color: var(--text-main); }
.opt-desc { font-size: 11px; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Page Specific Layouts (Weather, History, Auth, Admin)
   -------------------------------------------------------------------------- */
.page-container {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px calc(64px + var(--safe-bottom)) 16px;
  /* Weather, History, Auth, Subscription, Admin pages: allow smooth scrolling */
  overflow-y: auto;
  height: 100%;
  box-sizing: border-box;
}

.bottom-spacer {
  height: 5px;
  width: 100%;
  clear: both;
  display: block;
}

.page-header {
  margin-bottom: 20px;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-muted);
  font-size: 14px;
}

/* Clickable links inside chat bubbles (product titles, upgrade links) */
.chat-link {
  color: var(--primary-accent);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.chat-link:hover {
  color: #818cf8;
  border-bottom-color: #818cf8;
}
.assistant-bubble .chat-link {
  color: #a5b4fc;
}
.assistant-bubble .chat-link:hover {
  color: #c7d2fe;
  border-bottom-color: #c7d2fe;
}

/* Code Block with Copy Button */
.code-block-wrapper {
  position: relative;
  margin: 10px 0;
  border-radius: var(--radius-md);
  /* IMPORTANT: overflow visible so absolutely-positioned button is never clipped */
  overflow: visible;
}

.code-block-wrapper pre.code-block {
  background: #0d1117;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md);
  margin: 0;
  padding: 40px 16px 14px 16px; /* top space for toolbar row */
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
  white-space: pre;       /* keep indentation */
}

.code-block-wrapper pre.code-block code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
  color: #e6edf3;
  white-space: inherit;
  word-break: normal;
  display: block;
}

/* Toolbar strip sitting inside the pre, pinned at top */
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(99, 102, 241, 0.18);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #94a3b8;
  border-radius: 6px;
  padding: 4px 11px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  letter-spacing: 0.3px;
  z-index: 10;
  /* ensure button is always clickable even over code text */
  pointer-events: auto;
}

.code-copy-btn:hover {
  background: rgba(99, 102, 241, 0.35);
  border-color: var(--primary-accent);
  color: #ffffff;
  transform: translateY(-1px);
}

.code-copy-btn.copied {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #10b981;
}

/* lang label on top-left of code block */
.code-lang-label {
  position: absolute;
  top: 10px;
  left: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #6366f1;
  letter-spacing: 0.8px;
  font-family: var(--font-heading);
  z-index: 10;
  pointer-events: none;
  user-select: none;
}

/* AI Shopping Assistant Thinking Process Block */
.thinking-block {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-muted);
}
.thinking-block summary {
  font-weight: 700;
  color: var(--primary-accent);
  cursor: pointer;
  outline: none;
  font-family: var(--font-heading);
  user-select: none;
}
.thinking-block summary::-webkit-details-marker {
  color: var(--primary-accent);
}

/* Shopping Country Picker Widget */
.shop-country-bubble {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 16px;
  border-radius: var(--radius-lg);
  max-width: 580px;
}
.shop-country-header {
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.shop-country-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.shop-country-chip {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}
.shop-country-chip:hover {
  border-color: var(--primary-accent);
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary-accent);
}
.shop-country-chip.selected {
  background: var(--primary-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* History Cards */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mode-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-accent);
}

.card-title { font-size: 15px; font-weight: 700; }
.card-snippet { font-size: 13px; color: var(--text-muted); line-height: 1.4; }

.card-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Form & Admin Styles */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.form-group {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-primary);
  color: var(--text-main);
}

.form-input.sm-input { padding: 6px 8px; font-size: 13px !important; }

/* Buttons */
.primary-btn {
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-sm);
}

.danger-btn {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  background: var(--danger-color);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.sm-btn {
    padding: 6px 12px;
    font-size: 12px;
    color: #fff;
}

/* Menu Table */
.menu-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.menu-table th, .menu-table td {
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

/* --------------------------------------------------------------------------
   Footer Navigation (Sticky Bottom Footer)
   -------------------------------------------------------------------------- */
.site-footer {
  position: sticky;
  bottom: 0;
  z-index: 1000;
  flex-shrink: 0;
  margin-top: auto;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-top: 1px solid var(--border-color);
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-top {
  display: flex;
  justify-content: center;
  align-items: center;
}

.footer-links-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
}

#site-footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  width: 100%;
}

.footer-nav-link {
  font-size: 13px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  text-align: center;
}

.footer-nav-link:hover {
  color: var(--primary-accent);
}

.footer-right-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.footer-right-actions #footer-user-badge {
    margin-right: auto;
}

.footer-right-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
}

.footer-bottom {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 8px;
}

/* Delete button icon */
.delete-btn,
.delete-btn i {
    color: #ffffff !important;
}

/* --------------------------------------------------------------------------
   Media Queries for Mobile & Webkit In-App WebViews (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  #site-header-nav,
  .header-nav-list {
    display: none !important;
  }

  .mobile-toggle-btn {
    display: flex !important;
  }

  .header-container {
    padding: 0;
  }

  .main-workspace {
    padding: 4px 8px 6px 8px;
  }

  .welcome-hero {
    padding: 10px 4px;
  }

  .message-row {
    max-width: 96%;
    gap: 8px;
    margin-bottom: 8px;
  }

  .message-avatar {
    width: 30px;
    height: 30px;
  }

  .message-bubble {
    padding: 10px 14px;
    font-size: 14px;
  }

  .chat-input-wrapper {
    padding: 8px 10px;
    gap: 6px;
    border-radius: var(--radius-md);
    margin-top: 2px;
  }

  .input-box-row {
    padding: 4px 8px;
    gap: 6px;
  }

  .chat-textarea {
    font-size: 16px !important; /* Prevents auto-zoom on iOS */
    min-height: 24px;
  }

  .send-btn,
  .action-icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    touch-action: manipulation;
  }

  .suggestions-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    text-align: center;
  }

  .suggestion-card {
    padding: 10px 14px;
    font-size: 14px;
  }

  .suggestions-grid > * {
    text-align: center;
  }

  .history-grid {
    grid-template-columns: 1fr;
  }

  .user-name-label {
    display: none;
  }

  #site-footer-nav {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
  }

  .footer-nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: auto;
  }

  .hero-image img {
    width: 90%;
    border-radius: 16px;
  }
}

/* ==========================================================================
   Subscription & bKash / Nagad Payment Gateway Styling
   ========================================================================== */

.pro-badge {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #0f172a;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: var(--radius-pill);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.plan-toggle-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    background: var(--bg-card);
    padding: 6px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    max-width: 320px;
    margin: 0 auto 24px;
}

.plan-toggle-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.plan-toggle-btn.active {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: var(--shadow-sm);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}

.pricing-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25 ease;
}

.pricing-card:hover {
    border-color: var(--primary-accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.pricing-card.featured {
    border: 2px solid var(--gold-accent);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(251, 191, 36, 0.06) 100%);
}

.pricing-ribbon {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--gold-accent);
    color: #000;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 12px;
    border-radius: var(--radius-pill);
    text-transform: uppercase;
}

.pricing-header h3 {
    font-size: 20px;
    font-family: var(--font-heading);
    margin-bottom: 6px;
}

.pricing-price {
    font-size: 32px;
    font-weight: 900;
    font-family: var(--font-heading);
    color: var(--text-main);
    margin: 14px 0;
}

.pricing-price span {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.pricing-features {
    list-style: none;
    margin: 16px 0 24px;
    padding: 0;
}

.pricing-features li {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pricing-features li i {
    color: var(--success-color);
    font-size: 14px;
}

/* Payment Gateway Selector & Modal */
.payment-methods-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 16px 0;
}

.payment-method-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s ease;
}

.payment-method-btn:hover,
.payment-method-btn.selected {
    border-color: var(--primary-accent);
    background: rgba(99, 102, 241, 0.1);
}

.payment-method-btn.bkash-btn.selected {
    border-color: #e2136e;
    background: rgba(226, 19, 110, 0.12);
}

.payment-method-btn.nagad-btn.selected {
    border-color: #f7921e;
    background: rgba(247, 146, 30, 0.12);
}

.payment-icon-img {
    height: 32px;
    width: auto;
    object-fit: contain;
}

.instruction-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 16px 0;
}

.copy-number-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin: 10px 0;
    border: 1px dashed var(--border-color);
}

.copy-number-row strong {
    font-family: monospace;
    font-size: 16px;
    color: var(--gold-accent);
    letter-spacing: 1px;
}

.sub-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.sub-modal-backdrop.active {
    display: flex;
}

.sub-modal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    box-shadow: var(--shadow-lg);
}

.sub-modal-close {
    position: absolute;
    top: 18px;
    right: 20px;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
}

.sub-modal-close:hover {
    color: var(--text-main);
}

/* Premium Weather Section Styles */
.weather-hero-card {
    background: linear-gradient(135deg, rgba(19, 27, 46, 0.9) 0%, rgba(99, 102, 241, 0.25) 50%, rgba(251, 191, 36, 0.15) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    padding: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.weather-hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.weather-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 14px;
    margin-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 18px;
}

.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 12px 14px;
    border-radius: var(--radius-md);
    transition: transform 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary-accent);
}

.weather-forecast-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.forecast-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    text-align: center;
    font-size: 12px;
}

.forecast-card i {
    font-size: 20px;
    margin: 8px 0;
    color: var(--gold-accent);
}

.premium-lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 15, 25, 0.90);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    z-index: 10;
    padding: 20px;
    text-align: center;
    opacity: 0;
    animation: lockOverlayBgFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes lockOverlayBgFade {
    0% {
        opacity: 0;
        backdrop-filter: blur(0px);
        -webkit-backdrop-filter: blur(0px);
    }
    100% {
        opacity: 1;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
}

/* Hide lock overlay text initially; display text only after full loading of the overlay background */
.premium-lock-overlay > * {
    opacity: 0;
    transform: translateY(8px);
    animation: lockTextContentFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.35s forwards;
}

@keyframes lockTextContentFade {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}


