/* ============================================================
   CHAMADOSPRO — Design System inspirado no Figma
   Paleta: multi-color vibrante, profissional
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Cores principais */
  --bg:           #F7F8FA;
  --surface:      #FFFFFF;
  --surface-2:    #F0F2F5;
  --border:       #E5E7EB;
  --border-soft:  rgba(0,0,0,.06);

  /* Texto */
  --text:         #111827;
  --text-2:       #374151;
  --muted:        #6B7280;
  --muted-2:      #9CA3AF;

  /* Primária — Figma Purple */
  --primary:      #A259FF;
  --primary-dark: #7C3AED;
  --primary-light:#EDE9FE;
  --primary-ring: rgba(162,89,255,.18);

  /* Secundária — Figma Green */
  --green:        #0ACF83;
  --green-light:  #D1FAE5;

  /* Figma Blue */
  --blue:         #1ABCFE;
  --blue-light:   #DBEAFE;

  /* Figma Red/Orange */
  --red:          #F24E1E;
  --red-light:    #FEE2E2;

  /* Figma Yellow */
  --yellow:       #F5A623;
  --yellow-light: #FEF3C7;

  /* Sidebar */
  --sidebar-bg:   #18181B;
  --sidebar-text: #A1A1AA;
  --sidebar-active-bg: rgba(162,89,255,.15);
  --sidebar-active-text: #A259FF;
  --sidebar-w:    260px;
  --sidebar-mini: 68px;

  /* Misc */
  --radius:       10px;
  --radius-lg:    14px;
  --radius-sm:    6px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:       0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:    0 10px 30px rgba(0,0,0,.12);
  --transition:   .15s ease;
}

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

html, body {
  height: 100%;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ============================================================
   LAYOUT
   ============================================================ */
.wrapper {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns var(--transition);
}
.wrapper.nosidebar { grid-template-columns: 1fr; }
.wrapper.mini { --sidebar-w: var(--sidebar-mini); }

.content {
  padding: 28px 32px;
  min-width: 0;
  overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width var(--transition);
  width: var(--sidebar-w);
  flex-shrink: 0;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  min-height: 64px;
}
.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; flex-shrink: 0;
}
.sidebar-logo-text {
  font-size: 15px; font-weight: 700;
  color: #fff; letter-spacing: -.02em;
  white-space: nowrap;
}

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

.nav-label {
  font-size: 10px; font-weight: 600; letter-spacing: .08em;
  color: rgba(255,255,255,.3); text-transform: uppercase;
  padding: 8px 8px 4px; white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  white-space: nowrap;
}
.nav-item i { font-size: 17px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #fff; text-decoration: none;
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

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

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.page-title {
  font-size: 22px; font-weight: 800;
  color: var(--text); letter-spacing: -.025em;
}
.page-subtitle { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ============================================================
   CARDS & STATS
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 6px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--accent, var(--primary));
}
.stat-card.green  { --accent: var(--green); }
.stat-card.blue   { --accent: var(--blue); }
.stat-card.yellow { --accent: var(--yellow); }
.stat-card.red    { --accent: var(--red); }
.stat-card.purple { --accent: var(--primary); }
.stat-card.gray   { --accent: var(--muted); }

.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--muted); }

/* ============================================================
   TABELAS
   ============================================================ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: collapse; }
thead { background: var(--surface-2); }
thead th {
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 12px 14px; font-size: 13.5px; color: var(--text-2); vertical-align: middle; }

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  white-space: nowrap;
}
.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.badge-green  { background: var(--green-light);  color: #065F46; }
.badge-blue   { background: var(--blue-light);   color: #1E40AF; }
.badge-yellow { background: var(--yellow-light); color: #92400E; }
.badge-red    { background: var(--red-light);    color: #991B1B; }
.badge-purple { background: var(--primary-light);color: #5B21B6; }
.badge-gray   { background: var(--surface-2);    color: var(--muted); }

/* SLA */
.sla-ok     { color: var(--green); }
.sla-warn   { color: var(--yellow); }
.sla-danger { color: var(--red); font-weight: 600; }

