/**
 * Mapache AI - Brand Design System
 *
 * Global CSS variables following the official branding guide.
 * All colors, typography, and design tokens centralized here.
 */

:root {
  /* ===== Brand Colors - Primary ===== */
  --color-navy: #0a1628;        /* Base, trust, seriousness */
  --color-emerald: #00b388;      /* Action, intelligence, active data */
  --color-white: #ffffff;        /* Clarity, space */

  /* ===== Brand Colors - Secondary ===== */
  --color-gray-light: #f5f7fa;   /* Backgrounds */
  --color-gray-medium: #64748b;  /* Secondary text */
  --color-gray-dark: #1a2332;    /* Main text */

  /* ===== Brand Colors - Accent ===== */
  --color-orange: #ff6b35;       /* Alerts, critical CTAs (use sparingly) */

  /* ===== Additional UI Colors ===== */
  --color-border: #e5e7eb;       /* Default borders */

  /* ===== Typography ===== */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* ===== Spacing ===== */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */

  /* ===== Border Radius ===== */
  --radius-sm: 0.25rem;    /* 4px */
  --radius-md: 0.5rem;     /* 8px - maximum per brand guide */

  /* ===== Shadows ===== */
  --shadow-subtle: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 4px 6px rgba(0, 0, 0, 0.1);

  /* ===== Transitions ===== */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* ===== Global Resets & Base Styles ===== */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-primary);
  color: var(--color-gray-dark);
  background: var(--color-gray-light);
  margin: 0;
  padding: 0;
}

/* ===== Utility Classes ===== */
.text-primary {
  color: var(--color-gray-dark);
}

.text-secondary {
  color: var(--color-gray-medium);
}

.text-emerald {
  color: var(--color-emerald);
}

.bg-white {
  background: var(--color-white);
}

.bg-light {
  background: var(--color-gray-light);
}

/* ===== Button Base Styles ===== */
.btn {
  font-family: var(--font-primary);
  font-weight: var(--font-weight-medium);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
  padding: var(--spacing-sm) var(--spacing-md);
}

.btn-primary {
  background: var(--color-emerald);
  color: var(--color-white);
}

.btn-primary:hover {
  background: #009872;
}

.btn-secondary {
  background: var(--color-gray-medium);
  color: var(--color-white);
}

.btn-secondary:hover {
  background: #475569;
}

.btn-danger {
  background: var(--color-orange);
  color: var(--color-white);
}

.btn-danger:hover {
  background: #e55a2b;
}

/* ===== Button Sizes ===== */
.btn-sm {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: 0.85rem;
}

.btn-outline {
  background: white;
  color: var(--color-gray-dark);
  border: 2px solid var(--color-border);
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: var(--color-gray-light);
  border-color: var(--color-gray-medium);
  color: var(--color-gray-dark);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.btn-outline:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ===== Card Styles ===== */
.card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-card);
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card h2 {
  color: var(--color-gray-dark);
  font-size: 1.25rem;
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--spacing-md);
}

/* ===== Layout Containers ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-xl);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-2xl);
}

.header h1 {
  color: var(--color-gray-dark);
  font-size: 1.75rem;
  font-weight: var(--font-weight-bold);
  margin: 0;
}

/* ===== Back Button ===== */
.back-button {
  display: inline-block;
  background: var(--color-white);
  color: var(--color-emerald);
  padding: var(--spacing-xs) var(--spacing-md);
  border-radius: var(--radius-sm);
  text-decoration: none;
  margin-right: var(--spacing-md);
  transition: opacity var(--transition-fast);
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  font-weight: var(--font-weight-medium);
}

.back-button:hover {
  opacity: 0.8;
}

/* ===== Form Elements ===== */
.form-row {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  flex-wrap: wrap;
}

.form-input {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--color-emerald);
  box-shadow: 0 0 0 3px rgba(0, 179, 136, 0.1);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  color: var(--color-gray-medium);
  font-size: 0.9rem;
}

/* ===== Extended Button Styles ===== */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== Result Messages ===== */
.result-message {
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  margin-top: var(--spacing-md);
}

.result-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.result-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* ===== Tables ===== */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead {
  background: var(--color-navy);
  color: var(--color-white);
}

.table th {
  padding: var(--spacing-md);
  text-align: left;
  font-weight: var(--font-weight-semibold);
  white-space: nowrap;
}

.table td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--color-gray-light);
}

.table code {
  background: var(--color-gray-light);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
}

.badge-api {
  background: #dbeafe;
  color: #1e40af;
}

.badge-pdf {
  background: #fef3c7;
  color: #d97706;
}

.badge-ok {
  background: #d4edda;
  color: #155724;
}

.badge-pending {
  background: #fff3cd;
  color: #856404;
}

/* ===== Loading States ===== */
.loading-state {
  text-align: center;
  padding: var(--spacing-2xl);
  color: var(--color-gray-medium);
}

.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid var(--color-gray-light);
  border-radius: 50%;
  border-top-color: var(--color-emerald);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Extended Utilities ===== */
.text-mono {
  font-family: var(--font-mono);
}

.text-small {
  font-size: 0.85rem;
}

.text-bold {
  font-weight: var(--font-weight-semibold);
}

/* ===== Persona Display Component - Copy Button Hover States ===== */
/* Detail Variant */
.persona-header-hover:hover .copy-btn-detail,
.info-item-hover:hover .copy-btn-detail {
  opacity: 1 !important;
}

/* Compact Variant */
.persona-card-compact-hover:hover .copy-btn-compact,
.persona-name-hover:hover .copy-btn-compact,
.persona-rut-hover:hover .copy-btn-compact,
.persona-contact-item-hover:hover .copy-btn-compact {
  opacity: 1 !important;
}
