/* HeiDi backoffice — UI minimal, oscura, focused */
:root {
  --bg: #0f1115;
  --bg-elev: #181a21;
  --bg-input: #1f222b;
  --border: #2a2d36;
  --text: #e8e8ea;
  --text-muted: #9a9da8;
  --accent: #f97316;
  --user-msg: #1e3a5f;
  --assistant-msg: #1a1c23;
  --error: #ef4444;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; }

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--bg-elev); padding: 40px; border-radius: 12px;
  border: 1px solid var(--border); width: 320px; text-align: center;
}
.login-card h1 { font-size: 32px; margin-bottom: 4px; }
.login-card .muted { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.login-card label { display: block; text-align: left; font-size: 13px; color: var(--text-muted); }
.login-card input { width: 100%; margin-top: 6px; margin-bottom: 16px;
  padding: 10px 12px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px; font-family: var(--font); }
.login-card button { width: 100%; padding: 10px; background: var(--accent);
  color: white; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; }
.login-card button:hover { opacity: 0.9; }

/* Layout */
.layout { display: grid; grid-template-columns: 260px 1fr; height: 100vh; }

/* Sidebar */
.sidebar {
  background: var(--bg-elev); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px; gap: 12px;
}
.sidebar-header { display: flex; justify-content: space-between; align-items: center; }
.sidebar-header h1 { font-size: 18px; font-weight: 600; }
.ghost { background: transparent; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 16px; padding: 4px 8px; }
.ghost:hover { color: var(--text); }
button.primary { background: var(--accent); color: white; border: none; padding: 10px;
  border-radius: 8px; font-size: 14px; cursor: pointer; font-weight: 500; }
button.primary:hover { opacity: 0.9; }
button.block { width: 100%; }
.session-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.session-item {
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
  color: var(--text-muted); display: flex; justify-content: space-between; align-items: center;
}
.session-item:hover { background: var(--bg-input); color: var(--text); }
.session-item.active { background: var(--bg-input); color: var(--text); }
.session-item .del { opacity: 0; transition: opacity 0.15s; padding: 2px 6px; }
.session-item:hover .del { opacity: 0.6; }
.session-item .del:hover { opacity: 1; color: var(--error); }
.sidebar-footer { padding-top: 12px; border-top: 1px solid var(--border); }
.muted { color: var(--text-muted); }
.small { font-size: 11px; }
.powered-by { display: block; text-align: center; font-size: 10px; letter-spacing: 0.05em; opacity: 0.55; }

/* Chat area */
.chat-area { display: flex; flex-direction: column; height: 100vh; }
.messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 720px; padding: 12px 16px; border-radius: 12px; line-height: 1.5; font-size: 14px; }
.msg.user { background: var(--user-msg); align-self: flex-end; }
.msg.assistant { background: var(--assistant-msg); border: 1px solid var(--border); align-self: flex-start; }
.msg.error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--error); color: var(--error); align-self: flex-start; }
.msg p { margin: 0; }
.msg pre, .msg code { font-family: var(--mono); font-size: 13px; }
.msg pre { background: rgba(0,0,0,0.3); padding: 8px 12px; border-radius: 6px; overflow-x: auto; margin-top: 8px; }
.msg strong { font-weight: 600; }
.msg-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.typing { font-style: italic; color: var(--text-muted); }

/* Input */
.chat-input { display: flex; gap: 8px; padding: 16px 24px; background: var(--bg-elev); border-top: 1px solid var(--border); }
.chat-input textarea {
  flex: 1; padding: 10px 14px; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 14px; font-family: var(--font);
  resize: none; outline: none;
}
.chat-input textarea:focus { border-color: var(--accent); }
.chat-input button { padding: 0 20px; background: var(--accent); color: white; border: none;
  border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.chat-input button:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-input button:hover:not(:disabled) { opacity: 0.9; }

.empty-state { color: var(--text-muted); text-align: center; padding: 40px 20px; }
.empty-state h2 { font-size: 22px; font-weight: 500; margin: 24px 0 8px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* --- Brand en sidebar (avatar pequeño) --- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { font-size: 18px; font-weight: 600; margin: 0; }
.brand-avatar {
  width: 32px; height: 32px; border-radius: 8px; object-fit: cover;
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.4);
  animation: brand-pulse 3s ease-in-out infinite;
}
@keyframes brand-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(249, 115, 22, 0.35); }
  50%      { box-shadow: 0 0 22px rgba(249, 115, 22, 0.65); }
}

/* --- Hero avatar (empty state) --- */
.hero-avatar-wrap {
  position: relative;
  display: inline-block;
  padding: 24px;
}
.hero-avatar {
  width: 180px; height: 180px; border-radius: 24px; object-fit: cover;
  box-shadow:
    0 0 40px rgba(249, 115, 22, 0.4),
    0 0 80px rgba(249, 115, 22, 0.2);
  animation: float 4s ease-in-out infinite, glow-pulse 5s ease-in-out infinite;
  position: relative; z-index: 2;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
@keyframes glow-pulse {
  0%, 100% {
    box-shadow:
      0 0 40px rgba(249, 115, 22, 0.4),
      0 0 80px rgba(249, 115, 22, 0.2);
  }
  50% {
    box-shadow:
      0 0 60px rgba(249, 115, 22, 0.55),
      0 0 120px rgba(249, 115, 22, 0.3);
  }
}

/* --- Estrellas titilando alrededor del hero --- */
.star {
  position: absolute;
  width: 4px; height: 4px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  opacity: 0;
  z-index: 1;
  animation: twinkle 3s ease-in-out infinite;
}
.star.s1 { top: 12%;  left: 8%;   animation-delay: 0.0s; }
.star.s2 { top: 20%;  right: 6%;  animation-delay: 0.5s; }
.star.s3 { top: 70%;  left: 4%;   animation-delay: 1.0s; }
.star.s4 { top: 80%;  right: 10%; animation-delay: 1.5s; width: 3px; height: 3px; }
.star.s5 { top: 5%;   left: 50%;  animation-delay: 2.0s; width: 3px; height: 3px; }
.star.s6 { bottom: 8%; left: 45%; animation-delay: 0.7s; }
.star.s7 { top: 45%;  left: -2%;  animation-delay: 2.5s; width: 3px; height: 3px; }
.star.s8 { top: 45%;  right: -2%; animation-delay: 1.2s; }
@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50%      { opacity: 0.9; transform: scale(1.2); }
}
