/* Variables CSS */
:root {
  --v0-primary: #000;
  --v0-primary-hover: #333;
  --v0-background: #fff;
  --v0-surface: #f8f9fa;
  --v0-border: #e1e5e9;
  --v0-text: #1a1a1a;
  --v0-text-secondary: #6b7280;
  --v0-success: #10b981;
  --v0-radius: 12px;
  --v0-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Estilos generales */
.v0-chat-page {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.v0-page-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* Contenedor principal del chat */
#v0-chat-container {
  width: 100%;
  max-width: 800px;
  height: 80vh;
  background: var(--v0-background);
  border-radius: var(--v0-radius);
  box-shadow: var(--v0-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header del chat */
#v0-chat-header {
  padding: 24px;
  background: var(--v0-surface);
  border-bottom: 1px solid var(--v0-border);
  text-align: center;
}

#v0-chat-header h2 {
  margin: 0 0 8px 0;
  font-size: 24px;
  font-weight: 600;
  color: var(--v0-text);
}

#v0-chat-header p {
  margin: 0;
  color: var(--v0-text-secondary);
  font-size: 14px;
}

/* Área de mensajes */
#v0-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Mensajes individuales */
.v0-message {
  display: flex;
  gap: 12px;
  max-width: 85%;
}

.v0-user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.v0-assistant-message {
  align-self: flex-start;
}

.v0-message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.v0-user-message .v0-message-avatar {
  background: var(--v0-primary);
  color: white;
}

.v0-assistant-message .v0-message-avatar {
  background: var(--v0-surface);
}

.v0-message-content {
  background: var(--v0-surface);
  padding: 12px 16px;
  border-radius: var(--v0-radius);
  font-size: 14px;
  line-height: 1.5;
}

.v0-user-message .v0-message-content {
  background: var(--v0-primary);
  color: white;
}

.v0-message-content p {
  margin: 0 0 8px 0;
}

.v0-message-content p:last-child {
  margin-bottom: 0;
}

.v0-message-content ul {
  margin: 8px 0;
  padding-left: 20px;
}

.v0-message-content li {
  margin: 4px 0;
}

/* Código en mensajes */
.v0-message-content pre {
  background: #1a1a1a;
  color: #f8f8f2;
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 12px 0;
  font-family: "Monaco", "Menlo", monospace;
  font-size: 13px;
}

.v0-message-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Monaco", "Menlo", monospace;
  font-size: 13px;
}

/* Sugerencias */
#v0-chat-suggestions {
  padding: 0 20px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.v0-suggestion {
  background: var(--v0-surface);
  border: 1px solid var(--v0-border);
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--v0-text);
}

.v0-suggestion:hover {
  background: var(--v0-primary);
  color: white;
  border-color: var(--v0-primary);
}

/* Input del chat */
#v0-chat-input-container {
  padding: 20px;
  border-top: 1px solid var(--v0-border);
  background: var(--v0-background);
}

#v0-chat-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

#v0-chat-input {
  flex: 1;
  border: 1px solid var(--v0-border);
  border-radius: var(--v0-radius);
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  min-height: 44px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}

#v0-chat-input:focus {
  border-color: var(--v0-primary);
}

#v0-chat-send {
  background: var(--v0-primary);
  color: white;
  border: none;
  border-radius: var(--v0-radius);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

#v0-chat-send:hover:not(:disabled) {
  background: var(--v0-primary-hover);
}

#v0-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Loading */
#v0-chat-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--v0-text-secondary);
  font-size: 14px;
  margin-top: 8px;
}

.v0-loading-dots {
  display: flex;
  gap: 4px;
}

.v0-loading-dots span {
  width: 6px;
  height: 6px;
  background: var(--v0-text-secondary);
  border-radius: 50%;
  animation: v0-loading 1.4s infinite ease-in-out both;
}

.v0-loading-dots span:nth-child(1) {
  animation-delay: -0.32s;
}
.v0-loading-dots span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes v0-loading {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .v0-page-container {
    padding: 10px;
  }

  #v0-chat-container {
    height: 90vh;
  }

  #v0-chat-header {
    padding: 16px;
  }

  #v0-chat-messages {
    padding: 16px;
  }

  #v0-chat-input-container {
    padding: 16px;
  }

  .v0-message {
    max-width: 95%;
  }

  #v0-chat-suggestions {
    padding: 0 16px 16px;
  }
}

