/* ═══════════════════════════════════════════════════════
   AXINTER AI PRO — Global Styles
   Mobile-first, Median.co compatible
   ═══════════════════════════════════════════════════════ */

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

/* ── CSS Variables ─────────────────────────────────── */
:root {
  --or: #FF6B1A;
  --or2: #FF8C4A;
  --or-dim: #C44D0A;
  --or-glow: rgba(255, 107, 26, 0.18);
  --or-faint: rgba(255, 107, 26, 0.08);

  --black: #090909;
  --s0: #0d0d0d;
  --s1: #111111;
  --s2: #181818;
  --s3: #1f1f1f;
  --s4: #262626;
  --s5: #2e2e2e;

  --text: #EDEAE5;
  --text-m: #9A9590;
  --text-d: #5A5650;

  --bd: rgba(255, 107, 26, 0.13);
  --bd2: rgba(255, 255, 255, 0.06);
  --bd3: rgba(255, 255, 255, 0.04);

  --pro: #7C3AED;
  --pro2: #9F67FF;
  --pro-glow: rgba(124, 58, 237, 0.2);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  /* Safe areas for Median/Android */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --tab-h: 64px;
  --topbar-h: 60px;
  --input-area-h: 80px;
  --transition: 0.2s ease;
}

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

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  /* Prevent elastic bounce scroll on iOS/Android */
  overscroll-behavior: none;
}

body {
  font-family: 'Syne', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--black);
  color: var(--text);
  min-height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Android status bar padding — Median injects this automatically
     but we handle it ourselves too for safety */
  padding-top: var(--safe-top);
}

/* When running inside Median app */
.median-app body {
  /* Median handles status bar; trust their injected padding */
  padding-top: 0;
}

a { color: var(--or); text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; background: none; }
input, textarea { font-family: inherit; outline: none; border: none; background: none; color: var(--text); }
img { display: block; max-width: 100%; }

/* ── Scrollbar ─────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--s5); border-radius: 2px; }

/* ── Page Layout ───────────────────────────────────── */
.ax-page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* ── Top Bar ───────────────────────────────────────── */
.ax-topbar {
  display: flex;
  align-items: center;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--s0);
  border-bottom: 1px solid var(--bd2);
  flex-shrink: 0;
  gap: 12px;
  position: relative;
  z-index: 10;
}

.ax-topbar-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ax-topbar-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-m);
  transition: var(--transition);
  flex-shrink: 0;
}
.ax-topbar-btn:active { background: var(--s3); transform: scale(0.92); }
.ax-topbar-btn svg { width: 22px; height: 22px; }

/* ── Logo Mark ─────────────────────────────────────── */
.ax-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.ax-logo-mark {
  width: 34px;
  height: 34px;
  background: var(--or);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.ax-logo-text {
  font-size: 18px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--or2), var(--or));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Bottom Tab Bar ─────────────────────────────────── */
.ax-tabs {
  display: flex;
  height: calc(var(--tab-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--s0);
  border-top: 1px solid var(--bd2);
  flex-shrink: 0;
}
.ax-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-d);
  font-size: 11px;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.ax-tab svg { width: 22px; height: 22px; transition: var(--transition); }
.ax-tab.active { color: var(--or); }
.ax-tab.active svg { filter: drop-shadow(0 0 6px var(--or-glow)); }
.ax-tab.active::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 32px; height: 2px;
  background: var(--or);
  border-radius: 0 0 2px 2px;
}
.ax-tab:active { transform: scale(0.9); }

/* ── Messages Area ─────────────────────────────────── */
.ax-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* ── Message Bubbles ───────────────────────────────── */
.ax-msg {
  display: flex;
  gap: 10px;
  animation: fadeUp 0.25s ease;
  max-width: 100%;
}
.ax-msg.user { flex-direction: row-reverse; }

