/* NAV-INTELEGENCI – HIGH-END RESPONSIVE STYLESHEET (Handy & PC) */
:root {
  --bg-primary: #070b14;
  --bg-secondary: #0d1424;
  --bg-tertiary: #141e33;
  --bg-elevated: rgba(18, 28, 48, 0.85);
  --bg-input: rgba(13, 20, 36, 0.94);
  --bg-user-bubble: linear-gradient(135deg, #0077b6 0%, #1d4ed8 100%);
  --border-subtle: rgba(56, 189, 248, 0.14);
  --border-strong: rgba(56, 189, 248, 0.34);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #00d2ff;
  --accent-blue: #2563eb;
  --accent-gradient: linear-gradient(135deg, #00d2ff 0%, #2563eb 100%);
  --glow-cyan: 0 0 28px rgba(0, 210, 255, 0.28);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.55);
  --code-bg: #050810;
  --sidebar-width: 290px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

[data-theme="light"] {
  --bg-primary: #f4f7fb;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e8eef7;
  --bg-elevated: rgba(255, 255, 255, 0.94);
  --bg-input: #ffffff;
  --bg-user-bubble: linear-gradient(135deg, #0284c7 0%, #1d4ed8 100%);
  --border-subtle: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(2, 132, 199, 0.32);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --glow-cyan: 0 8px 24px rgba(2, 132, 199, 0.18);
  --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.1);
  --code-bg: #0f172a;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.message-content, textarea, input, pre, code {
  user-select: text;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 15%, rgba(0, 210, 255, 0.09), transparent 42%),
    radial-gradient(circle at 82% 80%, rgba(37, 99, 235, 0.11), transparent 45%);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

.sidebar {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), margin-left 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 40;
}

.sidebar.collapsed { margin-left: calc(var(--sidebar-width) * -1); }

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 18, 0.65);
  backdrop-filter: blur(4px);
  z-index: 35;
}

.sidebar-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.brand-wrap { display: flex; align-items: center; gap: 11px; min-width: 0; }

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid rgba(0, 210, 255, 0.5);
  box-shadow: var(--glow-cyan);
  flex-shrink: 0;
}

.brand-info { display: flex; flex-direction: column; min-width: 0; }
.brand-title-row { display: flex; align-items: center; gap: 7px; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.free-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 210, 255, 0.14);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 210, 255, 0.35);
}

.brand-sub { font-size: 11px; color: var(--text-muted); }

.new-chat-wrap { padding: 14px 16px 10px; }

.btn-new-chat {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 210, 255, 0.35);
  background: var(--accent-gradient);
  color: #ffffff;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 140, 255, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn-new-chat:hover { transform: translateY(-1px); filter: brightness(1.07); }
.sidebar-search { padding: 0 16px 10px; }

.sidebar-search input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}

.sidebar-search input:focus { border-color: var(--accent-cyan); }

.history-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 12px 16px;
  scrollbar-width: thin;
}

.history-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 8px 6px;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 2px;
}

.history-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.history-item.active { background: rgba(0, 210, 255, 0.12); color: var(--text-primary); border: 1px solid rgba(0, 210, 255, 0.25); }
.history-item-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transition: opacity 0.15s ease; }
.history-item:hover .history-actions, .history-item.active .history-actions { opacity: 1; }

.icon-btn-sm {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn-sm:hover { background: rgba(255, 255, 255, 0.08); color: var(--text-primary); }
.icon-btn-sm.danger:hover { color: #f87171; background: rgba(248, 113, 113, 0.14); }

.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-secondary);
}

.footer-btn {
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.footer-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-subtle); }
.footer-btn-left { display: flex; align-items: center; gap: 9px; }

.db-pill {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-weight: 600;
}

.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; position: relative; }

.top-header {
  height: var(--header-height);
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(7, 11, 20, 0.78);
  backdrop-filter: blur(14px);
  z-index: 20;
  flex-shrink: 0;
}

[data-theme="light"] .top-header { background: rgba(255, 255, 255, 0.85); }

.header-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-secondary);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-icon:hover { border-color: var(--accent-cyan); background: var(--bg-tertiary); }

.model-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  flex-shrink: 0;
  animation: pulseDot 2.2s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

.status-badge-desktop {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
}

.chat-feed { flex: 1; overflow-y: auto; padding: 24px 18px 28px; display: flex; flex-direction: column; scroll-behavior: smooth; }
.chat-container { width: 100%; max-width: 840px; margin: 0 auto; flex: 1; display: flex; flex-direction: column; }

.welcome-screen { margin: auto 0; text-align: center; padding: 16px 8px; animation: fadeUp 0.45s ease; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.welcome-logo-ring {
  width: 112px;
  height: 112px;
  margin: 0 auto 20px;
  border-radius: 50%;
  padding: 4px;
  background: var(--accent-gradient);
  box-shadow: 0 0 46px rgba(0, 210, 255, 0.38);
}

.welcome-logo-ring img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }

