/* ============================================================
   SSMA – Gestão de Planos de Ação
   Estilo Principal v1.0
   ============================================================ */

/* ─── Variáveis ─────────────────────────────────────────────── */
:root {
  --ssma-blue:      #0a2342;
  --ssma-blue-mid:  #1a4a7c;
  --ssma-blue-light:#e8f0fe;
  --ssma-green:     #0d6b3b;
  --ssma-green-mid: #16a34a;
  --ssma-green-light:#dcfce7;
  --ssma-yellow:    #f59e0b;
  --ssma-yellow-lt: #fef3c7;
  --ssma-red:       #dc2626;
  --ssma-red-light: #fee2e2;
  --ssma-orange:    #ea580c;
  --ssma-gray:      #6b7280;
  --ssma-gray-lt:   #f8fafc;
  --sidebar-width:  260px;
  --topbar-height:  60px;
  --footer-height:  44px;
}

/* ─── Reset / Base ──────────────────────────────────────────── */
* { box-sizing: border-box; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: .9rem;
  color: #1f2937;
  background: #f1f5f9;
  margin: 0;
}

/* ─── Topbar ────────────────────────────────────────────────── */
.ssma-topbar {
  background: linear-gradient(90deg, var(--ssma-blue) 0%, var(--ssma-blue-mid) 100%);
  height: var(--topbar-height);
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1050;
  border-bottom: 3px solid var(--ssma-green);
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}

.topbar-logo-icon {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff;
  border: 1px solid rgba(255,255,255,.25);
}
.topbar-title { font-size: .88rem; font-weight: 700; color: #fff; line-height: 1.1; }
.topbar-sub   { font-size: .68rem; color: rgba(255,255,255,.6); letter-spacing: .5px; }

/* ─── Sidebar ───────────────────────────────────────────────── */
.wrapper { margin-top: var(--topbar-height); min-height: calc(100vh - var(--topbar-height) - var(--footer-height)); }

.sidebar {
  width: var(--sidebar-width);
  background: var(--ssma-blue);
  min-height: calc(100vh - var(--topbar-height) - var(--footer-height));
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .3s ease;
  border-right: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand {
  padding: 18px 20px 12px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--ssma-green), var(--ssma-green-mid));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem;
}
.brand-name { font-size: .9rem; font-weight: 700; color: #fff; line-height: 1; }
.brand-sub  { font-size: .65rem; color: rgba(255,255,255,.5); letter-spacing: 1px; text-transform: uppercase; }

.sidebar-nav { padding: 8px 0; }
.nav-label {
  font-size: .62rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 8px 20px 4px;
}

.sidebar-nav .nav-link {
  color: rgba(255,255,255,.72);
  padding: 9px 20px;
  font-size: .84rem;
  border-radius: 0;
  transition: all .2s;
  display: flex; align-items: center;
}
.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
  padding-left: 24px;
}
.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, rgba(13,107,59,.5), rgba(13,107,59,.2));
  color: #fff;
  border-left: 3px solid var(--ssma-green-mid);
}
.nav-icon { width: 18px; margin-right: 10px; font-size: .82rem; opacity: .8; }

.nav-group-toggle { cursor: pointer; }
.nav-group-toggle .nav-arrow { font-size: .6rem; transition: transform .3s; }
.nav-group-toggle[aria-expanded="true"] .nav-arrow { transform: rotate(90deg); }

.sub-link { padding: 7px 20px 7px 16px !important; font-size: .82rem; }
.sub-link.active { background: rgba(255,255,255,.08) !important; }

