/* ═══════════════════════════════════════════════════════════════════════════
   Dioscope Admin — Shared Design System
   Extracted from equipa/ pages. Matches existing visual language.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Reset & Base ──────────────────────────────────────────────────────── */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Poppins', sans-serif;
  background: #f0f2f5;
  min-height: 100vh;
  color: #1f2937;
}
a { color: inherit; text-decoration: none; }

/* ─── Layout ────────────────────────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 256px;
  background: linear-gradient(180deg, #1A2F4A 0%, #0F1E2E 100%);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.25s ease, transform 0.25s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: 64px; }
.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-user,
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; }
.sidebar.collapsed .sidebar-logo { height: 24px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo { height: 32px; }
.sidebar-title { color: white; font-weight: 700; font-size: 1.1em; white-space: nowrap; }

.sidebar-user {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user-name { color: white; font-size: 0.85em; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: rgba(255,255,255,0.5); font-size: 0.75em; text-transform: capitalize; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,0.65);
  font-size: 0.85em;
  transition: all 0.15s;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.15); color: white; font-weight: 500; }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-collapse-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  border: none;
  background: none;
  color: rgba(255,255,255,0.5);
  cursor: pointer;
  transition: all 0.15s;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar-collapse-btn svg { transition: transform 0.25s; }

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

/* Top header */
.top-header {
  position: fixed;
  top: 0;
  left: 256px;
  right: 0;
  height: 56px;
  background: #1A2F4A;
  color: white;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  z-index: 90;
  transition: left 0.25s ease;
}
.sidebar.collapsed ~ .top-header { left: 64px; }

.hamburger {
  display: none;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
}
.header-title { font-size: 1.1em; font-weight: 600; flex: 1; }
.header-controls { display: flex; align-items: center; gap: 12px; }
.curso-select {
  padding: 7px 12px;
  border-radius: 8px;
  border: none;
  background: rgba(255,255,255,0.15);
  color: white;
  font-family: inherit;
  font-size: 0.85em;
  cursor: pointer;
}
.curso-select option { background: #1A2F4A; color: white; }
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75em;
  font-weight: 600;
}
.logout-btn {
  padding: 7px 14px;
  background: rgba(255,255,255,0.1);
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 0.85em;
  font-family: inherit;
  transition: background 0.15s;
}
.logout-btn:hover { background: rgba(255,255,255,0.2); }

/* Main content area */
.page-content {
  margin-left: 256px;
  margin-top: 56px;
  padding: 24px;
  min-height: calc(100vh - 56px);
  transition: margin-left 0.25s ease;
}
.sidebar.collapsed ~ .top-header ~ .page-content,
.sidebar.collapsed ~ .page-content { margin-left: 64px; }

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.collapsed { width: 280px; }
  .sidebar.collapsed .sidebar-title,
  .sidebar.collapsed .sidebar-user,
  .sidebar.collapsed .nav-label { display: block; }
  .sidebar.collapsed .sidebar-header { justify-content: flex-start; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; padding: 9px 12px; }

  .top-header { left: 0 !important; }
  .hamburger { display: block; }
  .page-content { margin-left: 0 !important; }
}

