/* ============================================================
   PETCARE IA — DESIGN SYSTEM
   ============================================================ */

:root {
  --primary: #6C5CE7;
  --primary-dark: #5546c9;
  --secondary: #00CEC9;
  --accent: #FF7675;
  --success: #00B894;
  --warning: #FDCB6E;
  --danger: #D63031;
  --bg: #F8F9FD;
  --bg-card: #FFFFFF;
  --text: #2D3436;
  --text-soft: #636E72;
  --border: #E8EBF2;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 28px rgba(108, 92, 231, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }

a { color: var(--primary); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: .8; }

/* ==================== AUTH PAGES ==================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #6C5CE7 0%, #00CEC9 100%);
}

.auth-container {
  background: #fff;
  padding: 44px 32px;
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  width: 100%;
  max-width: 420px;
  text-align: center;
  animation: fadeUp .5s ease;
}

.auth-logo {
  font-size: 56px;
  margin-bottom: 8px;
  display: inline-block;
  animation: bounce 2s infinite;
}

.auth-container h1 { margin-bottom: 4px; }
.auth-container .subtitle {
  color: var(--text-soft);
  margin-bottom: 28px;
  font-size: 15px;
}

.auth-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-form label {
  font-size: 14px;
  font-weight: 500;
  margin-top: 10px;
  color: var(--text);
}

.auth-form input,
.auth-form select,
.auth-form textarea {
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.auth-footer {
  margin-top: 24px;
  font-size: 14px;
  color: var(--text-soft);
}

/* ==================== BOTÕES ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform .1s, box-shadow .2s, background .2s;
  text-decoration: none;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.3);
  width: 100%;
  margin-top: 20px;
  padding: 16px;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4);
}

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 10px 16px; font-size: 13px; }
.btn-block { width: 100%; }

/* ==================== ALERTAS ==================== */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  text-align: left;
  animation: fadeUp .3s ease;
}
.alert.error { background: #FFE5E5; color: #B71C1C; border-left: 4px solid var(--danger); }
.alert.success { background: #E0F7EF; color: #00796B; border-left: 4px solid var(--success); }
.alert.warning { background: #FFF7E0; color: #B87700; border-left: 4px solid var(--warning); }
.alert.info { background: #E8E7FF; color: #4A3FB8; border-left: 4px solid var(--primary); }

/* ==================== LAYOUT APP ==================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  transition: transform .3s;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  padding: 0 12px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-logo span:first-child { font-size: 28px; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 500;
  transition: background .2s, color .2s;
}

.sidebar-nav a:hover {
  background: var(--bg);
  color: var(--text);
  opacity: 1;
}

.sidebar-nav a.active {
  background: linear-gradient(135deg, var(--primary), #8B7BF0);
  color: #fff;
  box-shadow: 0 4px 14px rgba(108, 92, 231, 0.3);
}

.sidebar-nav a .icon { font-size: 20px; }

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  margin-bottom: 8px;
}

.sidebar-user .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.sidebar-user .info { flex: 1; overflow: hidden; }
.sidebar-user .info strong {
  display: block;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .info small { color: var(--text-soft); font-size: 12px; }

.main-content {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  max-width: 100%;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h1 { font-size: 26px; }
.page-header p { color: var(--text-soft); font-size: 14px; margin-top: 4px; }

/* ==================== CARDS ==================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
}

.card:hover { box-shadow: var(--shadow-hover); }

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 20px; }
}

@media (max-width: 600px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ==================== AÇÕES RÁPIDAS ==================== */
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 20px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
  text-decoration: none;
  color: var(--text);
  border: 1.5px solid transparent;
}

.quick-action:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  opacity: 1;
}

.quick-action .icon {
  font-size: 28px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.12), rgba(0, 206, 201, 0.12));
}

.quick-action .label { font-weight: 600; font-size: 15px; }
.quick-action .desc { font-size: 12px; color: var(--text-soft); }

/* ==================== LISTAS ==================== */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  margin-bottom: 10px;
  transition: border-color .2s, box-shadow .2s;
}

.list-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }

.list-item .ico {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.12), rgba(0, 206, 201, 0.12));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.list-item .info { flex: 1; min-width: 0; }
.list-item .info strong { display: block; font-size: 15px; margin-bottom: 2px; }
.list-item .info small { color: var(--text-soft); font-size: 13px; }

/* ==================== BADGES ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
}
.badge-primary { background: rgba(108, 92, 231, 0.12); color: var(--primary); }
.badge-success { background: rgba(0, 184, 148, 0.12); color: var(--success); }
.badge-warning { background: rgba(253, 203, 110, 0.2); color: #B87700; }
.badge-danger { background: rgba(214, 48, 49, 0.12); color: var(--danger); }

/* ==================== CHAT ==================== */
.chat-wrapper {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 140px);
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: #fff;
}

.chat-header strong { display: block; font-size: 15px; }
.chat-header small { color: var(--success); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.chat-header small::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  display: inline-block;
}

.chat-messages {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg);
}

.msg {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: 20px;
  font-size: 15px;
  line-height: 1.5;
  animation: fadeUp .3s ease;
  word-wrap: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: 6px;
}

.msg.assistant {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.chat-input {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  background: #fff;
}

.chat-input input {
  flex: 1;
  padding: 14px 18px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 15px;
  font-family: inherit;
}
.chat-input input:focus {
  outline: none;
  border-color: var(--primary);
}

.chat-input button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  transition: transform .1s;
}
.chat-input button:active { transform: scale(0.93); }

/* ==================== FORMULÁRIOS ==================== */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ==================== EMPTY STATE ==================== */
.empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-soft);
}
.empty .icon { font-size: 56px; margin-bottom: 12px; opacity: 0.5; }
.empty p { font-size: 15px; margin-bottom: 16px; }

/* ==================== ANIMAÇÕES ==================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.fade-up { animation: fadeUp .4s ease; }