/* =========================================================
   PetShop PDV — Estilos globais
   ========================================================= */

:root {
  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light:#dbeafe;
  --success:      #16a34a;
  --warning:      #d97706;
  --danger:       #dc2626;
  --gray-50:      #f9fafb;
  --gray-100:     #f3f4f6;
  --gray-200:     #e5e7eb;
  --gray-300:     #d1d5db;
  --gray-400:     #9ca3af;
  --gray-500:     #6b7280;
  --gray-600:     #4b5563;
  --gray-700:     #374151;
  --gray-800:     #1f2937;
  --gray-900:     #111827;
  --sidebar-w:    240px;
  --header-h:     60px;
  --radius:       8px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
  --shadow:       0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:    0 8px 24px rgba(0,0,0,.12);
  --font:         'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

button { cursor: pointer; font-family: inherit; }

/* =========================================================
   Tela de Login
   ========================================================= */

.login-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 50%, #2563eb 100%);
  padding: 24px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.login-logo .logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}

.login-logo .logo-text span {
  font-size: 12px;
  color: var(--gray-500);
}

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: var(--font);
  color: var(--gray-900);
  background: #fff;
  transition: border-color .15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-input::placeholder { color: var(--gray-400); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, opacity .15s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }

.btn-full { width: 100%; }

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

.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: var(--warning);
}

/* =========================================================
   Layout do App
   ========================================================= */

.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--gray-900);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo h2 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-logo span {
  font-size: 11px;
  color: var(--gray-400);
}

.sidebar-user {
  background: rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-role {
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 2px;
  text-transform: capitalize;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gray-500);
  padding: 8px 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  transition: background .12s, color .12s;
  user-select: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.nav-item.active {
  background: var(--primary);
  color: #fff;
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.nav-item .nav-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.15);
}

.nav-item.active .nav-badge {
  background: rgba(255,255,255,.25);
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* Main */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--header-h);
  min-height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* =========================================================
   Cards KPI
   ========================================================= */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.kpi-card .kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

.kpi-card .kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--gray-400);
}

.kpi-card .kpi-icon {
  font-size: 24px;
  float: right;
  margin-top: -4px;
}

/* =========================================================
   Seção "em breve"
   ========================================================= */

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  text-align: center;
  color: var(--gray-400);
}

.coming-soon .cs-icon { font-size: 48px; margin-bottom: 16px; }

.coming-soon h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 8px;
}

.coming-soon p {
  font-size: 14px;
  margin-bottom: 16px;
  max-width: 320px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: #dcfce7; color: var(--success); }
.badge-yellow { background: #fef9c3; color: var(--warning); }

/* =========================================================
   Tabela
   ========================================================= */

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-900);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  background: var(--gray-50);
  text-align: left;
  padding: 10px 16px;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 12px;
  border-bottom: 1px solid var(--gray-200);
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

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

.table-empty {
  text-align: center;
  padding: 32px !important;
  color: var(--gray-400);
}

/* =========================================================
   Spinner
   ========================================================= */

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
}

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