/* ===========================
   Claude Clone — style.css
   =========================== */

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

/* — Tokens — */
:root {
  --bg-app:        #252525;
  --bg-sidebar:    #1c1c1c;
  --bg-surface:    #2e2e2e;
  --bg-input:      #343434;
  --bg-hover:      #3a3a3a;
  --bg-active:     #424242;

  --border:        #3f3f3f;
  --border-light:  #4a4a4a;

  --tx-1:  #e8e4df;
  --tx-2:  #b3aeaa;
  --tx-3:  #8b8682;
  --tx-4:  #6b6764;

  --coral:    #d97757;
  --coral-dk: #c4654a;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 20px;

  --ff-serif: 'Georgia', 'Times New Roman', serif;
  --ff-sans:  -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --ff-mono:  'SF Mono', 'Fira Code', Consolas, 'Courier New', monospace;

  --ease: .2s cubic-bezier(.4,0,.2,1);
}

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--ff-sans);
  background: var(--bg-app);
  color: var(--tx-1);
  -webkit-font-smoothing: antialiased;
}

/* ========================
   Layout: app shell
   ======================== */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* — Compact sidebar (rail) — */
.sidebar-compact {
  width: 52px;
  min-width: 52px;
  height: 100%;
  background: var(--bg-app);
  border-right: 1px solid rgba(255,255,255,.055);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0 8px;
  z-index: 40;
}

.sidebar-top-icons,
.sidebar-main-icons,
.sidebar-bottom-icons {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
}
.sidebar-main-icons { flex: 1; justify-content: center; }

/* — Expanded sidebar (drawer) — */
.sidebar-expanded {
  position: fixed;
  top: 0; left: 52px; bottom: 0;
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(255,255,255,.055);
  z-index: 39;
  display: flex;
  flex-direction: column;
  transform: translateX(-260px);
  transition: transform var(--ease);
  overflow: hidden;
}
.sidebar-expanded.open { transform: translateX(0); }

.expanded-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
}
.expanded-header h3 { font-size: 15px; font-weight: 600; color: var(--tx-1); }

.expanded-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 6px 8px;
}
.expanded-body::-webkit-scrollbar { width: 4px; }
.expanded-body::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

.expanded-footer {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,.055);
}

/* — Avatar circles — */
.avatar-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.avatar-circle-small {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--coral);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

/* — Icon button — */
.icon-btn {
  width: 36px; height: 36px;
  border: none;
  background: none;
  color: var(--tx-3);
  cursor: pointer;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), color var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--tx-2); }

/* — Expanded menu items — */
.expanded-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13.5px;
  color: var(--tx-2);
  transition: background var(--ease);
}
.expanded-menu-item:hover { background: #282828; color: var(--tx-1); }
.expanded-menu-item.active { background: #333; color: var(--tx-1); }

.menu-divider { height: 1px; background: rgba(255,255,255,.07); margin: 6px 10px; }

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--tx-4);
  padding: 10px 10px 3px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.recent-chat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--tx-3);
  transition: background var(--ease);
}
.recent-chat-item:hover { background: #282828; color: var(--tx-2); }

.recent-chat-icon {
  width: 18px; height: 18px;
  border-radius: 4px;
  background: var(--coral);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  flex-shrink: 0;
}
.recent-chat-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* — User profile in expanded footer — */
.user-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--ease);
}
.user-profile:hover { background: #282828; }

.user-info-block { flex: 1; }
.user-display-name { font-size: 13px; font-weight: 500; color: var(--tx-1); }
.user-sub { font-size: 10.5px; color: var(--tx-4); }

/* ========================
   Main content area
   ======================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ========================
   Welcome view
   ======================== */
.welcome-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px;
  gap: 28px;
  transition: opacity .3s;
}
.welcome-view.hidden { display: none; }

.greeting-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.claude-star-icon {
  width: 32px; height: 32px;
}

.greeting-text {
  font-family: var(--ff-serif);
  font-size: 30px;
  font-weight: 400;
  color: var(--tx-1);
  letter-spacing: -.3px;
}

/* ========================
   Input area (shared)
   ======================== */
.input-wrapper { width: 100%; max-width: 640px; }

.input-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 12px 14px 10px;
  transition: border-color var(--ease);
}
.input-box:focus-within { border-color: var(--border-light); }

.chat-box { max-width: 100%; }

.main-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  color: var(--tx-1);
  font-family: var(--ff-sans);
  font-size: 14.5px;
  line-height: 1.55;
  resize: none;
  max-height: 180px;
  padding: 0;
}
.main-input::placeholder { color: var(--tx-4); }
.main-input::-webkit-scrollbar { width: 4px; }
.main-input::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

