/**
 * ALCAPEDIDOS - Paleta e layout
 * Roxo principal, verde sucesso, cinza fundo, cards brancos
 */
:root {
  --primary: #6F42C1;
  --primary-light: #8E63E6;
  --success: #34C38F;
  --success-light: #C6F1E7;
  --bg-main: #F5F6F8;
  --card-bg: #FFFFFF;
  --border-color: #E9ECEF;
  --text-main: #343A40;
  --text-muted: #6C757D;
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 72px;
  --topbar-height: 60px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-main);
  background: var(--bg-main);
  min-height: 100vh;
}

/* ----- Login ----- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, rgba(111, 66, 193, 0.08) 0%, var(--bg-main) 50%);
}
.login-wrapper { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
  border-radius: 16px;
  border: none;
  background: var(--card-bg);
}
.login-logo {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary) !important;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 10px;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
}

/* Botões arredondados (global) */
.btn { border-radius: 10px; }
.btn-sm { border-radius: 8px; }
.btn-lg { border-radius: 12px; }

/* ----- Dashboard layout ----- */
.dashboard-body { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--card-bg);
  box-shadow: 2px 0 12px rgba(0,0,0,0.06);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1030;
  display: flex;
  flex-direction: column;
  transition: width 0.25s ease, transform 0.25s ease;
}
.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  min-height: 60px;
}
.sidebar-brand { text-decoration: none; color: var(--primary); font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.sidebar-logo-img { height: 36px; width: auto; max-width: 140px; object-fit: contain; flex-shrink: 0; }
.sidebar-logo-text { color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-header-actions { display: flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.sidebar-collapse-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  font-size: 1.15rem;
  color: var(--primary);
  background: rgba(111, 66, 193, 0.12);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.sidebar-collapse-btn:hover {
  background: rgba(111, 66, 193, 0.22);
  color: var(--primary);
  transform: scale(1.05);
}
.sidebar-collapse-btn:active { transform: scale(0.98); }
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  font-size: 1.25rem;
  color: var(--text-muted);
  background: transparent;
  transition: background 0.2s, color 0.2s;
}
.sidebar-toggle:hover { background: rgba(0,0,0,0.08); color: var(--text-main); }
.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text-main);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav .nav-item:hover { background: rgba(111, 66, 193, 0.08); color: var(--primary); }
.sidebar-nav .nav-item.active {
  background: rgba(111, 66, 193, 0.12);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar-nav .nav-item i { font-size: 1.2rem; opacity: 0.9; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-color); }
.sidebar-footer small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* Sidebar colapsada */
.dashboard-body.sidebar-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}
.dashboard-body.sidebar-collapsed .sidebar .sidebar-logo-text,
.dashboard-body.sidebar-collapsed .sidebar .nav-item span,
.dashboard-body.sidebar-collapsed .sidebar-footer small {
  display: none !important;
}
.dashboard-body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
.dashboard-body.sidebar-collapsed .sidebar-logo-img { max-width: 40px; height: 32px; }
.dashboard-body.sidebar-collapsed .sidebar-header { justify-content: center; padding: 0.75rem; }
.dashboard-body.sidebar-collapsed .sidebar-header-actions { position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%); }
.dashboard-body.sidebar-collapsed .sidebar-nav .nav-item { justify-content: center; padding: 0.75rem; }
.dashboard-body.sidebar-collapsed .sidebar-nav .nav-item i { margin: 0; }
.dashboard-body.sidebar-collapsed .sidebar-footer { padding: 0.5rem; text-align: center; }
.dashboard-body.sidebar-collapsed .main-wrapper { margin-left: var(--sidebar-width-collapsed); }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1029;
}
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-overlay.show { display: block; }
  .dashboard-body.sidebar-collapsed .main-wrapper { margin-left: 0; }
}

.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@media (max-width: 991.98px) {
  .main-wrapper { margin-left: 0; }
}

.topbar {
  height: var(--topbar-height);
  background: var(--card-bg);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 1020;
}
.topbar-title { font-weight: 600; color: var(--text-main); }
.topbar-user { color: var(--text-main); font-weight: 500; }
.topbar-actions .btn-link { color: var(--text-main); }

.content-area {
  flex: 1;
  padding: 1.5rem;
}

/* ----- Cards e estatísticas ----- */
.stat-card { border-radius: 12px; transition: transform 0.2s; }
.stat-card:hover { transform: translateY(-2px); }
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.stat-icon-primary { background: rgba(111, 66, 193, 0.15); color: var(--primary); }
.stat-icon-success { background: var(--success-light); color: var(--success); }
.stat-icon-warning { background: rgba(253, 126, 20, 0.15); color: #fd7e14; }
.stat-icon-info { background: rgba(13, 202, 240, 0.15); color: #0dcaf0; }

.card {
  border-radius: 12px;
  border: 1px solid var(--border-color);
}
.card-header { border-radius: 12px 12px 0 0; }

/* ----- Tabelas ----- */
.table th { font-weight: 600; color: var(--text-main); }
.badge { font-weight: 500; }

/* ----- Utilitários ----- */
.text-success { color: var(--success) !important; }
.bg-success { background-color: var(--success) !important; }
.btn-outline-primary { border-color: var(--primary); color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