.ax-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
  align-self: flex-end;
}
.ax-msg.user .ax-msg-avatar { background: var(--or); color: #fff; }
.ax-msg.assistant .ax-msg-avatar { background: var(--s3); color: var(--or); border: 1px solid var(--bd); }

.ax-msg-bubble {
  max-width: calc(100% - 56px);
  padding: 12px 14px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.6;
  word-break: break-word;
}
.ax-msg.user .ax-msg-bubble {
  background: var(--s3);
  border-bottom-right-radius: 4px;
  border: 1px solid var(--bd2);
}
.ax-msg.assistant .ax-msg-bubble {
  background: var(--s2);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--bd3);
}

/* Markdown inside bubbles */
.ax-msg-bubble h1, .ax-msg-bubble h2, .ax-msg-bubble h3 {
  font-weight: 700; margin: 8px 0 4px; color: var(--text);
}
.ax-msg-bubble h1 { font-size: 18px; }
.ax-msg-bubble h2 { font-size: 16px; }
.ax-msg-bubble h3 { font-size: 15px; }
.ax-msg-bubble p { margin: 4px 0; }
.ax-msg-bubble ul, .ax-msg-bubble ol { padding-left: 18px; margin: 4px 0; }
.ax-msg-bubble li { margin: 2px 0; }
.ax-msg-bubble blockquote {
  border-left: 3px solid var(--or);
  padding-left: 10px;
  color: var(--text-m);
  margin: 6px 0;
}
.ax-msg-bubble a { color: var(--or); text-decoration: underline; }
.ax-msg-bubble hr { border: none; border-top: 1px solid var(--bd2); margin: 8px 0; }
.ax-msg-bubble strong { font-weight: 700; color: var(--text); }
.ax-msg-bubble em { font-style: italic; color: var(--text-m); }

/* Code blocks */
.ax-code-block {
  background: var(--s1);
  border: 1px solid var(--bd2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: 8px 0;
}
.ax-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--s3);
  border-bottom: 1px solid var(--bd2);
}
.ax-code-lang { font-size: 11px; color: var(--text-d); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.ax-code-copy {
  font-size: 11px;
  color: var(--or);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--or-faint);
  transition: var(--transition);
}
.ax-code-copy:active { background: var(--or-glow); }
.ax-code-block pre { overflow-x: auto; padding: 12px; }
.ax-code-block code { font-size: 13px; line-height: 1.6; color: #c9d1d9; font-family: 'Menlo', 'Monaco', monospace; white-space: pre; }
.ax-inline-code { background: var(--s3); color: var(--or2); padding: 1px 6px; border-radius: 4px; font-family: monospace; font-size: 13px; }

/* Code syntax highlight */
.ax-keyword { color: #ff7b72; }
.ax-string  { color: #a5d6ff; }
.ax-comment { color: #8b949e; font-style: italic; }
.ax-number  { color: #79c0ff; }

/* ── Typing Indicator ──────────────────────────────── */
.ax-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
}
.ax-typing span {
  width: 7px; height: 7px;
  background: var(--text-d);
  border-radius: 50%;
  animation: bounce 1.2s ease infinite;
}
.ax-typing span:nth-child(2) { animation-delay: 0.2s; }
.ax-typing span:nth-child(3) { animation-delay: 0.4s; }

/* ── Input Area ────────────────────────────────────── */
.ax-input-wrap {
  flex-shrink: 0;
  padding: 8px 12px;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: var(--s0);
  border-top: 1px solid var(--bd2);
}
.ax-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: 20px;
  padding: 8px 8px 8px 14px;
  transition: border-color 0.2s;
}
.ax-input-row:focus-within { border-color: var(--bd); }
.ax-input {
  flex: 1;
  resize: none;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: transparent;
  max-height: 180px;
  min-height: 24px;
  overflow-y: auto;
  padding: 0;
}
.ax-input::placeholder { color: var(--text-d); }
.ax-input-btn {
  width: 36px; height: 36px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  color: var(--text-m);
}
.ax-input-btn:active { transform: scale(0.88); }
.ax-send-btn {
  background: var(--or);
  color: #fff;
  border-radius: 12px;
}
.ax-send-btn:disabled { background: var(--s4); color: var(--text-d); }
.ax-send-btn svg { width: 18px; height: 18px; }
.ax-attach-btn svg { width: 20px; height: 20px; }

/* ── Welcome Screen ────────────────────────────────── */
.ax-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 8px;
}
.ax-welcome-logo {
  width: 64px; height: 64px;
  background: var(--or);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  box-shadow: 0 0 40px var(--or-glow);
}
.ax-welcome h2 { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.ax-welcome p { color: var(--text-m); font-size: 14px; margin-bottom: 16px; }

.ax-suggestions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  max-width: 380px;
}
.ax-suggestion {
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: left;
  font-size: 13px;
  color: var(--text-m);
  font-weight: 500;
  line-height: 1.4;
  transition: var(--transition);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ax-suggestion:active { background: var(--s3); border-color: var(--bd); color: var(--text); transform: scale(0.97); }

/* ── Chat List ─────────────────────────────────────── */
.ax-chat-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 0;
}
.ax-chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  border-bottom: 1px solid var(--bd3);
}
.ax-chat-item:active { background: var(--s2); }
.ax-chat-item.active { background: var(--s2); }
.ax-chat-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--or);
  border-radius: 0 2px 2px 0;
}
.ax-chat-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--s3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--or);
}
.ax-chat-icon svg { width: 18px; height: 18px; }
.ax-chat-info { flex: 1; min-width: 0; }
.ax-chat-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ax-chat-sub { font-size: 12px; color: var(--text-d); margin-top: 2px; }
.ax-chat-del {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-d);
  opacity: 0;
  transition: var(--transition);
  flex-shrink: 0;
}
.ax-chat-item:active .ax-chat-del,
.ax-chat-item.active .ax-chat-del { opacity: 1; }

