/* ══════════════════════════════════════════
   OUTFLOW AI — Stiluri pagina AI
══════════════════════════════════════════ */

/* ── Container pagina ─────────────────────────────────────────────────────── */
#page-ai {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: calc(100vh - 60px);
  padding: 0;
}

/* ── Header AI ────────────────────────────────────────────────────────────── */
.ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.ai-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-header-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.ai-header-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.ai-header-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin-top: 1px;
}

/* ── Status bar ───────────────────────────────────────────────────────────── */
.ai-status-bar {
  padding: 8px 24px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.ai-status-text {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.ai-status-text.ai-status-ready  { color: #2ecc71; }
.ai-status-text.ai-status-error  { color: #e74c3c; }
.ai-status-text.ai-status-loading { color: #f39c12; }

/* ── Progress bar ─────────────────────────────────────────────────────────── */
#ai-progress-wrap {
  display: none;
  padding: 6px 24px 10px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}

.ai-progress-track {
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
}

#ai-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Messages area ────────────────────────────────────────────────────────── */
#ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}

#ai-messages::-webkit-scrollbar { width: 4px; }
#ai-messages::-webkit-scrollbar-track { background: transparent; }
#ai-messages::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ── Mesaj individual ─────────────────────────────────────────────────────── */
.ai-msg {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  animation: ai-msg-in 0.2s ease;
}

@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-msg-user {
  flex-direction: row-reverse;
}

.ai-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}

.ai-msg-user .ai-msg-avatar {
  background: linear-gradient(135deg, #667eea33, #764ba233);
}

.ai-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(255,255,255,0.88);
}

.ai-msg-user .ai-msg-bubble {
  background: rgba(102,126,234,0.15);
  border-color: rgba(102,126,234,0.25);
  text-align: right;
}

.ai-msg-text { word-break: break-word; }

/* ── Cursor animat ────────────────────────────────────────────────────────── */
.ai-cursor {
  display: inline-block;
  animation: ai-blink 0.8s step-end infinite;
  color: #667eea;
  margin-left: 2px;
}

@keyframes ai-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Code blocks ──────────────────────────────────────────────────────────── */
.ai-code-block {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: #e2e8f0;
  text-align: left;
}

.ai-inline-code {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 12px;
  color: #a78bfa;
}

/* ── Input area ───────────────────────────────────────────────────────────── */
.ai-input-area {
  padding: 14px 24px 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}

.ai-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

#ai-input {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.2s;
  min-height: 42px;
  max-height: 120px;
}

#ai-input:focus {
  border-color: rgba(102,126,234,0.5);
}

#ai-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#ai-input::placeholder {
  color: rgba(255,255,255,0.25);
}

#ai-send-btn {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s, transform 0.1s;
  flex-shrink: 0;
}

#ai-send-btn:hover:not(:disabled) { opacity: 0.85; }
#ai-send-btn:active:not(:disabled) { transform: scale(0.95); }
#ai-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.ai-input-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.2);
  margin-top: 6px;
  text-align: center;
}

/* ── Clear button ─────────────────────────────────────────────────────────── */
#ai-clear-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.2s;
}

#ai-clear-btn:hover {
  background: rgba(231,76,60,0.1);
  border-color: rgba(231,76,60,0.3);
  color: #e74c3c;
}

/* ── WebGPU warning ───────────────────────────────────────────────────────── */
.ai-webgpu-warn {
  background: rgba(231,76,60,0.08);
  border: 1px solid rgba(231,76,60,0.2);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 24px;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.6;
}

.ai-webgpu-warn strong { color: #e74c3c; }

/* ── Mobile ───────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ai-header { padding: 14px 16px 12px; }
  #ai-messages { padding: 14px 16px; }
  .ai-input-area { padding: 10px 16px 14px; }
  .ai-msg-bubble { max-width: 88%; }
}
