/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-dark:       #0a0a0a;
  --bg-sidebar:    #111111;
  --bg-chat:       #0f0f0f;
  --bg-message-ai: #1a1a1a;
  --bg-input:      #1c1c1c;
  --border:        #2a2a2a;
  --accent:        #e8c547;
  --accent-dim:    #b89a30;
  --text-primary:  #f0f0f0;
  --text-secondary:#888888;
  --text-hint:     #555555;
  --radius:        12px;
  --radius-msg:    18px;
}

html, body { height: 100%; font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg-dark); color: var(--text-primary); }

/* ===== LAYOUT ===== */
.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  flex-shrink: 0;
}

.sidebar-header { margin-bottom: 24px; }

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

.logo-icon {
  font-size: 22px;
  color: var(--accent);
}

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.new-chat-btn {
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.new-chat-btn:hover {
  background: var(--bg-input);
  border-color: var(--accent);
  color: var(--accent);
}

.new-chat-btn span { font-size: 18px; line-height: 1; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.powered-by {
  font-size: 11px;
  color: var(--text-hint);
  text-align: center;
}

/* ===== CHAT AREA ===== */
.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-chat);
}

/* ===== HEADER ===== */
.chat-header {
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-chat);
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.agent-avatar {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
}

.agent-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.agent-role {
  font-size: 12px;
  color: var(--text-secondary);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  background: #4ade80;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== MESSAGES ===== */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.messages-container::-webkit-scrollbar { width: 4px; }
.messages-container::-webkit-scrollbar-track { background: transparent; }
.messages-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Welcome screen */
.welcome-screen {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 20px;
}

.welcome-icon {
  font-size: 56px;
  color: var(--accent);
  line-height: 1;
}

.welcome-screen h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.welcome-screen p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.start-btn {
  margin-top: 8px;
  padding: 12px 28px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.start-btn:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}

/* Message bubbles */
.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 780px;
  animation: fadeInUp 0.3s ease;
}

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

.message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.message-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.message.assistant .message-avatar {
  background: var(--accent);
  color: #000;
}

.message.user .message-avatar {
  background: #2a2a2a;
  color: var(--text-secondary);
}

.message-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-msg);
  font-size: 15px;
  line-height: 1.65;
  max-width: calc(100% - 50px);
}

.message.assistant .message-bubble {
  background: var(--bg-message-ai);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.message.user .message-bubble {
  background: var(--accent);
  color: #000;
  border-top-right-radius: 4px;
  font-weight: 500;
}

/* Markdown-like formatting in messages */
.message-bubble strong { font-weight: 700; }
.message-bubble em { font-style: italic; }


/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 780px;
  animation: fadeInUp 0.3s ease;
}

.typing-dots {
  background: var(--bg-message-ai);
  border: 1px solid var(--border);
  border-radius: var(--radius-msg);
  border-top-left-radius: 4px;
  padding: 16px 20px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--text-hint);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ===== INPUT AREA ===== */
.input-area {
  padding: 16px 28px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-chat);
}

.input-wrapper {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.input-wrapper:focus-within {
  border-color: var(--accent);
}

textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  max-height: 160px;
  line-height: 1.5;
}

textarea::placeholder { color: var(--text-hint); }

.send-btn {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.send-btn:hover:not(:disabled) {
  background: var(--accent-dim);
  transform: scale(1.05);
}

.send-btn:disabled {
  background: var(--border);
  cursor: not-allowed;
}

.send-btn svg {
  width: 16px;
  height: 16px;
  color: #000;
  stroke: #000;
}

.send-btn:disabled svg { stroke: var(--text-hint); }

.upload-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 8px;
  transition: background 0.2s;
  opacity: 0.5;
}

.upload-btn:hover { background: var(--border); opacity: 1; }
.upload-btn svg { width: 18px; height: 18px; stroke: var(--text-secondary); }
.upload-btn.active { opacity: 1; }

/* Image preview in chat */
.message-bubble img {
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  display: block;
  margin-top: 6px;
  object-fit: cover;
}

.input-hint {
  font-size: 11px;
  color: var(--text-hint);
  margin-top: 8px;
  text-align: center;
}

/* ===== BRIEF STYLES ===== */
.brief-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brief-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.brief-section {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
}

.brief-section-title {
  font-weight: 600;
  color: var(--text-secondary);
}

.brief-section-title::after { content: ': '; }

.brief-value { color: var(--text-primary); }

.propuesta-card {
  padding: 9px 12px;
  border-left: 2px solid var(--accent);
  margin: 6px 0 2px;
  background: #131313;
  border-radius: 0 6px 6px 0;
}

.propuesta-nombre {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.propuesta-card .brief-value {
  font-size: 13px;
  color: var(--text-secondary);
}

.brief-question {
  margin-top: 10px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
}

.brief-intro {
  font-size: 13px;
  color: var(--text-secondary);
  font-style: italic;
  padding-bottom: 4px;
}

.list-item {
  display: block;
  padding-left: 10px;
  position: relative;
  line-height: 1.8;
}

.list-item::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* ===== MOCKUP ===== */
.mockup-bubble {
  padding: 14px !important;
  max-width: 340px !important;
}

.mockup-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 10px;
}

.mockup-img {
  width: 100%;
  border-radius: 10px;
  display: block;
  border: 1px solid var(--border);
}

.mockup-download {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 8px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  transition: all 0.2s;
}

.mockup-download:hover {
  background: var(--accent);
  color: #000;
}

.mockup-img {
  cursor: zoom-in;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.lightbox.open { display: flex; }

.lightbox-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-content img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.lightbox-close {
  position: absolute;
  top: -44px;
  right: 0;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.2s;
}

.lightbox-close:hover { background: rgba(255,255,255,0.1); }

.lightbox-download-btn {
  padding: 10px 24px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 14px;
  border-radius: 50px;
  text-decoration: none;
  transition: background 0.2s;
}

.lightbox-download-btn:hover { background: var(--accent-dim); }

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
  .sidebar { display: none; }
  .messages-container { padding: 16px; }
  .input-area { padding: 12px 16px 16px; }
  .chat-header { padding: 12px 16px; }
}