/* ── Drawer / Side Sheet ───────────────────────────── */
.ax-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ax-drawer-backdrop.open { opacity: 1; pointer-events: all; }

.ax-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: min(300px, 88vw);
  background: var(--s1);
  z-index: 50;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  border-right: 1px solid var(--bd2);
}
.ax-drawer.open { transform: translateX(0); }

.ax-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--bd2);
  flex-shrink: 0;
}
.ax-drawer-user {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.ax-drawer-avatar {
  width: 36px; height: 36px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--or);
  flex-shrink: 0;
}
.ax-drawer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ax-drawer-avatar-text {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--or);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--or);
}
.ax-drawer-name { font-size: 14px; font-weight: 700; }
.ax-drawer-email { font-size: 11px; color: var(--text-d); }
.ax-drawer-close {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-m);
}
.ax-drawer-close:active { background: var(--s3); }

.ax-drawer-new {
  margin: 12px;
  padding: 12px;
  background: var(--or);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}
.ax-drawer-new:active { transform: scale(0.97); background: var(--or-dim); }
.ax-drawer-new svg { width: 18px; height: 18px; }

.ax-drawer-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: 10px;
  padding: 8px 12px;
  margin: 0 12px 8px;
}
.ax-drawer-search svg { width: 16px; height: 16px; color: var(--text-d); flex-shrink: 0; }
.ax-drawer-search input { flex: 1; font-size: 14px; background: transparent; color: var(--text); }
.ax-drawer-search input::placeholder { color: var(--text-d); }

