/* ==========================================================
   LatiX AI — şəxsi konsol
   Palet: tünd donuq-lacivərd fon, qızılı vurğu, terminal ritmi
   ========================================================== */

:root {
  --bg: #0A0C10;
  --panel: #12151C;
  --panel-2: #171B24;
  --border: #242938;
  --gold: #C9A544;
  --gold-dim: #8A7433;
  --text: #E7E4D9;
  --text-dim: #8B90A0;
  --user-bubble: #1B2030;
  --ai-bubble: #14171F;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "JetBrains Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

.cursor-dot {
  width: 8px; height: 8px;
  background: var(--gold);
  border-radius: 1px;
  display: inline-block;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0.15; } }

/* ---------- Login ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
  background:
    radial-gradient(circle at 20% 20%, rgba(201,165,68,0.06), transparent 40%),
    var(--bg);
}
.login-card {
  width: min(360px, 90vw);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 32px 28px;
  display: flex; flex-direction: column; gap: 14px;
}
.login-mark {
  font-family: var(--mono);
  letter-spacing: 0.08em;
  font-size: 15px;
  display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.login-sub {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  margin: -8px 0 6px;
}
.login-card input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px 14px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
}
.login-card input:focus { border-color: var(--gold-dim); }
.login-card button {
  background: var(--gold);
  color: #14171F;
  border: none;
  border-radius: 4px;
  padding: 12px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: opacity .15s;
}
.login-card button:hover { opacity: 0.85; }
.login-error { color: #D9695F; font-family: var(--mono); font-size: 12px; margin: 0; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  gap: 12px;
}
.brand {
  font-family: var(--mono);
  letter-spacing: 0.08em;
  font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.new-chat-btn {
  background: transparent;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s;
}
.new-chat-btn:hover { background: rgba(201,165,68,0.08); }

.conv-list {
  flex: 1;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 4px;
}
.conv-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.conv-item:hover { background: var(--panel-2); color: var(--text); }
.conv-item.active { background: var(--panel-2); color: var(--gold); }
.conv-del {
  opacity: 0; font-size: 12px; color: var(--text-dim);
  transition: opacity .15s;
}
.conv-item:hover .conv-del { opacity: 1; }
.conv-del:hover { color: #D9695F; }

.logout-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 4px 0;
  border-top: 1px solid var(--border);
}
.logout-link:hover { color: var(--text); }

/* ---------- Chat main ---------- */
.chat-main {
  display: flex; flex-direction: column;
  height: 100vh;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 28px 10% 10px;
  display: flex; flex-direction: column; gap: 16px;
}

.empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-dim);
  font-family: var(--mono);
}
.empty-title { font-size: 14px; color: var(--gold-dim); margin: 0 0 6px; }
.empty-sub { font-size: 13px; margin: 0; }

.bubble {
  max-width: 72%;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble.user {
  align-self: flex-end;
  background: var(--user-bubble);
  border: 1px solid var(--border);
  border-bottom-right-radius: 2px;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--ai-bubble);
  border-left: 2px solid var(--gold-dim);
  border-bottom-left-radius: 2px;
}
.bubble.pending { color: var(--text-dim); font-family: var(--mono); font-size: 13px; }

.file-preview {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 10%;
}
.file-preview:not(:empty) { padding-top: 10px; }
.file-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
}
.file-chip b {
  cursor: pointer;
  font-weight: 400;
  color: var(--text-dim);
}
.file-chip b:hover { color: #D9695F; }

.attachment-link {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--gold);
  text-decoration: none;
  border: 1px solid var(--gold-dim);
  border-radius: 4px;
  padding: 5px 10px;
}
.attachment-link:hover { background: rgba(201,165,68,0.08); }

.image-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 10px;
}
.gen-image {
  max-width: 260px;
  max-height: 260px;
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: zoom-in;
}
.image-error {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: #D9695F;
}

.chat-form {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 16px 10%;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.attach-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 17px;
  flex-shrink: 0;
  transition: border-color .15s;
}
.attach-btn:hover { border-color: var(--gold-dim); }
.chat-form textarea {
  flex: 1;
  resize: none;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  max-height: 160px;
}
.chat-form textarea:focus { border-color: var(--gold-dim); }
.chat-form button {
  background: var(--gold);
  color: #14171F;
  border: none;
  border-radius: 6px;
  padding: 0 20px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity .15s;
}
.chat-form button:disabled { opacity: 0.5; cursor: default; }
.chat-form button:not(:disabled):hover { opacity: 0.85; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .messages, .chat-form { padding-left: 5%; padding-right: 5%; }
  .bubble { max-width: 88%; }
}
