/* CSS Variables - Design System */
:root {
  /* ZEISS Brand Colors */
  --background: 0 0% 100%;
  --foreground: 0 0% 20%;
  --card: 0 0% 95%;
  --card-foreground: 0 0% 20%;
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 20%;
  
  /* ZEISS Blue Primary */
  --primary: 209 100% 33%;
  --primary-foreground: 0 0% 100%;
  --primary-hover: 207 79% 46%;
  
  /* Secondary Backgrounds */
  --secondary: 0 0% 95%;
  --secondary-foreground: 0 0% 20%;
  
  /* Muted Elements */
  --muted: 0 0% 95%;
  --muted-foreground: 0 0% 47%;
  
  /* Accent */
  --accent: 0 0% 95%;
  --accent-foreground: 0 0% 30%;
  
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 100%;
  
  /* Borders and Inputs */
  --border: 0 0% 88%;
  --input: 0 0% 88%;
  --ring: 209 100% 33%;
  
  /* Disabled State */
  --disabled: 0 0% 74%;
  --disabled-foreground: 0 0% 100%;
  
  --radius: 0.5rem;
  
  /* Transitions */
  --transition-smooth: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease-in-out;
}

/* Reset & Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  line-height: 1.5;
}

/* Animations */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

.animate-fade-in {
  animation: fade-in 0.4s ease-out;
}

.animate-slide-in {
  animation: slide-in 0.3s ease-out;
}

