/* ============================================================
   SISCON Apoio Web - Estilo Visual Apoio Soluções
   Identidade: https://apoiosolucoes.com.br/
   ============================================================ */

:root {
  --apoio-primary: #2f5aae;
  --apoio-primary-hover: #234790;
  --apoio-primary-light: #eef3fc;
  --apoio-dark: #0f1d3a;
  --apoio-dark-sidebar: #122143;
  --apoio-dark-sidebar-hover: #1b2e59;
  --apoio-dark-sidebar-active: #2f5aae;
  --apoio-bg: #f4f6fa;
  --apoio-card-bg: #ffffff;
  --apoio-text: #212529;
  --apoio-text-muted: #64748b;
  --apoio-border: #e2e8f0;

  /* Status */
  --status-aberto-bg: #dbeafe;
  --status-aberto-text: #1d4ed8;
  --status-andamento-bg: #fef3c7;
  --status-andamento-text: #b45309;
  --status-finalizada-bg: #dcfce7;
  --status-finalizada-text: #15803d;
  --status-cancelada-bg: #fee2e2;
  --status-cancelada-text: #b91c1c;
}

body {
  background-color: var(--apoio-bg);
  color: var(--apoio-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.92rem;
  letter-spacing: -0.01em;
  margin: 0;
  padding: 0;
}

/* ==================== TELA DE LOGIN ==================== */
#app-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, #1e3c78 0%, #0e1a38 70%, #091328 100%);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

#app-login::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(47, 90, 174, 0.25) 0%, rgba(47, 90, 174, 0) 70%);
  top: -100px;
  right: -100px;
  border-radius: 50%;
  pointer-events: none;
}

#app-login .card {
  width: 100%;
  max-width: 400px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
}

.login-brand-container {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand-logo {
  max-width: 220px;
  height: auto;
  margin-bottom: 12px;
}

.login-title-badge {
  display: inline-block;
  background: var(--apoio-primary-light);
  color: var(--apoio-primary);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ==================== APLICAÇÃO PRINCIPAL ==================== */
#app-main {
  display: none;
}

/* Sidebar */
.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--apoio-dark-sidebar);
  color: #c9d5e8;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.sidebar .brand-wrapper {
  padding: 16px 16px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.sidebar-logo-card img {
  max-width: 100%;
  height: auto;
  max-height: 38px;
}

.sidebar .brand-subtitle {
  font-size: 0.7rem;
  color: #93a5c2;
  text-align: center;
  margin-top: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar .nav {
  padding: 12px 8px;
}

.sidebar .nav-section {
  padding: 14px 12px 6px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6e84a8;
  font-weight: 700;
}

.sidebar .nav-link {
  color: #cad5e6;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  margin-bottom: 3px;
  transition: all 0.2s ease;
}

.sidebar .nav-link i {
  font-size: 1.05rem;
  width: 24px;
  text-align: center;
  margin-right: 10px;
  color: #8da4c4;
  transition: color 0.2s ease;
}

.sidebar .nav-link:hover {
  background: var(--apoio-dark-sidebar-hover);
  color: #ffffff;
}

.sidebar .nav-link:hover i {
  color: #ffffff;
}

.sidebar .nav-link.active {
  background: var(--apoio-dark-sidebar-active);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(47, 90, 174, 0.35);
}

.sidebar .nav-link.active i {
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

#sidebar-user {
  font-size: 0.82rem;
  color: #b0c2db;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Topbar */
.topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--apoio-border);
  padding: 12px 28px;
  margin-left: 240px;
  position: sticky;
  top: 0;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

#topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--apoio-dark);
  letter-spacing: -0.02em;
}

