/* ═══════════════════════════════════════════════════════════════
   ATK IT — Ma'lumot Boti | style.css
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── CSS Custom Properties (Design Tokens) ─────────────────── */
:root {
  /* Dark theme (default) */
  --bg-primary:       #0d1117;
  --bg-secondary:     #161b22;
  --bg-tertiary:      #21262d;
  --bg-bubble-bot:    #1c2333;
  --bg-bubble-user:   #1a3a5c;
  --bg-card:          #161b22;

  --border-color:     #30363d;
  --border-subtle:    #21262d;

  --accent:           #2f81f7;
  --accent-hover:     #388bfd;
  --accent-glow:      rgba(47, 129, 247, 0.25);
  --accent-secondary: #58a6ff;

  --text-primary:     #e6edf3;
  --text-secondary:   #8b949e;
  --text-muted:       #656d76;
  --text-accent:      #79c0ff;
  --text-on-accent:   #ffffff;

  --success:          #3fb950;
  --success-bg:       rgba(63, 185, 80, 0.1);
  --warning:          #d29922;
  --code-bg:          #0d1117;
  --code-text:        #e6edf3;

  --shadow-sm:        0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:        0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:        0 8px 32px rgba(0,0,0,0.6);
  --shadow-accent:    0 4px 20px rgba(47, 129, 247, 0.3);

  --radius-sm:        6px;
  --radius-md:        12px;
  --radius-lg:        18px;
  --radius-xl:        24px;
  --radius-full:      9999px;

  --transition:       all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow:  all 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --font:             'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --chat-max-width:   760px;
}

/* Light theme */
[data-theme="light"] {
  --bg-primary:       #f6f8fa;
  --bg-secondary:     #ffffff;
  --bg-tertiary:      #f0f3f6;
  --bg-bubble-bot:    #ffffff;
  --bg-bubble-user:   #0969da;
  --bg-card:          #ffffff;

  --border-color:     #d0d7de;
  --border-subtle:    #eaeef2;

  --accent:           #0969da;
  --accent-hover:     #0860ca;
  --accent-glow:      rgba(9, 105, 218, 0.15);
  --accent-secondary: #0550ae;

  --text-primary:     #24292f;
  --text-secondary:   #57606a;
  --text-muted:       #8c959f;
  --text-accent:      #0550ae;
  --text-on-accent:   #ffffff;

  --success:          #1a7f37;
  --success-bg:       rgba(26, 127, 55, 0.08);
  --code-bg:          #f6f8fa;
  --code-text:        #24292f;

  --shadow-sm:        0 1px 3px rgba(31,35,40,0.12);
  --shadow-md:        0 4px 16px rgba(31,35,40,0.12);
  --shadow-lg:        0 8px 32px rgba(31,35,40,0.15);
  --shadow-accent:    0 4px 20px rgba(9, 105, 218, 0.2);
}

/* ─── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* ─── Background grid pattern ───────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* ─── Header ─────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: slideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

@keyframes slideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.header-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.5px;
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
  animation: logoPulse 3s ease-in-out infinite;
}

.header-logo-img {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  object-fit: cover;
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
  animation: logoPulse 3s ease-in-out infinite;
  border: 1.5px solid rgba(47, 129, 247, 0.35);
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(47, 129, 247, 0.3); }
  50%       { box-shadow: 0 4px 28px rgba(47, 129, 247, 0.55); }
}

.header-title {
  display: flex;
  flex-direction: column;
}

.header-title h1 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  letter-spacing: -0.3px;
}

.header-title span {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: var(--transition);
}

.btn-icon:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-home {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-home:hover {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-accent);
}

/* Online status badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
}

.status-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ─── Main chat area ─────────────────────────────────────────── */
.chat-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 32px;
  position: relative;
  z-index: 1;
}

.chat-container {
  width: 100%;
  max-width: var(--chat-max-width);
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ─── Message row ────────────────────────────────────────────── */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 16px;
  animation: msgIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

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

.msg-row.bot  { justify-content: flex-start; }
.msg-row.user { justify-content: flex-end; }

/* ─── Avatar ─────────────────────────────────────────────────── */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.avatar.bot-avatar {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.avatar.user-avatar {
  background: linear-gradient(135deg, #3fb950 0%, #238636 100%);
  color: #fff;
}

/* ─── Bubble ─────────────────────────────────────────────────── */
.bubble {
  max-width: 78%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 14.5px;
  line-height: 1.6;
  position: relative;
  word-break: break-word;
}

.msg-row.bot .bubble {
  background: var(--bg-bubble-bot);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.msg-row.user .bubble {
  background: var(--bg-bubble-user);
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-sm);
}

.bubble p + p { margin-top: 6px; }
.bubble strong { font-weight: 600; color: var(--text-accent); }
[data-theme="light"] .msg-row.bot .bubble strong { color: var(--accent); }

/* ─── Typing indicator ───────────────────────────────────────── */
.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ─── Action buttons (choices) ───────────────────────────────── */
.actions-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  padding-left: 42px;
  animation: msgIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) 0.1s both;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  user-select: none;
}

.choice-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  color: var(--accent-secondary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

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

.choice-btn .btn-icon-inner {
  font-size: 15px;
  flex-shrink: 0;
}

/* Member selection buttons */
.member-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  width: 100%;
  max-width: 400px;
}

.member-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

.member-btn .mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.3px;
}

/* Code/prefix buttons */
.code-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
}

.code-btn code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  background: var(--code-bg);
  color: var(--accent-secondary);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid var(--border-subtle);
}

.code-btn:hover {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px var(--accent-glow);
}

/* ─── Contact card ───────────────────────────────────────────── */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 260px;
  box-shadow: var(--shadow-md);
}

.contact-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.contact-card-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.5px;
  box-shadow: var(--shadow-accent);
  flex-shrink: 0;
}

.contact-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.contact-card-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.contact-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0;
}

.contact-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.contact-field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
  min-width: 60px;
}

.contact-field-label .field-icon { font-size: 13px; }

.contact-field-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.copy-btn:hover {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

.copy-btn.copied {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

/* ─── Info card (naming conventions) ────────────────────────── */
.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 240px;
  box-shadow: var(--shadow-md);
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-card-code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.info-card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.info-card-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.info-card-example {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}

.info-card-example-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.info-card-example code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 13px;
  color: var(--accent-secondary);
  font-weight: 600;
}

/* ─── Toast notification ─────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--success);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
  opacity: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ─── Search input ───────────────────────────────────────────── */
.search-wrapper {
  position: relative;
  max-width: 400px;
  margin-bottom: 4px;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: var(--font);
  outline: none;
  transition: var(--transition);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
  pointer-events: none;
}

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
  .header { padding: 10px 14px; }
  .header-title h1 { font-size: 15px; }
  .status-badge { display: none; }
  .chat-wrapper { padding: 16px 12px 28px; }
  .bubble { max-width: 90%; font-size: 14px; }
  .actions-group { padding-left: 0; }
  .contact-card, .info-card { min-width: unset; width: 100%; }
  .btn-home span { display: none; }
}

/* ─── Utility ────────────────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.5s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}
