﻿/* ============================================================
   TIAJUDA SEGEPE — Custom CSS v4 (Tailwind + DaisyUI)
   ============================================================ */

/* Override primary color to SEGEPE blue (#012186) */
:root,
[data-theme="corporate"] {
  --color-primary: oklch(22% 0.18 263);
  --color-primary-content: oklch(99% 0 0);
  --color-primary-focus: oklch(18% 0.18 263);
  --color-secondary: oklch(89% 0.22 95);
  --color-secondary-content: oklch(10% 0 0);
}

/* Hide Alpine.js cloak */
[x-cloak] { display: none !important; }

/* Font */
body { font-family: 'Inter', system-ui, sans-serif; }

/* ----- Sidebar nav links ----- */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.875rem;
  border-radius: 0.5rem;
  color: rgb(148 163 184);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.sidebar-link:hover { background: rgba(255,255,255,0.1); color: #fff; }
.sidebar-link.active { background: rgba(255,255,255,0.15); color: #fff; }
.sidebar-link .icon { width: 1.125rem; text-align: center; font-size: 0.875rem; flex-shrink: 0; }

/* ----- Protocol badge ----- */
.badge-proto {
  font-family: 'Courier New', monospace;
  letter-spacing: 0.5px;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ----- Timeline history ----- */
.timeline-wrap { position: relative; }
.timeline-item {
  position: relative;
  padding: 0.875rem 0 0.875rem 2rem;
  border-bottom: 1px solid oklch(var(--b3));
}
.timeline-item:last-child { border-bottom: none; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 0.1875rem;
  top: 1.25rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: oklch(22% 0.18 263);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.9), 0 0 0 3px oklch(22% 0.18 263);
}
.timeline-item::after {
  content: '';
  position: absolute;
  left: 0.4375rem;
  top: 1.75rem;
  width: 1px;
  height: calc(100% - 0.75rem);
  background: oklch(var(--b3));
}
.timeline-item:last-child::after { display: none; }

/* ----- Stat cards gradient ----- */
.stat-card { border-radius: 1rem; padding: 1.25rem; color: white; }
.stat-card .icon-wrap {
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
}

/* ----- SLA progress ----- */
.sla-bar { height: 4px; border-radius: 2px; width: 5rem; }

/* ----- Pulsing urgent dot ----- */
@keyframes dot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}
.urgent-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: dot-pulse 1.4s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 3px;
}

/* ----- HTMX loading indicator ----- */
.htmx-indicator { opacity: 0; transition: opacity 0.2s; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* ----- Table overdue row ----- */
.row-overdue td { background: rgba(254,202,202,0.4) !important; }
[data-theme="night"] .row-overdue td { background: rgba(127,29,29,0.25) !important; }

/* ----- Nova demanda rápida (não vista ainda) ----- */
.row-nova-ar td { background: rgba(16,185,129,0.08) !important; border-left: 3px solid #10b981; }
[data-theme="night"] .row-nova-ar td { background: rgba(16,185,129,0.12) !important; }

/* ----- Command palette ----- */
.cmd-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 20vh; padding-left: 1rem; padding-right: 1rem;
}

/* ----- Form labels ----- */
.label-required::after {
  content: ' *';
  color: oklch(var(--er));
}

/* ----- Scrollbar thin ----- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,0.5); border-radius: 4px; }

/* ----- Print ----- */
@media print {
  .drawer-side, nav, .no-print, .topbar { display: none !important; }
  main { padding: 0 !important; }
}

/* ============================================================
   VIEW TRANSITIONS
   - Navegação: snap instantâneo (sem fade-through-branco)
   - Toggle dark/light: JS controla clip-path; animation:none
     no CSS para não interferir
   ============================================================ */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}
::view-transition-new(root) { z-index: 2; }
::view-transition-old(root) { z-index: 1; }

/* ============================================================
   PAGE — Card entrance animation
   ============================================================ */
main .card {
  animation: card-appear 0.22s ease-out both;
}
@keyframes card-appear {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0);   }
}

/* ============================================================
   HTMX GLOBAL PROGRESS BAR
   ============================================================ */
#htmx-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9998;
  height: 2px; background: oklch(89% 0.22 95);
  transform-origin: left; transform: scaleX(0);
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
}
#htmx-bar.running {
  opacity: 1;
  animation: htmx-bar-run 1.6s ease-in-out infinite;
}
#htmx-bar.done {
  transform: scaleX(1) !important;
  animation: none;
  opacity: 0;
  transition: opacity 0.35s;
}
@keyframes htmx-bar-run {
  0%   { transform: scaleX(0);    }
  60%  { transform: scaleX(0.72); }
  100% { transform: scaleX(0.9);  }
}

/* ============================================================
   SKELETON LOADING — dashboard table during HTMX refresh
   ============================================================ */
.sk-row { display: none; }
#table-section.htmx-request .sk-row { display: table-row; }
#table-section.htmx-request tbody tr:not(.sk-row) { display: none; }

/* ============================================================
   FORCE WHITE TEXT — buttons, alerts
   ============================================================ */
.btn-primary,
.btn-primary *,
.btn-primary:hover { color: #ffffff !important; }

.alert-error,
.alert-error *  { color: #ffffff !important; }

/* Select text overflow */
.select { text-overflow: ellipsis; }

/* Toast max-width wider */
.toast .alert { max-width: min(480px, 92vw) !important; }

/* ============================================================
   CURTAIN — Login / Logout overlay
   ============================================================ */
@keyframes hpulse {
  0%   { transform: scale(1);    }
  14%  { transform: scale(1.15); }
  28%  { transform: scale(1.06); }
  42%  { transform: scale(1.12); }
  70%  { transform: scale(1);    }
  100% { transform: scale(1);    }
}

.curtain-heart-bg {
  position: absolute;
  inset: 0;
  background: url('/assets/FundoAnimado.png') no-repeat center center;
  background-size: cover;
  opacity: .7;
  pointer-events: none;
  transform-origin: center center;
  animation: hpulse 2s ease-out infinite;
}

.curtain-label {
  position: relative;
  z-index: 1;
  color: #FFDA00;
  font-family: 'Inter', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