.ax-drawer-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--bd2);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}
.ax-drawer-footer-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-m);
  cursor: pointer;
  transition: var(--transition);
}
.ax-drawer-footer-btn svg { width: 18px; height: 18px; }
.ax-drawer-footer-btn:active { background: var(--s3); }
.ax-drawer-footer-btn.danger { color: #ff4444; }
.ax-drawer-footer-btn.danger:active { background: rgba(255,68,68,0.1); }

/* ── Buttons ───────────────────────────────────────── */
.btn {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn-or { background: var(--or); color: #fff; }
.btn-or:active { background: var(--or-dim); }
.btn-ghost { background: var(--s2); color: var(--text); border: 1px solid var(--bd2); }
.btn-ghost:active { background: var(--s3); }
.btn-pro { background: linear-gradient(135deg, var(--pro), var(--pro2)); color: #fff; }

/* ── Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.badge-green { background: rgba(52, 211, 153, 0.15); color: #34d399; }
.badge-pro { background: linear-gradient(135deg, var(--pro), var(--pro2)); color: #fff; }
.badge-or { background: var(--or-faint); color: var(--or); border: 1px solid var(--or-glow); }

/* ── Toast ─────────────────────────────────────────── */
.ax-toast-wrap {
  position: fixed;
  bottom: calc(var(--tab-h) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 360px;
}
.ax-toast {
  background: var(--s3);
  border: 1px solid var(--bd2);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.25s ease, fadeOut 0.3s ease 2.5s forwards;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: all;
}
.ax-toast.success { border-color: rgba(52,211,153,0.3); }
.ax-toast.error { border-color: rgba(255,68,68,0.3); color: #ff4444; }

/* ── Modal ─────────────────────────────────────────── */
.ax-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 var(--safe-bottom) 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
}
.ax-modal-backdrop.center { align-items: center; padding: 24px; }
.ax-modal {
  background: var(--s1);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90dvh;
  overflow-y: auto;
  animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--bd2);
  border-bottom: none;
}
.ax-modal-backdrop.center .ax-modal {
  border-radius: 24px;
  border: 1px solid var(--bd2);
}
.ax-modal-handle {
  width: 36px; height: 4px;
  background: var(--s5);
  border-radius: 2px;
  margin: 12px auto 0;
}
.ax-modal-title {
  font-size: 20px;
  font-weight: 800;
  padding: 20px 20px 8px;
}
.ax-modal-sub {
  font-size: 14px;
  color: var(--text-m);
  padding: 0 20px 16px;
}
.ax-modal-body { padding: 0 16px 24px; }

/* ── User Type Cards ───────────────────────────────── */
.ax-type-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 24px;
}
.ax-type-card {
  background: var(--s2);
  border: 1.5px solid var(--bd2);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  gap: 14px;
}
.ax-type-card:active { transform: scale(0.98); border-color: var(--or); background: var(--s3); }
.ax-type-card.active { border-color: var(--or); background: var(--or-faint); }
.ax-type-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ax-type-icon svg { width: 24px; height: 24px; }
.ax-type-info { flex: 1; }
.ax-type-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.ax-type-desc { font-size: 13px; color: var(--text-m); line-height: 1.4; }
.ax-type-features { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ax-type-feature {
  font-size: 11px;
  color: var(--text-d);
  background: var(--s3);
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 500;
}

/* ── Image Grid (Teacher) ──────────────────────────── */
.ax-img-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 16px;
}
.ax-img-card {
  background: var(--s2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--bd2);
  animation: fadeUp 0.3s ease;
}
.ax-img-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.ax-img-card-actions {
  display: flex;
  gap: 6px;
  padding: 8px;
}
.ax-img-card-actions a, .ax-img-card-actions button {
  flex: 1;
  padding: 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  display: block;
  transition: var(--transition);
}
.ax-img-card-actions a { background: var(--or); color: #fff; }
.ax-img-card-actions button { background: var(--s4); color: var(--text-m); }

/* ── Analytics ─────────────────────────────────────── */
.ax-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 16px;
}
.ax-stat-card {
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.ax-stat-val { font-size: 28px; font-weight: 800; color: var(--or); }
.ax-stat-label { font-size: 12px; color: var(--text-d); margin-top: 4px; }

/* ── Model Selector ─────────────────────────────────── */
.ax-model-select {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-m);
  cursor: pointer;
}
.ax-model-select svg { width: 14px; height: 14px; }

/* ── Image Gen Input ─────────────────────────────────── */
.ax-imggen-wrap {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ax-imggen-input {
  background: var(--s2);
  border: 1.5px solid var(--bd2);
  border-radius: var(--radius);
  padding: 14px;
  font-size: 15px;
  color: var(--text);
  min-height: 90px;
  resize: none;
  width: 100%;
}
.ax-imggen-input::placeholder { color: var(--text-d); }
.ax-imggen-input:focus { border-color: var(--or); }
.ax-imggen-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.ax-size-select {
  flex: 1;
  background: var(--s2);
  border: 1px solid var(--bd2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  appearance: none;
  font-family: inherit;
}

/* ── Login Page ─────────────────────────────────────── */
.ax-login-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--black);
  position: relative;
  overflow: hidden;
}
.ax-login-bg {
  position: absolute; inset: 0;
  background: 
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(255,107,26,0.15) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(255,107,26,0.08) 0%, transparent 60%);
  pointer-events: none;
}
/* Animated grid */
.ax-login-grid {
  position: absolute; inset: 0;
  background-image: 
    linear-gradient(rgba(255,107,26,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,107,26,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  animation: gridMove 20s linear infinite;
  pointer-events: none;
}
.ax-login-card {
  width: 100%;
  max-width: 360px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--bd2);
  border-radius: 28px;
  padding: 32px 24px;
  position: relative;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: fadeUp 0.5s ease;
}
.ax-login-logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}
.ax-login-logo-mark {
  width: 52px; height: 52px;
  background: var(--or);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 8px 24px var(--or-glow);
}
.ax-login-brand { font-size: 32px; font-weight: 800; background: linear-gradient(135deg, #fff, var(--or2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.ax-login-tagline { font-size: 13px; color: var(--text-d); margin-bottom: 24px; }
.ax-login-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--or), transparent);
  margin: 20px 0;
  opacity: 0.4;
}
.ax-login-title { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.ax-login-sub { font-size: 14px; color: var(--text-m); margin-bottom: 20px; }

/* Google button wrapper */
#ax-google-btn { display: flex; justify-content: center; margin-bottom: 16px; }

/* App login button (for inside Median) */
.ax-app-login-btn {
  width: 100%;
  padding: 15px;
  background: var(--s2);
  border: 1.5px solid var(--bd2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 16px;
}
.ax-app-login-btn:active { background: var(--s3); transform: scale(0.97); }
.ax-app-login-btn svg { width: 22px; height: 22px; }

.ax-login-footer {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 16px;
}
.ax-login-footer a { font-size: 12px; color: var(--text-d); }

/* ── Animations ─────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; pointer-events: none; }
}
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40%            { transform: scale(1);   opacity: 1; }
}
@keyframes gridMove {
  0%   { transform: translateY(0); }
  100% { transform: translateY(40px); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── Utilities ──────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-or { color: var(--or); }
.text-m { color: var(--text-m); }
.text-d { color: var(--text-d); }
.fw-800 { font-weight: 800; }
.mt-auto { margin-top: auto; }

/* ── Section Tabs (Teacher) ─────────────────────────── */
.ax-mode-tabs {
  display: flex;
  gap: 6px;
  padding: 0 4px;
}
.ax-mode-tab {
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-d);
  transition: var(--transition);
  cursor: pointer;
}
.ax-mode-tab.active { background: var(--or); color: #fff; }
.ax-mode-tab:active { transform: scale(0.94); }

/* ── Empty State ─────────────────────────────────────── */
.ax-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
  gap: 8px;
}
.ax-empty svg { width: 48px; height: 48px; color: var(--text-d); margin-bottom: 8px; }
.ax-empty h3 { font-size: 16px; font-weight: 700; }
.ax-empty p { font-size: 14px; color: var(--text-d); }

/* ── Attachment Preview ──────────────────────────────── */
.ax-attach-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--s2);
  border-radius: 10px;
  padding: 8px 10px;
  margin: 6px 12px 0;
  border: 1px solid var(--bd2);
}
.ax-attach-preview-name { flex: 1; font-size: 13px; color: var(--text-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ax-attach-preview-rm { color: var(--text-d); font-size: 18px; line-height: 1; cursor: pointer; }

/* ── Loading Screen ──────────────────────────────────── */
.ax-loading {
  position: fixed; inset: 0;
  background: var(--black);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 16px;
  transition: opacity 0.3s;
}
.ax-loading.hide { opacity: 0; pointer-events: none; }
.ax-loading-logo {
  width: 72px; height: 72px;
  background: var(--or);
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  animation: pulse 1.5s ease infinite;
  box-shadow: 0 0 48px var(--or-glow);
}
.ax-loading p { font-size: 14px; color: var(--text-d); }

/* ── Responsive tweaks ──────────────────────────────── */
@media (min-width: 500px) {
  .ax-suggestions { max-width: 440px; }
  .ax-type-cards { max-width: 460px; margin: 0 auto; }
}