.sidebar-footer {
  position: sticky;
  bottom: 0;
  background: rgba(0,0,0,.2);
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
}
.user-avatar-sm {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.15);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: .8rem;
}
.sf-name { font-size: .78rem; font-weight: 600; color: #fff; }
.sf-role { font-size: .64rem; color: rgba(255,255,255,.5); }

/* ─── Main Content ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - var(--topbar-height) - var(--footer-height));
  transition: margin-left .3s ease;
}

/* ─── Footer ────────────────────────────────────────────────── */
.ssma-footer {
  height: var(--footer-height);
  background: #fff;
  border-top: 1px solid #e5e7eb;
  padding: 0 24px;
  display: flex; align-items: center;
  font-size: .75rem;
  color: var(--ssma-gray);
  margin-left: var(--sidebar-width);
  transition: margin-left .3s ease;
}

/* ─── User Button ───────────────────────────────────────────── */
.user-btn {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  color: #fff;
  padding: 5px 10px;
}
.user-btn:hover { background: rgba(255,255,255,.18); color: #fff; }
.user-avatar {
  width: 28px; height: 28px;
  background: var(--ssma-green-mid);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; color: #fff;
}
.user-name { font-size: .8rem; font-weight: 600; color: #fff; line-height: 1.1; }
.user-role { font-size: .65rem; color: rgba(255,255,255,.55); }

/* ─── Notificações ──────────────────────────────────────────── */
.notif-dropdown { width: 320px; padding: 0; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.notif-header { background: var(--ssma-blue); color: #fff; padding: 12px 16px; font-size: .82rem; font-weight: 600; }
.notif-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #f1f5f9; font-size: .8rem; }
.notif-item:hover { background: #f8fafc; }
.notif-unread { background: #eff6ff; }
.notif-title { font-weight: 600; color: #1f2937; }
.notif-time { font-size: .7rem; color: #9ca3af; margin-top: 1px; }
.notif-empty { padding: 20px; text-align: center; color: #9ca3af; font-size: .82rem; }
.notif-footer { display: flex; justify-content: space-between; padding: 10px 14px; background: #f8fafc; font-size: .75rem; }
.notif-footer a { color: var(--ssma-blue-mid); text-decoration: none; }

/* ─── Página: títulos ────────────────────────────────────────── */
.page-header {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  border-left: 4px solid var(--ssma-blue-mid);
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.page-header-title { font-size: 1.1rem; font-weight: 700; color: var(--ssma-blue); margin: 0; }
.page-header-sub { font-size: .78rem; color: var(--ssma-gray); margin-top: 2px; }

/* ─── KPI Cards ──────────────────────────────────────────────── */
.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  display: flex; align-items: center; gap: 16px;
  transition: transform .2s, box-shadow .2s;
  border: 1px solid #e5e7eb;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.kpi-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.kpi-blue   { background: var(--ssma-blue-light); color: var(--ssma-blue-mid); }
.kpi-green  { background: var(--ssma-green-light); color: var(--ssma-green); }
.kpi-yellow { background: var(--ssma-yellow-lt); color: #b45309; }
.kpi-red    { background: var(--ssma-red-light); color: var(--ssma-red); }
.kpi-value  { font-size: 2rem; font-weight: 800; line-height: 1; color: #1f2937; }
.kpi-label  { font-size: .75rem; color: var(--ssma-gray); margin-top: 2px; text-transform: uppercase; letter-spacing: .5px; }
.kpi-trend  { font-size: .72rem; margin-top: 4px; }

/* ─── Cards genéricos ───────────────────────────────────────── */
.ssma-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 6px rgba(0,0,0,.06);
  border: 1px solid #e5e7eb;
  margin-bottom: 20px;
}
.ssma-card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}
.ssma-card-title { font-size: .88rem; font-weight: 700; color: var(--ssma-blue); }

/* ─── Tabelas ────────────────────────────────────────────────── */
.table-ssma thead th {
  background: var(--ssma-blue);
  color: #fff;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .3px;
  border: none;
  white-space: nowrap;
}
.table-ssma tbody tr:hover { background: #f8fafc; }
.table-ssma td { font-size: .82rem; vertical-align: middle; }

/* ─── Progress bar ──────────────────────────────────────────── */
.progress-ssma { height: 8px; border-radius: 20px; background: #e5e7eb; }
.progress-ssma .progress-bar { border-radius: 20px; }

/* ─── Badges ────────────────────────────────────────────────── */
.bg-orange { background-color: var(--ssma-orange) !important; color: #fff !important; }

/* ─── Formulários ────────────────────────────────────────────── */
.form-label { font-size: .82rem; font-weight: 600; color: #374151; margin-bottom: 4px; }
.form-control, .form-select {
  font-size: .85rem;
  border-radius: 8px;
  border: 1.5px solid #94a3b8;
}
.form-control:focus, .form-select:focus {
  border-color: var(--ssma-blue-mid);
  box-shadow: 0 0 0 .2rem rgba(26,74,124,.15);
}
.required-mark { color: var(--ssma-red); margin-left: 2px; }

/* ─── Botões ─────────────────────────────────────────────────── */
.btn-ssma-primary {
  background: linear-gradient(135deg, var(--ssma-blue), var(--ssma-blue-mid));
  border: none; color: #fff; border-radius: 8px; font-weight: 600;
}
.btn-ssma-primary:hover { opacity: .9; color: #fff; }
.btn-ssma-success {
  background: linear-gradient(135deg, var(--ssma-green), var(--ssma-green-mid));
  border: none; color: #fff; border-radius: 8px; font-weight: 600;
}
.btn-ssma-success:hover { opacity: .9; color: #fff; }
.btn-ssma-danger { background: var(--ssma-red); border: none; color: #fff; border-radius: 8px; font-weight: 600; }
.btn-ssma-danger:hover { opacity: .9; color: #fff; }

/* ─── Linha do tempo (histórico) ─────────────────────────────── */
.timeline { list-style: none; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 20px; top: 0; bottom: 0; width: 2px; background: #e5e7eb; }
.timeline-item { display: flex; gap: 14px; margin-bottom: 20px; position: relative; }
.timeline-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; flex-shrink: 0; z-index: 1; border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.timeline-body { background: #f8fafc; border-radius: 10px; padding: 12px 14px; flex-grow: 1; border: 1px solid #e5e7eb; }
.timeline-date { font-size: .72rem; color: var(--ssma-gray); margin-top: 4px; }

/* ─── Alert vencido (piscante) ──────────────────────────────── */
.alerta-vencido {
  animation: pulse-red 1.5s infinite;
  border-left: 4px solid var(--ssma-red) !important;
}
@keyframes pulse-red {
  0%, 100% { background-color: #fff5f5; }
  50% { background-color: #fee2e2; }
}
.row-critico-vencido { background: var(--ssma-red-light) !important; }

/* ─── Evidências ────────────────────────────────────────────── */
.evidencia-card {
  border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
  transition: all .2s;
}
.evidencia-card:hover { background: #f8fafc; border-color: var(--ssma-blue-mid); }
.evidencia-icon {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}

/* ─── Upload area ────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed #d1d5db;
  border-radius: 10px; padding: 30px;
  text-align: center; transition: all .2s; cursor: pointer;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--ssma-blue-mid);
  background: var(--ssma-blue-light);
}

/* ─── Indicador SLA ──────────────────────────────────────────── */
.sla-gauge {
  text-align: center;
}
.sla-value { font-size: 2.5rem; font-weight: 800; }
.sla-label { font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--ssma-gray); }

/* ─── Tooltips / badges especiais ───────────────────────────── */
.badge-programa {
  background: var(--ssma-blue-light); color: var(--ssma-blue-mid);
  font-size: .7rem; padding: 4px 8px; border-radius: 6px; font-weight: 600;
}
.badge-origin {
  background: #f3e8ff; color: #7c3aed;
  font-size: .7rem; padding: 4px 8px; border-radius: 6px;
}

/* ─── DataTables custom ─────────────────────────────────────── */
div.dataTables_wrapper div.dataTables_filter input { border-radius: 8px; border: 1px solid #d1d5db; font-size: .82rem; padding: 4px 10px; }
div.dataTables_wrapper div.dataTables_length select { border-radius: 6px; }

/* ─── Select2 override ──────────────────────────────────────── */
.select2-container--default .select2-selection--single { height: 38px; border-radius: 8px; border-color: #d1d5db; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; font-size: .85rem; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content, .ssma-footer { margin-left: 0; }
}

/* ─── Print ──────────────────────────────────────────────────── */
@media print {
  .sidebar, .ssma-topbar, .ssma-footer, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; }
  .ssma-card { box-shadow: none !important; border: 1px solid #ccc !important; }
}