/* Prioridade badges */
.badge-prio-baixo     { background: #D1FAE5; color: #065F46; }
.badge-prio-medio     { background: var(--blue-light); color: #1E40AF; }
.badge-prio-alta      { background: var(--yellow-light); color: #92400E; }
.badge-prio-urgente   { background: var(--red-light); color: #991B1B; }
.badge-prio-emergencia{ background: var(--primary-light); color: #5B21B6; }

/* ============================================================
   BOTÕES
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none; outline: none;
  transition: all var(--transition); white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(.92); }
.btn:active { transform: scale(.98); }

.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red); color: #fff; }
.btn-green  { background: var(--green); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }
.btn-ghost {
  background: transparent; color: var(--muted);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-2); }

.form-control {
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit;
  color: var(--text); background: var(--surface);
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
.form-control::placeholder { color: var(--muted-2); }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ============================================================
   MODAIS
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 620px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  transform: scale(.96) translateY(8px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body {
  padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ============================================================
   FILTROS
   ============================================================ */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.filters-bar .form-control {
  width: auto; min-width: 140px;
}

/* ============================================================
   ALERTAS / FLASH
   ============================================================ */
.flash { padding: 11px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  border-left: 3px solid transparent; margin-bottom: 14px;
}
.flash-success { background: var(--green-light); border-color: var(--green); color: #065F46; }
.flash-danger  { background: var(--red-light);   border-color: var(--red);   color: #991B1B; }
.flash-info    { background: var(--blue-light);   border-color: var(--blue);  color: #1E40AF; }

/* ============================================================
   TOPBAR NOTIFICAÇÕES / ONLINE / TIMER
   ============================================================ */
.topbar-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 13px; cursor: pointer;
  transition: all var(--transition); position: relative;
}
.topbar-btn:hover { background: var(--surface-2); }

.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: #fff;
  font-size: 9px; font-weight: 700;
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.online-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); flex-shrink: 0;
}

.timer-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 12px; font-weight: 600;
}
.timer-chip.active { background: #DCFCE7; color: #15803D; }

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  min-width: 220px; z-index: 150;
  display: none; flex-direction: column; overflow: hidden;
}
.dropdown-menu.open { display: flex; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 13px; color: var(--text-2);
  cursor: pointer; transition: background var(--transition);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ============================================================
   DETAIL PANEL (chamados)
   ============================================================ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 10px;
}

.comment-list { display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border-left: 3px solid var(--border);
}
.comment-item.interno { border-left-color: var(--yellow); background: #FFFBEB; }
.comment-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 5px; }
.comment-author { font-weight: 600; font-size: 12.5px; }
.comment-time { font-size: 11px; color: var(--muted); }
.comment-text { font-size: 13.5px; color: var(--text-2); white-space: pre-wrap; }

/* ============================================================
   TIMER WIDGET
   ============================================================ */
.timer-widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.timer-display {
  font-size: 32px; font-weight: 800; font-variant-numeric: tabular-nums;
  letter-spacing: .02em; color: var(--text); text-align: center;
  padding: 10px 0;
}
.timer-display.running { color: var(--green); }

/* ============================================================
   SLA TABLE
   ============================================================ */
.sla-table td:nth-child(2) { font-variant-numeric: tabular-nums; font-size: 12.5px; }

/* ============================================================
   RESPONSIVE / SIDEBAR MINI
   ============================================================ */
.sidebar.mini .nav-item span,
.sidebar.mini .nav-label,
.sidebar.mini .sidebar-logo-text { display: none; }
.sidebar.mini .nav-item { justify-content: center; padding: 10px; }
.sidebar.mini .sidebar-logo { justify-content: center; padding: 16px 12px; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 40px 36px; width: 100%; max-width: 380px;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 0;
}
.login-logo {
  display: flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  border-radius: var(--radius); margin: 0 auto 16px;
  font-size: 28px; color: #fff;
}
.login-title {
  font-size: 22px; font-weight: 800; text-align: center;
  margin-bottom: 6px; letter-spacing: -.02em;
}
.login-subtitle {
  font-size: 13px; color: var(--muted);
  text-align: center; margin-bottom: 24px;
}

/* ============================================================
   TABS (configurações)
   ============================================================ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); border: none; background: none;
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all var(--transition);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ============================================================
   AVATAR
   ============================================================ */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--blue));
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
}

/* ============================================================
   CHIPS / TAGS
   ============================================================ */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--border);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--muted); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

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