.input-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.attach-btn {
  width: 30px; height: 30px;
  border: none;
  background: none;
  color: var(--tx-4);
  cursor: pointer;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), color var(--ease);
  flex-shrink: 0;
}
.attach-btn:hover { background: var(--bg-hover); color: var(--tx-3); }

/* — Model picker (inline) — */
.model-pick { position: relative; }
.model-trigger {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border: none;
  background: none;
  color: var(--tx-3);
  font-size: 13px;
  font-family: var(--ff-sans);
  cursor: pointer;
  border-radius: var(--r-sm);
  transition: background var(--ease), color var(--ease);
}
.model-trigger:hover { background: var(--bg-hover); color: var(--tx-2); }

.model-label { display: flex; align-items: center; gap: 4px; }

/* — Model panel / dropdown — */
.model-panel,
.model-panel-header {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  width: 270px;
  background: #2a2a2a;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px) scale(.97);
  transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
}
.model-panel.show,
.model-panel-header.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.model-row {
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: background var(--ease);
}
.model-row:hover { background: var(--bg-hover); }
.model-row.active { background: var(--bg-active); }

.model-row-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--tx-1);
  display: flex;
  align-items: center;
  gap: 6px;
}
.model-row.active .model-row-name::after {
  content: '\2713';
  font-size: 11px;
  color: var(--coral);
  margin-left: auto;
  font-weight: 700;
}
.model-row-desc { font-size: 11.5px; color: var(--tx-4); }

/* — Send button — */
.send-btn {
  width: 32px; height: 32px;
  border: none;
  background: var(--coral);
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: .35;
  flex-shrink: 0;
  transition: opacity var(--ease), background var(--ease);
}
.send-btn.hot { opacity: 1; }
.send-btn.hot:hover { background: var(--coral-dk); }

/* — Shortcut pills — */
.shortcuts-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 12px;
}

.shortcut-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border: 1px solid var(--border);
  background: none;
  color: var(--tx-3);
  font-size: 12.5px;
  font-family: var(--ff-sans);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background var(--ease);
}
.shortcut-pill:hover {
  border-color: var(--border-light);
  color: var(--tx-2);
  background: rgba(255,255,255,.03);
}

/* ========================
   Chat view
   ======================== */
.chat-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.chat-view.hidden { display: none; }

.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 4px;
  min-height: 42px;
}

.chat-topbar-model {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--tx-3);
  font-size: 13.5px;
  transition: background var(--ease), color var(--ease);
  position: relative;
}
.chat-topbar-model:hover { background: var(--bg-hover); color: var(--tx-2); }
.model-inline { font-weight: 500; }

.model-panel-header {
  position: absolute;
  bottom: auto;
  top: calc(100% + 4px);
  left: 0;
  right: auto;
}

.share-top-btn {
  padding: 5px 16px;
  border: 1px solid var(--border);
  background: none;
  color: var(--tx-3);
  font-size: 12.5px;
  font-family: var(--ff-sans);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease);
}
.share-top-btn:hover { border-color: var(--border-light); color: var(--tx-2); }

/* — Chat feed / messages — */
.chat-feed {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 0;
}
.chat-feed::-webkit-scrollbar { width: 5px; }
.chat-feed::-webkit-scrollbar-thumb { background: #444; border-radius: 3px; }

.msg {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
  animation: msgIn .3s ease;
}

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

.msg-user { margin-bottom: 18px; }
.msg-ai   { margin-bottom: 28px; }

.msg-content {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--tx-1);
  white-space: pre-wrap;
}

.msg-ai .msg-content {
  line-height: 1.7;
}
.msg-ai .msg-content p { margin-bottom: 8px; }
.msg-ai .msg-content p:last-child { margin-bottom: 0; }

.msg-ai .msg-content code:not(pre code) {
  background: var(--bg-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
  font-family: var(--ff-mono);
}

.msg-ai .msg-content pre {
  background: #1a1a1a;
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin: 10px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
}
.msg-ai .msg-content pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.55;
  font-family: var(--ff-mono);
}

.msg-ai .msg-content strong { font-weight: 600; }
.msg-ai .msg-content ul,
.msg-ai .msg-content ol { padding-left: 22px; margin: 6px 0; }
.msg-ai .msg-content li { margin-bottom: 3px; }
.msg-ai .msg-content h1 { font-size: 20px; margin: 14px 0 6px; }
.msg-ai .msg-content h2 { font-size: 17px; margin: 10px 0 4px; }
.msg-ai .msg-content h3 { font-size: 15px; margin: 8px 0 3px; }

