/* ============================================================
   PETS SYSTEM — Design System (Tokens + Base)
   Inspiración: Premium, cálido, con personalidad
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&family=Poppins:wght@400;500;600;700&display=swap');

/* ── TOKENS ─────────────────────────────────────────────── */
:root {
  /* Colors - Paleta principal */
  --color-primary:       #6C63FF;
  --color-primary-dark:  #5A52D5;
  --color-primary-light: #EEF0FF;
  --color-secondary:     #FF6B9D;
  --color-accent:        #FFC75F;
  --color-success:       #51CF66;
  --color-warning:       #FFD43B;
  --color-danger:        #FF6B6B;
  --color-deceased:      #2D2D2D;

  /* Surface */
  --surface-bg:          #F0F4FF;
  --surface-card:        #FFFFFF;
  --surface-glass:       rgba(255,255,255,0.85);
  --surface-dark:        #1A1A2E;
  --surface-overlay:     rgba(0,0,0,0.5);

  /* Text */
  --text-primary:        #1A1A2E;
  --text-secondary:      #6B7280;
  --text-muted:          #9CA3AF;
  --text-on-primary:     #FFFFFF;

  /* Border */
  --border-light:        #E5E7EB;
  --border-medium:       #D1D5DB;

  /* Shadows */
  --shadow-sm:           0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:           0 4px 16px rgba(108,99,255,0.12);
  --shadow-lg:           0 8px 32px rgba(108,99,255,0.18);
  --shadow-xl:           0 16px 48px rgba(108,99,255,0.24);
  --shadow-card:         0 2px 12px rgba(0,0,0,0.06);

  /* Spacing */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   32px;
  --space-2xl:  48px;
  --space-3xl:  64px;

  /* Radius */
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Typography */
  --font-body:    'Nunito', sans-serif;
  --font-heading: 'Poppins', sans-serif;

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;
  --transition-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── TOKENS OSCUROS (NIGHT MODE) ────────────────────────── */
[data-theme="dark"] {
  --surface-bg:          #0A0A15;
  --surface-card:        #151525;
  --surface-glass:       rgba(21, 21, 37, 0.85);
  --surface-dark:        #000000;
  
  --text-primary:        #F3F4F6;
  --text-secondary:      #9CA3AF;
  --text-muted:          #6B7280;
  
  --border-light:        #2D3748;
  --border-medium:       #4A5568;

  --color-primary-light: rgba(108, 99, 255, 0.2);
  --shadow-card:         0 4px 16px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font-body);
  background: var(--surface-bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── COMPONENTS: Buttons ────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition-spring);
  text-decoration: none;
  white-space: nowrap;
  outline: none;
}
.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--color-primary);
  color: var(--text-on-primary);
  box-shadow: 0 4px 14px rgba(108,99,255,0.4);
}
.btn-primary:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108,99,255,0.5);
}

.btn-secondary {
  background: var(--surface-card);
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn-secondary:hover {
  background: var(--color-primary-light);
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
}
.btn-danger:hover { opacity: 0.9; transform: translateY(-2px); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--border-light); color: var(--text-primary); }

.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-icon { padding: 10px; width: 42px; height: 42px; justify-content: center; }

/* ── COMPONENTS: Cards ──────────────────────────────────── */
.card {
  background: var(--surface-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card-body { padding: var(--space-lg); }
.card-header {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}
.card-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

/* ── COMPONENTS: Forms ──────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}
.form-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.form-control {
  padding: 10px 14px;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--surface-card);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  width: 100%;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(108,99,255,0.15);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-md);
}

/* ── COMPONENTS: Badges ─────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-primary  { background: var(--color-primary-light); color: var(--color-primary); }
.badge-success  { background: #ECFDF5; color: #166534; }
.badge-warning  { background: #FFFBEB; color: #92400E; }
.badge-danger   { background: #FFF0F0; color: #9B1C1C; }
.badge-deceased { background: var(--color-deceased); color: white; }
.badge-dark     { background: #374151; color: white; }

/* ── COMPONENTS: Avatar ─────────────────────────────────── */
.avatar {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--surface-card);
  box-shadow: var(--shadow-sm);
  background: var(--surface-bg);
  flex-shrink: 0;
}
.avatar-sm { width: 40px; height: 40px; }
.avatar-lg { width: 80px; height: 80px; border-width: 4px; }
.avatar-xl { width: 120px; height: 120px; border-width: 5px; }
.avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: white;
  font-weight: 800;
  font-size: 1.4rem;
}

/* ── COMPONENTS: Modal ──────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
  backdrop-filter: blur(4px);
  animation: fadeIn 200ms ease;
}
.modal {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 300ms var(--transition-spring);
}
.modal-header {
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface-card);
  z-index: 1;
}
.modal-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.2rem;
}
.modal-body { padding: var(--space-xl); }
.modal-footer {
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
}

/* ── COMPONENTS: Tabs ───────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--surface-bg);
  border-radius: var(--radius-lg);
  padding: 4px;
}
.tab-btn {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tab-btn.active {
  background: var(--surface-card);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}
.tab-btn:hover:not(.active) { color: var(--text-primary); background: rgba(255,255,255,0.5); }

/* ── COMPONENTS: Toast ──────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-dark);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  animation: slideInRight 300ms var(--transition-spring);
}
.toast.success { background: var(--color-success); color: #1A1A1A; }
.toast.error   { background: var(--color-danger); }
.toast.warning { background: var(--color-warning); color: #1A1A1A; }

/* ── COMPONENTS: Empty State ─────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-muted);
}
.empty-state .emoji { font-size: 4rem; margin-bottom: var(--space-md); display: block; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: var(--space-sm); }

/* ── UTILITIES ──────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── ANIMATIONS ─────────────────────────────────────────── */
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp    { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(60px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse      { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes spin       { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes shimmer    {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--border-light) 25%, var(--surface-bg) 50%, var(--border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

/* ── SCROLLBAR ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-bg); }
::-webkit-scrollbar-thumb { background: var(--color-primary); border-radius: 3px; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  .tabs { flex-wrap: wrap; }
  .tab-btn { flex: auto; }
  
  .modal-body { padding: var(--space-lg); }
  .modal-header { padding: var(--space-md) var(--space-lg); }
}

@media (max-width: 400px) {
  .modal-backdrop { padding: var(--space-sm); }
  .modal-body { padding: var(--space-md); }
  .modal-header { padding: var(--space-sm) var(--space-md); }
  .modal-footer { padding: var(--space-sm) var(--space-md); flex-direction: column; }
  .modal-footer .btn { width: 100%; justify-content: center; }
  
  .btn { padding: 8px 16px; font-size: 0.85rem; }
  
  .empty-state { padding: var(--space-xl) var(--space-md); }
}
