/* ═══════════════════════════════════════════════════
   Luna Pet Box — Design System
   ═══════════════════════════════════════════════════ */

/* ─── Design Tokens ─────────────────────────────── */
:root {
  /* Colors - Primary (Mint/Aqua — baseada em #7effe0) */
  --primary-50:  #f0fff9;
  --primary-100: #ccffec;
  --primary-200: #9affe0;
  --primary-300: #7effe0;
  --primary-400: #4cebc6;
  --primary-500: #22d3a8;
  --primary-600: #15ad88;
  --primary-700: #11876c;
  --primary-800: #0f6a56;
  --primary-900: #0c5046;

  /* Colors - Neutral (Dark theme) */
  --neutral-50:  #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-850: #1a1a1a;
  --neutral-900: #171717;
  --neutral-950: #0a0a0a;

  /* Semantic */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger:  #ef4444;
  --info:    #3b82f6;

  /* Surfaces */
  --bg-body:    var(--neutral-950);
  --bg-sidebar: var(--neutral-900);
  --bg-card:    var(--neutral-850);
  --bg-input:   var(--neutral-800);
  --bg-hover:   var(--neutral-700);
  --border:     var(--neutral-700);
  --border-light: var(--neutral-800);

  /* Text */
  --text-primary:   var(--neutral-100);
  --text-secondary: var(--neutral-400);
  --text-muted:     var(--neutral-500);

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary-400); text-decoration: none; }
a:hover { color: var(--primary-300); }

/* ─── Scrollbar ─────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--neutral-600); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--neutral-500); }

/* ─── Layout Shell ──────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  transition: transform var(--transition-base);
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  border-bottom: 1px solid var(--border-light);
  gap: 0.75rem;
}

.sidebar-brand h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, var(--primary-400), var(--primary-300));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
}

.sidebar-brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.auth-brand-logo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin-bottom: 0.75rem;
  display: inline-block;
  object-fit: cover;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-nav-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 1rem 0.75rem 0.5rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: rgba(34, 211, 168, 0.15);
  color: var(--primary-400);
}

.sidebar-link .icon {
  font-size: 1.125rem;
  width: 1.5rem;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link .icon svg {
  width: 18px;
  height: 18px;
}

.toast-icon svg {
  width: 18px;
  height: 18px;
}

.btn svg {
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-light);
}

/* Main area */
.main-area {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(12px);
  background: rgba(23, 23, 23, 0.85);
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

.topbar-avatar:hover {
  box-shadow: 0 0 0 2px var(--primary-400);
}

/* Content */
.content {
  flex: 1;
  padding: 1.5rem;
}

/* ─── Cards ─────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--transition-fast);
}

.card:hover { border-color: var(--border); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-icon.purple { background: rgba(34, 211, 168, 0.15); color: var(--primary-400); }
.stat-icon.green  { background: rgba(34, 197, 94, 0.15);  color: var(--success); }
.stat-icon.amber  { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.stat-icon.blue   { background: rgba(59, 130, 246, 0.15); color: var(--info); }

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ─── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: #fff;
  border-color: var(--primary-600);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-400), var(--primary-500));
  box-shadow: 0 4px 16px rgba(34, 211, 168, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.25);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.75rem; font-size: 1rem; }
.btn-icon { padding: 0.5rem; width: 36px; height: 36px; }

/* ─── Inputs ────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(34, 211, 168, 0.15);
}

.form-input::placeholder { color: var(--text-muted); }

.form-textarea { resize: vertical; min-height: 80px; }

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-error {
  font-size: 0.75rem;
  color: var(--danger);
}

/* ─── Table ─────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}

.table tr:last-child td { border-bottom: none; }

.table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ─── Badges ────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger  { background: rgba(239,68,68,0.15);  color: var(--danger); }
.badge-info    { background: rgba(59,130,246,0.15);  color: var(--info); }
.badge-neutral { background: rgba(115,115,115,0.15); color: var(--neutral-400); }

.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ─── Modal ─────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-title { font-size: 1.05rem; font-weight: 600; }

.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1.25rem;
  padding: 0.25rem; border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { padding: 1.5rem; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
}

/* ─── Toast ─────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 1rem; right: 1rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  pointer-events: auto;
  animation: toast-in 0.3s ease forwards;
  max-width: 400px;
  font-size: 0.875rem;
}

.toast.removing { animation: toast-out 0.3s ease forwards; }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-message { flex: 1; color: var(--text-secondary); }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 1rem; padding: 0.125rem;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left: 3px solid var(--info); }
.toast-info .toast-icon { color: var(--info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* ─── Empty State ───────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-state-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.5rem; }
.empty-state-text { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 1.5rem; max-width: 320px; }

/* ─── Loading Skeleton ──────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--neutral-800) 25%, var(--neutral-700) 50%, var(--neutral-800) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── Mobile ────────────────────────────────────── */
.mobile-menu-btn {
  display: none;
  background: none; border: none; cursor: pointer;
  color: var(--text-primary); font-size: 1.5rem;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 35;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .main-area { margin-left: 0; }
  .mobile-menu-btn { display: flex; }
  .content { padding: 1rem; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
}