/* — Code header bar — */
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--tx-4);
}
.copy-snippet {
  padding: 2px 10px;
  border: 1px solid var(--border);
  background: none;
  color: var(--tx-4);
  font-size: 11px;
  font-family: var(--ff-sans);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--ease);
}
.copy-snippet:hover { background: var(--bg-hover); color: var(--tx-2); }

/* — Message actions — */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 6px;
  visibility: hidden;
  transition: visibility var(--ease);
}
.msg:hover .msg-actions { visibility: visible; }

.msg-act {
  width: 26px; height: 26px;
  border: none;
  background: none;
  color: var(--tx-4);
  cursor: pointer;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), color var(--ease);
}
.msg-act:hover { background: var(--bg-hover); color: var(--tx-2); }

/* — AI star at end of block — */
.msg-star {
  width: 24px; height: 24px;
  opacity: .45;
  margin-top: 2px;
}

/* — Chat input area — */
.chat-input-area {
  max-width: 720px;
  margin: 6px auto 10px;
  width: 100%;
  padding: 0 24px;
}

.footer-note {
  text-align: center;
  font-size: 11px;
  color: var(--tx-4);
  padding: 0 20px 16px;
  max-width: 720px;
  margin: 0 auto;
}

/* ========================
   Backdrop & flyouts
   ======================== */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
}

/* — Profile flyout — */
.profile-flyout {
  position: fixed;
  bottom: 60px;
  left: 60px;
  width: 280px;
  background: #2a2a2a;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
}
.profile-flyout.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.flyout-email { padding: 8px 10px 4px; font-size: 11.5px; color: var(--tx-4); }

.flyout-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--tx-2);
  transition: background var(--ease);
}
.flyout-item:hover { background: var(--bg-hover); color: var(--tx-1); }
.flyout-item.with-arrow { position: relative; }

.flyout-key {
  margin-left: auto;
  font-size: 11px;
  color: var(--tx-4);
  font-family: var(--ff-sans);
}

.flyout-divider { height: 1px; background: rgba(255,255,255,.07); margin: 4px 8px; }
.logout-item { color: var(--tx-3); }

/* — Language flyout — */
.lang-flyout {
  position: fixed;
  bottom: 60px;
  left: 348px;
  width: 220px;
  max-height: 340px;
  overflow-y: auto;
  background: #2a2a2a;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  z-index: 210;
  opacity: 0;
  visibility: hidden;
  transform: translateX(8px);
  transition: opacity var(--ease), transform var(--ease), visibility var(--ease);
}
.lang-flyout.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}
.lang-flyout::-webkit-scrollbar { width: 4px; }
.lang-flyout::-webkit-scrollbar-thumb { background: #444; border-radius: 2px; }

.lang-row {
  padding: 7px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--tx-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--ease);
}
.lang-row:hover { background: var(--bg-hover); }
.lang-row.active { color: var(--tx-1); }
.lang-row svg { color: var(--coral); }

/* ========================
   Loading dots
   ======================== */
.loading-pulse {
  display: flex;
  gap: 5px;
  padding: 4px 0;
}
.loading-pulse span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tx-4);
  animation: bounce 1.4s ease-in-out infinite;
}
.loading-pulse span:nth-child(2) { animation-delay: .16s; }
.loading-pulse span:nth-child(3) { animation-delay: .32s; }

@keyframes bounce {
  0%, 80%, 100% { transform: scale(.55); opacity: .45; }
  40%            { transform: scale(1);   opacity: 1;    }
}

/* — Streaming cursor — */
.cursor-blink::after {
  content: '';
  display: inline-block;
  width: 1.5px;
  height: 1em;
  background: var(--tx-1);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: curPulse .7s step-end infinite;
}
@keyframes curPulse {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* — Responsive — */
@media (max-width: 768px) {
  .greeting-text { font-size: 24px; }
  .input-wrapper { max-width: 100%; padding: 0 4px; }
  .input-box { border-radius: var(--r-md); }
  .shortcuts-bar { gap: 6px; }
  .shortcut-pill { padding: 4px 10px; font-size: 11.5px; }
  .msg { padding: 0 14px; }
  .chat-input-area { padding: 0 14px; }
  .sidebar-expanded { width: 240px; }
}

/* Claude star SVG styling */
.claude-star-icon svg {
  width: 100%;
  height: 100%;
}
