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

/* ── Variables ── */
:root {
  --green:       #0F6E56;
  --green-dark:  #085041;
  --green-mid:   #5DCAA5;
  --green-light: #E1F5EE;
  --green-bg:    #f0faf5;
  --white:       #ffffff;
  --text:        #1a1a1a;
  --text-muted:  #5f5e5a;
  --border:      #c8ead8;
  --radius-sm:   8px;
  --radius-md:   16px;
  --radius-full: 999px;
  --font-body:   'DM Sans', 'Segoe UI', sans-serif;
  --font-serif:  'Lora', Georgia, serif;
}

body { font-family: var(--font-body); color: var(--text); }

/* ════════════════════════════════
   LOGIN
════════════════════════════════ */
.login-body {
  min-height: 100vh;
  background: linear-gradient(150deg, #d4f0e4 0%, #e8f8f2 50%, #d6eef8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-bg {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--white);
  border-radius: 20px;
  padding: 44px 40px 36px;
  box-shadow: 0 4px 32px rgba(15, 110, 86, 0.12);
  border: 1px solid var(--border);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid var(--green-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 30px;
  color: #9FE1CB;
  font-weight: 500;
  margin: 0 auto 16px;
}

.login-logo h1 {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  color: var(--green);
  margin-bottom: 6px;
}

.login-logo p {
  font-size: 14px;
  color: var(--text-muted);
}

.alert-error {
  background: #fff0f0;
  border: 1px solid #ffb3b3;
  color: #c0392b;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 20px;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--green-bg);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus { border-color: var(--green); background: var(--white); }
.form-group input::placeholder { color: #bbb; }

.btn-login {
  margin-top: 8px;
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: var(--radius-full);
  padding: 13px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  letter-spacing: 0.02em;
}

.btn-login:hover  { background: #1D9E75; }
.btn-login:active { transform: scale(0.98); }

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: #aaa;
}

/* ════════════════════════════════
   CHAT
════════════════════════════════ */
.chat-body {
  min-height: 100vh;
  background: var(--green-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.chat-wrapper {
  width: 100%;
  max-width: 680px;
  background: var(--white);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 32px rgba(15, 110, 86, 0.12);
  display: flex;
  flex-direction: column;
  min-height: 600px;
  max-height: 90vh;
}

/* Header */
.chat-header {
  background: var(--green);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-left { display: flex; align-items: center; gap: 12px; }

.dw-av {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--green-dark);
  border: 2px solid var(--green-mid);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 18px; color: #9FE1CB; font-weight: 500;
  flex-shrink: 0;
}

.chat-header h2 { font-size: 15px; font-weight: 500; color: #fff; }
.chat-header p  { font-size: 12px; color: #9FE1CB; }

.btn-logout {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.2s;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

/* Progress */
.chat-progress {
  background: var(--green-dark);
  padding: 7px 20px;
  display: flex; align-items: center; gap: 10px;
}
.chat-progress span { font-size: 11px; color: #9FE1CB; white-space: nowrap; }
.progress-bar { flex: 1; height: 3px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green-mid); border-radius: 2px; transition: width 0.5s ease; }

/* Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--green-bg);
}

.msg-row { display: flex; gap: 10px; }
.msg-row.user { flex-direction: row-reverse; }

.msg-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--green-dark);
  border: 1.5px solid var(--green-mid);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: #9FE1CB;
  font-family: var(--font-serif);
  flex-shrink: 0; margin-top: 2px;
}

.msg-row.user .msg-av {
  background: #dbeafe; border-color: #93c5fd;
  color: #1e40af; font-family: var(--font-body); font-size: 11px; font-weight: 500;
}

.msg-bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
}

.msg-row.bot  .msg-bubble { background: var(--white); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-row.user .msg-bubble { background: var(--green); color: #fff; border-bottom-right-radius: 4px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  background: var(--green-light);
  border: 1px solid var(--green-mid);
  color: var(--green);
  padding: 6px 13px;
  border-radius: var(--radius-full);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 0.15s;
}
.chip:hover { background: #c8ead8; }

/* Typing dots */
.typing-dots {
  display: flex; gap: 4px;
  padding: 11px 15px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  border-bottom-left-radius: 4px;
  width: fit-content;
}
.dot {
  width: 7px; height: 7px;
  background: var(--green-mid);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%,60%,100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Footer / input */
.chat-footer {
  padding: 14px 16px;
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-end;
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--green-bg);
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 120px;
  line-height: 1.4;
  transition: border-color 0.2s;
}
.chat-input:focus   { border-color: var(--green); background: var(--white); }
.chat-input::placeholder { color: #aaa; }

.btn-send {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--green);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.1s;
}
.btn-send:hover   { background: #1D9E75; }
.btn-send:active  { transform: scale(0.96); }
.btn-send:disabled { background: #b0b0b0; cursor: default; }

/* Summary card */
.summary-card {
  background: var(--green-light);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-top: 10px;
  font-size: 13px;
}
.summary-card h4 {
  color: var(--green);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  font-weight: 500;
}
.summary-row { display: flex; gap: 8px; margin-bottom: 6px; }
.summary-key { color: var(--text-muted); font-size: 12px; min-width: 90px; }
.summary-val { color: var(--text); font-size: 13px; flex: 1; }

/* Responsive */
@media (max-width: 500px) {
  .login-card { padding: 32px 24px 28px; }
  .chat-body  { padding: 0; }
  .chat-wrapper { border-radius: 0; min-height: 100vh; max-height: 100vh; }
}

/* ── Formulario de dos columnas ── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ── Acciones del canvas completado ── */
.canvas-actions {
  background: #e8f7f0;
  border-top: 2px solid #5DCAA5;
  padding: 16px 20px;
  text-align: center;
}
.canvas-actions-title {
  font-size: 15px;
  font-weight: 500;
  color: #0F6E56;
  margin-bottom: 12px;
}
.canvas-actions-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn-action {
  padding: 10px 22px;
  border-radius: 20px;
  border: none;
  font-size: 14px;
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-download {
  background: var(--white);
  color: var(--green);
  border: 2px solid var(--green);
}
.btn-download:hover { background: var(--green-light); }
.btn-mail {
  background: var(--green);
  color: var(--white);
}
.btn-mail:hover { background: #1D9E75; }
.btn-mail:disabled { background: #b0b0b0; cursor: default; }
.canvas-actions-hint {
  font-size: 13px;
  margin-top: 10px;
  color: var(--text-muted);
}

/* ── Avatar con imagen de Darwinn ── */
.logo-circle {
  background-image: url('../img/darwinn-avatar.png') !important;
  background-size: cover !important;
  background-position: center top !important;
  background-color: transparent !important;
  border: 3px solid var(--green-mid) !important;
  font-size: 0 !important; /* oculta la D */
  width: 88px !important;
  height: 88px !important;
}

.dw-av {
  background-image: url('img/darwinn-avatar.png') !important;
  background-size: cover !important;
  background-position: center top !important;
  background-color: transparent !important;
  font-size: 0 !important;
}

.msg-av:not(.u) {
  background-image: url('img/darwinn-avatar.png') !important;
  background-size: cover !important;
  background-position: center top !important;
  background-color: transparent !important;
  font-size: 0 !important;
}