/* Main Content */
.main-content {
  margin-left: 240px;
  padding: 24px 28px 40px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== CARDS & DASHBOARD ==================== */
.card {
  border-radius: 12px;
  border: 1px solid var(--apoio-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card-stat {
  border-radius: 14px;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.card-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.card-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
}

.card-stat-total::before { background: var(--apoio-primary); }
.card-stat-aberto::before { background: #0284c7; }
.card-stat-andamento::before { background: #d97706; }
.card-stat-finalizada::before { background: #10b981; }

.stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--apoio-text-muted);
  margin-top: 4px;
}

/* ==================== TABELAS ==================== */
.table-container {
  border-radius: 12px;
  overflow: hidden;
}

.table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 14px;
  border-bottom: 1px solid var(--apoio-border);
}

.table td {
  padding: 12px 14px;
  vertical-align: middle;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
}

.table-hover tbody tr:hover td {
  background-color: #f8faff;
}

/* ==================== BADGES DE STATUS ==================== */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
}

.status-Em-Aberto {
  background-color: var(--status-aberto-bg);
  color: var(--status-aberto-text);
  border-color: rgba(29, 78, 216, 0.2);
}

.status-Em-Andamento {
  background-color: var(--status-andamento-bg);
  color: var(--status-andamento-text);
  border-color: rgba(180, 83, 9, 0.2);
}

.status-Finalizada {
  background-color: var(--status-finalizada-bg);
  color: var(--status-finalizada-text);
  border-color: rgba(21, 128, 61, 0.2);
}

.status-Cancelada {
  background-color: var(--status-cancelada-bg);
  color: var(--status-cancelada-text);
  border-color: rgba(185, 28, 28, 0.2);
}

/* ==================== BOTÕES E FORMULÁRIOS ==================== */
.btn-primary {
  background-color: var(--apoio-primary);
  border-color: var(--apoio-primary);
  font-weight: 500;
  border-radius: 8px;
  padding: 7px 16px;
  transition: all 0.2s ease;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: var(--apoio-primary-hover);
  border-color: var(--apoio-primary-hover);
  box-shadow: 0 4px 10px rgba(47, 90, 174, 0.25);
}

.btn-outline-primary {
  color: var(--apoio-primary);
  border-color: var(--apoio-primary);
  border-radius: 8px;
}

.btn-outline-primary:hover {
  background-color: var(--apoio-primary);
  border-color: var(--apoio-primary);
  color: #ffffff;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: 6px;
}

.form-control, .form-select {
  border: 1px solid var(--apoio-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: var(--apoio-primary);
  box-shadow: 0 0 0 3px rgba(47, 90, 174, 0.15);
}

.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
}

.adm-selector {
  max-width: 260px;
}

.form-check-input {
  cursor: pointer;
}

.form-check-input:checked {
  background-color: var(--apoio-primary);
  border-color: var(--apoio-primary);
}

.form-check-label {
  font-size: 0.88rem;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

input[type="date"].form-control {
  min-width: 130px;
}

/* ==================== MODAIS ==================== */
.modal-content {
  border-radius: 14px;
  border: none;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
  border-bottom: 1px solid var(--apoio-border);
  padding: 16px 20px;
}

.modal-title {
  font-weight: 700;
  color: var(--apoio-dark);
  font-size: 1.05rem;
}

.modal-footer {
  border-top: 1px solid var(--apoio-border);
  padding: 12px 20px;
}

/* ==================== KANBAN BOARD ==================== */
.kanban-board {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 24px;
}

.kanban-column {
  flex: 1 0 270px;
  max-width: 320px;
  background: #edf1f7;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 160px);
  border: 1px solid #e1e7f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.kanban-col-header {
  padding: 12px 14px;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

.col-header-Em-Aberto    { border-top: 3px solid #0284c7; }
.col-header-Em-Andamento { border-top: 3px solid #d97706; }
.col-header-Finalizada   { border-top: 3px solid #10b981; }
.col-header-Cancelada    { border-top: 3px solid #ef4444; }

.kanban-col-count {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  background: #eef2f8;
  color: #475569;
}

.kanban-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex-grow: 1;
  min-height: 140px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.kanban-cards.drag-over {
  background: #dbe7fa;
  border: 2px dashed var(--apoio-primary);
  border-radius: 8px;
}

.kanban-card {
  background: #ffffff;
  border-radius: 10px;
  padding: 12px 14px;
  border: 1px solid var(--apoio-border);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  position: relative;
  user-select: none;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
  border-color: #cbd5e1;
}

.kanban-card.dragging {
  opacity: 0.45;
  cursor: grabbing;
}

.kanban-card .card-os-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--apoio-primary);
}

.kanban-card .card-os-cliente {
  font-weight: 600;
  color: #0f172a;
  font-size: 0.92rem;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card .card-os-adm {
  font-size: 0.76rem;
  color: #64748b;
  margin-bottom: 6px;
}

.kanban-card .card-os-desc {
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kanban-card .card-os-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #64748b;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

/* Responsividade */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    min-height: auto;
  }
  .topbar, .main-content {
    margin-left: 0;
  }
}