/* Utility Classes */
.min-h-screen {
  min-height: 100vh;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-1 {
  flex: 1 1 0%;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-3 {
  gap: 0.75rem;
}

.gap-4 {
  gap: 1rem;
}

.gap-10 {
  gap: 2.5rem;
}

.space-y-4 > * + * {
  margin-top: 1rem;
}

.space-y-6 > * + * {
  margin-top: 1.5rem;
}

.container {
  width: 100%;
  max-width: 1280px;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}

.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.py-6 {
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

.py-16 {
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.pt-6 {
  padding-top: 1.5rem;
}

.pl-4 {
  padding-left: 1rem;
}

.mt-1 {
  margin-top: 0.25rem;
}

.w-full {
  width: 100%;
}

.w-auto {
  width: auto;
}

.max-w-2xl {
  max-width: 42rem;
}

.max-w-4xl {
  max-width: 56rem;
}

.h-12 {
  height: 3rem;
}

.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}

.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.text-base {
  font-size: 1rem;
  line-height: 1.5rem;
}

.text-xl {
  font-size: 1.25rem;
  line-height: 1.75rem;
}

.text-3xl {
  font-size: 1.875rem;
  line-height: 2.25rem;
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.font-bold {
  font-weight: 700;
}

.text-center {
  text-align: center;
}

.tracking-tight {
  letter-spacing: -0.025em;
}

.leading-relaxed {
  line-height: 1.625;
}

.whitespace-pre-wrap {
  white-space: pre-wrap;
}

.relative {
  position: relative;
}

.transition-all {
  transition: var(--transition-smooth);
}

.transition-transform {
  transition: transform 0.2s ease-in-out;
}

.transition-shadow {
  transition: box-shadow 0.2s ease-in-out;
}

.transition-colors {
  transition: color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* Colors */
.bg-background {
  background-color: hsl(var(--background));
}

.bg-muted-light {
  background-color: hsl(var(--muted) / 0.3);
}

.bg-gradient {
  background: linear-gradient(to right, hsl(var(--primary) / 0.05), hsl(var(--primary) / 0.1));
}

.text-foreground {
  color: hsl(var(--foreground));
}

.text-muted-foreground {
  color: hsl(var(--muted-foreground));
}

.text-muted-foreground-light {
  color: hsl(var(--muted-foreground) / 0.7);
}

.text-primary {
  color: hsl(var(--primary));
}

.border-b {
  border-bottom-width: 1px;
}

.border-t {
  border-top-width: 1px;
}

.border-l {
  border-left-width: 1px;
}

.border-border {
  border-color: hsl(var(--border));
}

.shadow-sm {
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.shadow-lg {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.rounded-lg {
  border-radius: var(--radius);
}

.rounded-md {
  border-radius: calc(var(--radius) - 2px);
}

.rounded-full {
  border-radius: 9999px;
}

/* Header */
header {
  border-bottom: 1px solid hsl(var(--border));
  background-color: hsl(var(--background));
}

/* Input */
.input {
  height: 3rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.75rem 1rem;
  font-size: 1rem;
  transition: var(--transition-smooth);
  outline: none;
}

.input:focus {
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
  border-color: hsl(var(--ring));
}

.input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.input::placeholder {
  color: hsl(var(--muted-foreground));
}

.focus-shadow:focus {
  box-shadow: 0 10px 30px -10px hsl(var(--primary) / 0.1);
}

/* Textarea */
.textarea {
  min-height: 5rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: var(--transition-smooth);
  outline: none;
  font-family: inherit;
  resize: vertical;
}

.textarea:focus {
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
  border-color: hsl(var(--ring));
}

.textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

.min-h-200 {
  min-height: 200px;
}

.resize-y {
  resize: vertical;
}

/* Button */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition-smooth);
  cursor: pointer;
  border: none;
  outline: none;
  height: 3rem;
  padding: 0.5rem 1.25rem;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.button:hover:not(:disabled) {
  background-color: hsl(var(--primary) / 0.9);
}

.button:focus-visible {
  box-shadow: 0 0 0 2px hsl(var(--ring));
}

.button:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.button-zeiss {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.button-zeiss:hover:not(:disabled) {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  background-color: hsl(var(--primary) / 0.9);
}

.px-6 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* Icons */
.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.icon-medium {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.icon-large {
  width: 1.5rem;
  height: 1.5rem;
}

.icon-container {
  padding: 0.5rem;
  border-radius: 9999px;
  background-color: hsl(var(--primary) / 0.1);
}

/* Card */
.card {
  border-radius: var(--radius);
  border: 2px solid hsl(var(--border));
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  margin: 0;
}

.card-content {
  padding: 1.5rem;
}

.card-content-no-padding {
  padding: 0;
}

.prose p {
  margin: 0;
}

/* Loading */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 0;
}

.spinner {
  width: 3.5rem;
  height: 3.5rem;
  border: 4px solid hsl(var(--muted));
  border-top-color: hsl(var(--primary));
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-color: hsl(var(--primary) / 0.05);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Chat */
.chat-messages {
  height: 450px;
  overflow-y: auto;
  padding: 1.5rem;
  background: linear-gradient(to bottom, hsl(var(--muted) / 0.2), hsl(var(--background)));
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 1rem;
}

.empty-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background-color: hsl(var(--primary) / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-input-container {
  border-top: 1px solid hsl(var(--border));
  background-color: hsl(var(--muted) / 0.3);
  padding: 1rem;
}

.message-user {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1rem;
  animation: fade-in 0.3s ease-out;
}

.message-assistant {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem;
  animation: fade-in 0.3s ease-out;
}

.message-bubble {
  max-width: 85%;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.message-user .message-bubble {
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-top-right-radius: 0.25rem;
}

.message-assistant .message-bubble {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border) / 0.5);
  color: hsl(var(--foreground));
  border-top-left-radius: 0.25rem;
}

.message-text {
  font-size: 0.875rem;
  line-height: 1.625;
  white-space: pre-wrap;
  margin: 0;
}

.message-time {
  font-size: 0.75rem;
  opacity: 0.7;
  margin-top: 0.25rem;
}

.chat-loading {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 1rem;
  animation: fade-in 0.3s ease-out;
}

.chat-loading .message-bubble {
  background-color: hsl(var(--card));
  border: 1px solid hsl(var(--border) / 0.5);
  border-top-left-radius: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.typing-dots {
  display: flex;
  gap: 0.25rem;
}

.typing-dot {
  width: 0.5rem;
  height: 0.5rem;
  background-color: hsl(var(--primary) / 0.6);
  border-radius: 50%;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
  animation-delay: -0.16s;
}

.typing-text {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

/* Responsive */
@media (min-width: 768px) {
  /* Desktop/Tablet: input mais longo, botão mais compacto */
  .button-zeiss {
    max-width: 150px;
    padding: 0.5rem 1rem;
  }
  
  header .flex {
    flex-direction: row;
    align-items: center;
  }
  
  header .border-l {
    border-left: 1px solid hsl(var(--border));
    border-top: none;
    padding-top: 0;
  }
}

@media (max-width: 768px) {
  header .container {
    padding: 0.75rem 1rem;
  }
  
  header .flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  
  header .h-12 {
    height: 2.5rem;
  }
  
  header .border-l {
    border-left: none;
    border-top: 1px solid hsl(var(--border));
    padding-left: 0;
    padding-top: 0.75rem;
  }
  
  .text-3xl {
    font-size: 1.5rem;
    line-height: 2rem;
  }
  
  .py-16 {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
  
  .flex-col.gap-3 {
    gap: 0.75rem;
  }
  
  .message-bubble {
    max-width: 90%;
  }
}

@media (max-width: 640px) {
  .sm\:flex-row {
    flex-direction: row;
  }
  
  .sm\:w-auto {
    width: auto;
  }
  
  header .h-12 {
    height: 2rem;
  }
  
  .text-xl {
    font-size: 1rem;
    line-height: 1.5rem;
  }
  
  .card-header {
    padding: 1rem;
  }
  
  .card-content {
    padding: 1rem;
  }
  
  .chat-messages {
    height: 350px;
  }
}

@media (min-width: 640px) {
  .flex-col.gap-3.sm\:flex-row {
    flex-direction: row;
  }
}