.welcome-title {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #ffffff 20%, #38bdf8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .welcome-title {
  background: linear-gradient(135deg, #0f172a 20%, #0284c7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.welcome-tagline { font-size: 15.5px; color: var(--text-secondary); max-width: 540px; margin: 0 auto 30px; line-height: 1.6; }

.prompt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; text-align: left; }

.prompt-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.prompt-card:hover { transform: translateY(-2px); border-color: var(--accent-cyan); box-shadow: var(--glow-cyan); }
.prompt-card-title { font-weight: 700; font-size: 14px; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.prompt-card-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }

.messages-list { display: flex; flex-direction: column; gap: 20px; }
.message-row { display: flex; gap: 13px; align-items: flex-start; animation: fadeUp 0.25s ease; }
.message-row.user { flex-direction: row-reverse; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  overflow: hidden;
}

.avatar.ai { border: 1.5px solid rgba(0, 210, 255, 0.45); box-shadow: 0 0 14px rgba(0, 210, 255, 0.22); }
.avatar.ai img { width: 100%; height: 100%; object-fit: cover; }
.avatar.user { background: var(--bg-tertiary); border: 1px solid var(--border-strong); color: var(--accent-cyan); }

.message-bubble {
  max-width: 82%;
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 15px;
  line-height: 1.65;
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.message-row.user .message-bubble { background: var(--bg-user-bubble); color: #ffffff; border-bottom-right-radius: 5px; }
.message-row.ai .message-bubble { background: var(--bg-elevated); border: 1px solid var(--border-subtle); color: var(--text-primary); border-bottom-left-radius: 5px; }

.message-meta { display: flex; align-items: center; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.copy-msg-btn { background: none; border: none; color: var(--text-muted); font-size: 11px; cursor: pointer; }
.copy-msg-btn:hover { color: var(--accent-cyan); }

.message-content h1, .message-content h2, .message-content h3 { margin: 14px 0 8px; font-weight: 700; line-height: 1.3; }
.message-content h1:first-child, .message-content h2:first-child, .message-content h3:first-child { margin-top: 0; }
.message-content p { margin-bottom: 10px; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol { margin: 8px 0 12px 22px; }
.message-content li { margin-bottom: 5px; }
.message-content blockquote { border-left: 3px solid var(--accent-cyan); padding: 6px 14px; margin: 10px 0; background: rgba(0, 210, 255, 0.06); border-radius: 0 8px 8px 0; color: var(--text-secondary); }
.message-content code:not(pre code) { font-family: var(--font-mono); font-size: 0.88em; background: rgba(0, 210, 255, 0.12); color: var(--accent-cyan); padding: 2px 6px; border-radius: 5px; }

.code-block-wrapper { margin: 12px 0; border-radius: var(--radius-md); overflow: hidden; border: 1px solid rgba(56, 189, 248, 0.22); background: var(--code-bg); }
.code-block-header { display: flex; align-items: center; justify-content: space-between; padding: 7px 14px; background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.07); font-family: var(--font-mono); font-size: 11.5px; color: #94a3b8; }
.btn-copy-code { background: rgba(0, 210, 255, 0.12); border: 1px solid rgba(0, 210, 255, 0.3); color: #38bdf8; padding: 3px 10px; border-radius: 6px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.btn-copy-code:hover { background: #00d2ff; color: #090d16; }
.code-block-wrapper pre { padding: 14px; overflow-x: auto; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; color: #e2e8f0; }

.typing-indicator { display: inline-flex; align-items: center; gap: 5px; padding: 6px 4px; }
.typing-indicator span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-cyan); animation: bounceDot 1.2s infinite ease-in-out; }
.typing-indicator span:nth-child(2) { animation-delay: 0.18s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.36s; }
@keyframes bounceDot { 0%, 80%, 100% { transform: translateY(0); opacity: 0.4; } 40% { transform: translateY(-5px); opacity: 1; } }

.composer-area { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg-primary) 75%, transparent); z-index: 20; flex-shrink: 0; }
.composer-box { max-width: 840px; margin: 0 auto; background: var(--bg-input); border: 1px solid var(--border-strong); border-radius: 18px; padding: 8px 10px 8px 16px; display: flex; align-items: flex-end; gap: 10px; box-shadow: var(--shadow-lg); }
.composer-box:focus-within { border-color: var(--accent-cyan); box-shadow: var(--glow-cyan), var(--shadow-lg); }
.composer-box textarea { flex: 1; border: none; background: transparent; color: var(--text-primary); font-family: inherit; font-size: 15px; line-height: 1.5; max-height: 160px; min-height: 26px; padding: 6px 0; resize: none; outline: none; }
.btn-send { width: 40px; height: 40px; border-radius: 12px; border: none; background: var(--accent-gradient); color: #ffffff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }
.btn-send:disabled { opacity: 0.35; cursor: not-allowed; }
.composer-disclaimer { text-align: center; font-size: 11.5px; color: var(--text-muted); margin-top: 8px; }

.modal-overlay { position: fixed; inset: 0; background: rgba(3, 7, 18, 0.72); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-overlay.open { display: flex; }
.modal-card { width: 100%; max-width: 500px; background: var(--bg-secondary); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-lg); max-height: 88dvh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.modal-body { font-size: 14px; color: var(--text-secondary); line-height: 1.6; display: flex; flex-direction: column; gap: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-box { background: var(--bg-primary); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 12px; }
.stat-label { font-size: 11.5px; color: var(--text-muted); }
.stat-value { font-size: 18px; font-weight: 700; color: var(--accent-cyan); margin-top: 2px; }
.modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.btn-secondary { flex: 1; min-width: 130px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-tertiary); color: var(--text-primary); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-secondary:hover { border-color: var(--accent-cyan); }
.btn-danger { border-color: rgba(248, 113, 113, 0.4); color: #f87171; }

@media (max-width: 820px) {
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; margin-left: 0 !important; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-backdrop.visible { display: block; }
  .status-badge-desktop { display: none; }
  .prompt-grid { grid-template-columns: 1fr; }
  .message-bubble { max-width: 90%; padding: 12px 15px; font-size: 14.5px; }
  .chat-feed { padding: 16px 12px 20px; }
}