/* Scrollbar personalizado */
#v0-chat-messages::-webkit-scrollbar {
  width: 6px;
}

#v0-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#v0-chat-messages::-webkit-scrollbar-thumb {
  background: var(--v0-border);
  border-radius: 3px;
}

#v0-chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--v0-text-secondary);
}

/* Estilos para thinking section */
.v0-thinking-section {
  margin: 16px 0;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  overflow: hidden;
}

.v0-thinking-header {
  background: #f8f9fa;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #e1e5e9;
}

.v0-thinking-icon {
  font-size: 16px;
}

.v0-toggle-thinking {
  margin-left: auto;
  background: #007cba;
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.v0-toggle-thinking:hover {
  background: #005a87;
}

.v0-thinking-content {
  padding: 16px;
  background: #fafbfc;
  font-size: 14px;
  line-height: 1.5;
  color: #666;
  font-style: italic;
}

/* Estilos para code section */
.v0-code-section {
  margin: 20px 0;
  border: 1px solid #e1e5e9;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.v0-code-header {
  background: #1a1a1a;
  color: white;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #333;
}

.v0-code-header strong {
  font-size: 14px;
  font-weight: 500;
}

.v0-code-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.v0-btn {
  background: #333;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
}

.v0-btn:hover {
  background: #555;
  transform: translateY(-1px);
}

.v0-btn-preview {
  background: #007cba;
}

.v0-btn-preview:hover {
  background: #005a87;
}

.v0-btn-download {
  background: #10b981;
}

.v0-btn-download:hover {
  background: #059669;
}

.v0-btn-copy {
  background: #6366f1;
}

.v0-btn-copy:hover {
  background: #4f46e5;
}

.v0-code-block {
  margin: 0;
  background: #1a1a1a;
  color: #f8f8f2;
  padding: 20px;
  overflow-x: auto;
  font-family: "Monaco", "Menlo", "Consolas", monospace;
  font-size: 13px;
  line-height: 1.5;
  max-height: 500px;
  overflow-y: auto;
}

.v0-text-content {
  margin: 16px 0;
  line-height: 1.6;
}

.v0-text-content p {
  margin: 0 0 12px 0;
  color: var(--v0-text);
}

.v0-text-content p:last-child {
  margin-bottom: 0;
}

.v0-text-content strong {
  font-weight: 600;
  color: var(--v0-text);
}

.v0-text-content em {
  font-style: italic;
  color: var(--v0-text-secondary);
}

.v0-text-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "Monaco", "Menlo", monospace;
  font-size: 13px;
  color: var(--v0-text);
}

/* Mejorar la separación entre elementos */
.v0-message-content > .v0-text-content + .v0-code-section {
  margin-top: 16px;
}

.v0-code-section + .v0-text-content {
  margin-top: 16px;
}

/* Scrollbar para código */
.v0-code-block::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.v0-code-block::-webkit-scrollbar-track {
  background: #2a2a2a;
}

.v0-code-block::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

.v0-code-block::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Estilos para indicador de progreso */
.v0-progress-container {
  padding: 16px;
  text-align: center;
}

.v0-progress-text {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 500;
  color: var(--v0-text);
}

.v0-progress-icon {
  animation: v0-pulse 1.5s infinite;
}

@keyframes v0-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.v0-progress-bar {
  width: 100%;
  height: 4px;
  background: #e1e5e9;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.v0-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--v0-primary), var(--v0-success));
  border-radius: 2px;
  animation: v0-progress 2s infinite;
}

@keyframes v0-progress {
  0% {
    width: 0%;
  }
  50% {
    width: 70%;
  }
  100% {
    width: 100%;
  }
}

.v0-progress-steps {
  color: var(--v0-text-secondary);
  font-size: 12px;
}

/* Mejorar loading dots */
.v0-loading-dots span {
  animation-duration: 1.2s;
}

/* Responsive para móviles */
@media (max-width: 768px) {
  .v0-code-actions {
    flex-direction: column;
    gap: 4px;
  }

  .v0-btn {
    font-size: 11px;
    padding: 5px 8px;
  }

  .v0-code-block {
    font-size: 12px;
    padding: 15px;
  }
}