@media (max-width: 640px) {
  .page-content { padding: 16px; }
  .header-title { font-size: 0.95em; }
  .curso-select { max-width: 120px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  table { font-size: 0.8em; }
  th, td { padding: 10px 8px; }
}

/* ─── Stats Grid ────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-box {
  background: white;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  text-align: center;
  border-left: 4px solid #1A2F4A;
}
.stat-box.blue   { border-left-color: #3b82f6; }
.stat-box.green  { border-left-color: #10b981; }
.stat-box.yellow { border-left-color: #f59e0b; }
.stat-box.red    { border-left-color: #ef4444; }
.stat-value { font-size: 1.8em; font-weight: 700; color: #1A2F4A; }
.stat-label { font-size: 0.8em; color: #6b7280; margin-top: 2px; }

/* ─── Cards ─────────────────────────────────────────────────────────────── */

.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.card-title {
  font-size: 1.1em;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85em;
  font-weight: 500;
  cursor: pointer;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary   { background: #1A2F4A; color: white; }
.btn-primary:hover:not(:disabled) { background: #243d5e; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-secondary:hover:not(:disabled) { background: #e2e8f0; }
.btn-success   { background: #10b981; color: white; }
.btn-success:hover:not(:disabled) { background: #059669; }
.btn-danger    { background: #ef4444; color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: 6px 12px; font-size: 0.8em; }

/* ─── Tables ────────────────────────────────────────────────────────────── */

.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #e5e7eb; }
th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
tr:hover { background: #f8fafc; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty-row { text-align: center; color: #9ca3af; padding: 40px 16px !important; }

/* ─── Badges ────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 500;
  white-space: nowrap;
}
.badge.info       { background: #dbeafe; color: #1d4ed8; }
.badge.novidade   { background: #d1fae5; color: #047857; }
.badge.importante { background: #fef3c7; color: #b45309; }
.badge.urgente    { background: #fee2e2; color: #dc2626; }
.badge.active     { background: #d1fae5; color: #047857; }
.badge.inactive   { background: #fee2e2; color: #dc2626; }

/* ─── Modals ────────────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: white;
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  border-radius: 16px 16px 0 0;
}
.modal-title { font-weight: 600; font-size: 1.1em; }
.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 1.5em;
  color: #6b7280;
  line-height: 1;
}
.modal-close:hover { background: #f3f4f6; color: #1f2937; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  position: sticky;
  bottom: 0;
  background: white;
  border-radius: 0 0 16px 16px;
}

/* ─── Forms ─────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.85em;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9em;
  transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #1A2F4A;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* ─── Filter Bar ────────────────────────────────────────────────────────── */

.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-group label { font-size: 0.75em; font-weight: 500; color: #6b7280; text-transform: uppercase; letter-spacing: 0.3px; }
.filter-group select,
.filter-group input {
  padding: 8px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85em;
  background: white;
}

/* ─── Toast ─────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: 10px;
  color: white;
  font-size: 0.9em;
  font-family: 'Poppins', sans-serif;
  z-index: 9999;
  animation: toastIn 0.3s ease;
  max-width: 400px;
}
.toast.success { background: #10b981; }
.toast.error   { background: #ef4444; }
.toast.hidden  { display: none; }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Login ─────────────────────────────────────────────────────────────── */

.login-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1A2F4A, #2D4A6A);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.login-overlay.hidden { display: none; }
.login-box {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo img { height: 45px; }
.login-title { text-align: center; font-size: 1.3em; font-weight: 600; color: #1f2937; margin-bottom: 6px; }
.login-subtitle { text-align: center; font-size: 0.85em; color: #6b7280; margin-bottom: 24px; }
.login-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 0.95em;
  margin-bottom: 14px;
  font-family: inherit;
}
.login-input:focus { outline: none; border-color: #1A2F4A; }
.login-btn {
  width: 100%;
  padding: 14px;
  background: #1A2F4A;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.login-btn:hover:not(:disabled) { background: #243d5e; }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.login-error {
  color: #dc2626;
  font-size: 0.85em;
  text-align: center;
  margin-top: 12px;
  display: none;
}
.login-error.show { display: block; }

/* ─── Utility ───────────────────────────────────────────────────────────── */

.hidden  { display: none !important; }
.text-sm { font-size: 0.85em; }
.text-xs { font-size: 0.75em; }
.text-muted { color: #6b7280; }
.text-center { text-align: center; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }

/* ─── Loading Spinner ───────────────────────────────────────────────────── */

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.spinner.dark {
  border-color: rgba(0,0,0,0.1);
  border-top-color: #1A2F4A;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Loading Skeleton ─────────────────────────────────────────────────── */

.loading-skeleton { padding: 8px 0; }
.skeleton-row {
  height: 18px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  margin-bottom: 12px;
  animation: shimmer 1.5s infinite;
}
.skeleton-row:nth-child(2) { width: 85%; }
.skeleton-row:nth-child(3) { width: 70%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
