/* ═══════════════════════════════════════════════════════════
   SISTEMA YALL — CSS Customizado (Estilo AdminLTE/Argon)
   ═══════════════════════════════════════════════════════════ */

:root {
  --primary:    #5e72e4;
  --secondary:  #8392ab;
  --success:    #2dce89;
  --info:       #11cdef;
  --warning:    #fb6340;
  --danger:     #f5365c;
  --dark:       #172b4d;
  --light:      #f8f9fe;
  --sidebar-bg: #1a1e2e;
  --sidebar-w:  260px;
  --sidebar-collapsed: 70px;
  --topbar-h:   60px;
  --gradient-primary: linear-gradient(135deg, #5e72e4 0%, #825ee4 100%);
  --gradient-success: linear-gradient(135deg, #2dce89 0%, #2dcecc 100%);
  --gradient-info:    linear-gradient(135deg, #11cdef 0%, #1171ef 100%);
  --gradient-warning: linear-gradient(135deg, #fb6340 0%, #fbb140 100%);
  --gradient-danger:  linear-gradient(135deg, #f5365c 0%, #f56036 100%);
  --shadow-sm:  0 .125rem .25rem rgba(0,0,0,.075);
  --shadow:     0 .5rem 1rem rgba(0,0,0,.10);
  --shadow-lg:  0 1rem 3rem rgba(0,0,0,.12);
  --radius:     .75rem;
}

* { box-sizing: border-box; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--light);
  color: #344767;
  overflow-x: hidden;
}

/* ─── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-bg);
  color: #fff;
  z-index: 1040;
  transition: width .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: 1rem 1.25rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 1.5rem; color: var(--primary); }
.sidebar.collapsed .sidebar-brand span { display: none; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  padding: 1rem 1.25rem .5rem;
  white-space: nowrap;
}
.sidebar.collapsed .nav-section { text-align: center; font-size: .5rem; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  font-size: .875rem;
  border-radius: 0;
  margin: 2px 8px;
  border-radius: .5rem;
  transition: all .2s;
  white-space: nowrap;
}
.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(94,114,228,.25);
  color: #fff;
}
.sidebar-link.active {
  background: var(--gradient-primary);
  box-shadow: 0 4px 12px rgba(94,114,228,.35);
}
.sidebar-link i {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.sidebar.collapsed .sidebar-link span { display: none; }
.sidebar.collapsed .sidebar-link { justify-content: center; padding: .65rem; margin: 2px 6px; }

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ─── TOPBAR ──────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 1030;
  box-shadow: var(--shadow-sm);
  transition: left .3s cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed ~ .topbar { left: var(--sidebar-collapsed); }

.topbar-toggle {
  background: none; border: none;
  font-size: 1.3rem; color: var(--dark);
  cursor: pointer;
  padding: .25rem .5rem;
  border-radius: .375rem;
  transition: background .2s;
}
.topbar-toggle:hover { background: var(--light); }

.topbar-user {
  display: flex;
  align-items: center;
  gap: .75rem;
}
.topbar-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: .85rem;
}

/* ─── CONTENT ─────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 1.5rem;
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left .3s cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

/* ─── KPI CARDS ───────────────────────────────────────── */
.kpi-card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s, box-shadow .2s;
  overflow: hidden;
}
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.kpi-card .card-body { padding: 1.25rem; }
.kpi-icon {
  width: 52px; height: 52px;
  border-radius: .75rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: #fff;
}
.kpi-icon.bg-gradient-primary { background: var(--gradient-primary); }
.kpi-icon.bg-gradient-success { background: var(--gradient-success); }
.kpi-icon.bg-gradient-warning { background: var(--gradient-warning); }
.kpi-icon.bg-gradient-info    { background: var(--gradient-info); }
.kpi-icon.bg-gradient-danger  { background: var(--gradient-danger); }
.kpi-value { font-size: 1.5rem; font-weight: 700; color: var(--dark); }
.kpi-label { font-size: .8rem; color: var(--secondary); text-transform: uppercase; letter-spacing: .05em; }

/* ─── TABELAS ─────────────────────────────────────────── */
.table-card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-card .card-header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.05);
  padding: 1rem 1.25rem;
}
.table-modern {
  margin: 0;
}
.table-modern thead th {
  background: var(--light);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--secondary);
  font-weight: 600;
  border: none;
  padding: .85rem 1rem;
}
.table-modern tbody tr {
  transition: all .15s;
  border-bottom: 1px solid rgba(0,0,0,.04);
}
.table-modern tbody tr:hover {
  background: rgba(94,114,228,.04);
  transform: scale(1.001);
}
.table-modern tbody td {
  vertical-align: middle;
  padding: .85rem 1rem;
  font-size: .875rem;
}

/* ─── BADGES DE STATUS ────────────────────────────────── */
.badge-status { font-size: .75rem; padding: .4em .8em; border-radius: 50rem; font-weight: 600; }
.badge-ENVIADO { background: rgba(17,205,239,.12); color: #11cdef; }
.badge-EM_ANALISE { background: rgba(251,99,64,.12); color: #fb6340; }
.badge-APROVADO { background: rgba(45,206,137,.12); color: #2dce89; }
.badge-NEGADO { background: rgba(245,54,92,.12); color: #f5365c; }
.badge-COMPRA_REALIZADA { background: rgba(94,114,228,.12); color: #5e72e4; }
.badge-CANCELADO { background: rgba(131,146,171,.12); color: #8392ab; }
.badge-REEMBOLSO_EM_ANALISE { background: rgba(251,177,64,.12); color: #d4a232; }
.badge-REEMBOLSO_APROVADO { background: rgba(45,206,137,.12); color: #2dce89; }
.badge-REEMBOLSO_NEGADO { background: rgba(245,54,92,.12); color: #f5365c; }
.badge-REEMBOLSADO { background: rgba(45,206,204,.12); color: #2dcecc; }

/* ─── BADGES DE TIPO ──────────────────────────────────── */
.badge-COMPRA { background: rgba(94,114,228,.12); color: #5e72e4; }
.badge-REEMBOLSO { background: rgba(251,99,64,.12); color: #fb6340; }

/* ─── BOTÕES ──────────────────────────────────────────── */
.btn-gradient-primary {
  background: var(--gradient-primary);
  border: none; color: #fff;
  box-shadow: 0 4px 12px rgba(94,114,228,.35);
  transition: all .2s;
}
.btn-gradient-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(94,114,228,.45);
  color: #fff;
}
.btn-gradient-success {
  background: var(--gradient-success);
  border: none; color: #fff;
  box-shadow: 0 4px 12px rgba(45,206,137,.35);
}
.btn-gradient-success:hover { transform: translateY(-1px); color: #fff; }

.btn-soft-primary {
  background: rgba(94,114,228,.1);
  color: var(--primary); border: none;
}
.btn-soft-primary:hover { background: rgba(94,114,228,.2); color: var(--primary); }

.btn-soft-danger {
  background: rgba(245,54,92,.1);
  color: var(--danger); border: none;
}
.btn-soft-danger:hover { background: rgba(245,54,92,.2); color: var(--danger); }

/* ─── FORMULÁRIOS ─────────────────────────────────────── */
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(94,114,228,.15);
}

/* ─── MODAL ───────────────────────────────────────────── */
.modal-content { border: none; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 1px solid rgba(0,0,0,.05); }
.modal-footer { border-top: 1px solid rgba(0,0,0,.05); }

/* ─── PAGINAÇÃO ───────────────────────────────────────── */
.page-link { color: var(--primary); border-radius: .5rem !important; margin: 0 3px; border: none; }
.page-link:hover { background: rgba(94,114,228,.1); color: var(--primary); }
.page-item.active .page-link { background: var(--primary); border: none; }

/* ─── CHAT IA WIDGET ──────────────────────────────────── */
.chat-fab {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(94,114,228,.4);
  z-index: 1050;
  cursor: pointer;
  transition: all .3s;
  animation: pulse-chat 2s infinite;
}
.chat-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 28px rgba(94,114,228,.5);
}
@keyframes pulse-chat {
  0%, 100% { box-shadow: 0 6px 20px rgba(94,114,228,.4); }
  50% { box-shadow: 0 6px 30px rgba(94,114,228,.6); }
}

.chat-panel {
  position: fixed;
  bottom: 96px; right: 24px;
  width: 380px;
  max-height: 520px;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 1050;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp .3s ease;
}
.chat-panel.open { display: flex; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-header {
  background: var(--gradient-primary);
  color: #fff;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-header h6 { margin: 0; font-weight: 600; }
.chat-close { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }

.chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  max-height: 340px;
  background: #f8f9fe;
}
.chat-msg {
  margin-bottom: .75rem;
  display: flex;
  gap: .5rem;
}
.chat-msg.user { justify-content: flex-end; }
.chat-msg .bubble {
  max-width: 80%;
  padding: .6rem .9rem;
  border-radius: 1rem;
  font-size: .875rem;
  line-height: 1.4;
}
.chat-msg.user .bubble {
  background: var(--primary);
  color: #fff;
  border-bottom-right-radius: .25rem;
}
.chat-msg.assistant .bubble {
  background: #fff;
  color: var(--dark);
  border: 1px solid rgba(0,0,0,.06);
  border-bottom-left-radius: .25rem;
  box-shadow: var(--shadow-sm);
}

.chat-typing {
  display: none;
  padding: .5rem 1rem;
  font-size: .8rem;
  color: var(--secondary);
}
.chat-typing.show { display: flex; align-items: center; gap: .5rem; }
.typing-dots span {
  width: 6px; height: 6px;
  background: var(--secondary);
  border-radius: 50%;
  display: inline-block;
  animation: typingBounce .6s infinite alternate;
}
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typingBounce {
  from { opacity: .3; transform: translateY(0); }
  to { opacity: 1; transform: translateY(-4px); }
}

.chat-input-area {
  display: flex;
  padding: .75rem;
  border-top: 1px solid rgba(0,0,0,.06);
  gap: .5rem;
}
.chat-input-area input {
  flex: 1;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 50rem;
  padding: .5rem 1rem;
  font-size: .875rem;
  outline: none;
}
.chat-input-area input:focus { border-color: var(--primary); }
.chat-input-area button {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .2s;
}
.chat-input-area button:hover { transform: scale(1.05); }

/* ─── LOGIN PAGE ──────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1e2e 0%, #2d3561 50%, #5e72e4 100%);
}
.login-card {
  width: 100%;
  max-width: 420px;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.login-card .card-header {
  background: var(--gradient-primary);
  text-align: center;
  padding: 2rem;
}
.login-card .card-header h3 {
  color: #fff;
  font-weight: 700;
  margin: 0;
  font-size: 1.5rem;
}
.login-card .card-header p {
  color: rgba(255,255,255,.7);
  margin: .5rem 0 0;
  font-size: .9rem;
}
.login-card .card-body { padding: 2rem; }

/* ─── PAGE HEADER ─────────────────────────────────────── */
.page-header {
  margin-bottom: 1.5rem;
}
.page-header h2 {
  font-weight: 700;
  color: var(--dark);
  margin: 0;
}
.page-header .breadcrumb {
  background: none;
  padding: 0;
  margin: .25rem 0 0;
  font-size: .8rem;
}

/* ─── DETALHES ────────────────────────────────────────── */
.detail-card {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.detail-card .card-header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.05);
  font-weight: 600;
}
.detail-label { font-size: .75rem; text-transform: uppercase; color: var(--secondary); letter-spacing: .05em; }
.detail-value { font-size: 1rem; font-weight: 600; color: var(--dark); }

/* ─── TIMELINE ────────────────────────────────────────── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: rgba(94,114,228,.15);
}
.timeline-item { position: relative; padding-bottom: 1.5rem; }
.timeline-dot {
  position: absolute; left: -2rem; top: 4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(94,114,228,.2);
}
.timeline-content { font-size: .875rem; }
.timeline-date { font-size: .75rem; color: var(--secondary); }

/* ─── RESPONSIVE ──────────────────────────────────────── */
@media (max-width: 992px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .sidebar-brand span,
  .sidebar .sidebar-link span,
  .sidebar .nav-section { display: none; }
  .sidebar .sidebar-link { justify-content: center; padding: .65rem; margin: 2px 6px; }
  .topbar { left: var(--sidebar-collapsed); }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .sidebar.expanded { width: var(--sidebar-w); }
  .sidebar.expanded .sidebar-brand span,
  .sidebar.expanded .sidebar-link span,
  .sidebar.expanded .nav-section { display: block; }
  .sidebar.expanded .sidebar-link { justify-content: flex-start; padding: .65rem 1.25rem; margin: 2px 8px; }
}
@media (max-width: 576px) {
  .chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
  .main-content { padding: 1rem; }
}
