/* ==================== CSS CUSTOMIZADO DO SISTEMA ==================== */

/* Progress Bar para Upload */
.progress { 
  height: 8px; 
  background:#eee; 
  border-radius:6px; 
  overflow:hidden; 
}
.progress-bar { 
  height:100%; 
  background:#28a745; 
  text-indent:-9999px; 
}

/* Modais - Z-index e Overlay */
.modal-backdrop { 
  z-index: 99990 !important; 
  background-color: rgba(0,0,0,0.5) !important; 
  position: fixed !important; 
  top:0; 
  left:0; 
  width:100%; 
  height:100%; 
}
.modal { 
  z-index: 100000 !important; 
  position: fixed !important; 
  top:0; 
  left:0; 
  width:100%; 
  height:100%; 
  background-color: transparent !important; 
}
.modal-dialog { 
  z-index: 100010 !important; 
  margin: 30px auto; 
  position: relative !important; 
}
.modal-content { 
  z-index: 100020 !important; 
  box-shadow: 0 5px 15px rgba(0,0,0,0.3); 
  border-radius: 10px; 
}
.fixed-navbar, .main-menu, .main-menu * { 
  z-index: 1000 !important; 
}
#wrapper, #wrapper * { 
  z-index: 900 !important; 
}
body.modal-open { 
  overflow: hidden !important; 
}

/* Tabelas Compactas */
.table tbody tr td, .table thead tr th { 
  padding: 4px 8px !important; 
  line-height: 1.2 !important; 
  vertical-align: middle !important; 
}

/* Botões de Ação nas Tabelas */
.table .btn-sm {
  padding: 3px 8px !important;
  font-size: 12.5px !important;
  line-height: 1.2 !important;
  border-radius: 8px !important;
  margin-right: 8px !important;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
}
.table .btn-sm:last-child { 
  margin-right: 0 !important; 
}
.table .btn-sm:hover { 
  box-shadow: 0 2px 5px rgba(0,0,0,.10); 
}
.table .btn-sm:active { 
  transform: translateY(1px); 
}
.table .btn-sm:focus { 
  outline: none; 
  box-shadow: 0 0 0 3px rgba(63,81,181,.18); 
}
.table .btn-sm .mdi,
.table .btn-sm .fa { 
  margin-right: 0; 
  font-size: 14px; 
  vertical-align: -1px; 
}
.table td.no-print { 
  white-space: nowrap; 
}

/* Box Title */
.box-title.d-flex { 
  display:flex !important; 
  justify-content:space-between !important; 
  align-items:center !important; 
  padding:10px 15px !important; 
  border-bottom:1px solid #eee; 
}
.box-title .title-text { 
  margin:0 !important; 
  font-size:18px !important; 
}

/* Forms */
#addFamiliaModal .form-group, 
#addCriancaModal .form-group { 
  margin-bottom: 12px; 
}
.phone-row .form-control { 
  height: 32px; 
}

/* Modal Responsivo */
@media (min-width: 768px) {
  .modal-dialog.modal-lg { 
    width: 80vw !important; 
    max-width: 80vw !important; 
  }
}
@media (max-width: 767.98px) {
  .modal-dialog.modal-lg { 
    width: 95vw !important; 
    max-width: 95vw !important; 
    margin: 10px auto !important; 
  }
}
.modal-body { 
  max-height: calc(100vh - 180px); 
  overflow-y: auto; 
}

/* Seções */
.section-split { 
  margin: 10px 0 15px; 
  border: 0; 
  border-top: 2px dashed #ddd; 
}
.section-title { 
  margin: 0 0 8px; 
  font-weight: 600; 
}

/* Layout Equal Row */
.equal-row { 
  display:flex; 
  flex-wrap:wrap; 
  align-items:stretch; 
}
.equal-row > [class*="col-"] { 
  display:flex; 
  flex-direction:column; 
}

/* Card de Foto do Aluno */
.aluno-foto-card { 
  display:flex; 
  flex-direction:column; 
  gap:8px; 
}
.aluno-foto-preview {
  position: relative;
  width: 100%;
  height: 280px;
  border: 1px solid #eee;
  border-radius: 8px;
  background: #f7f7f7;
  overflow: hidden;
}
.aluno-foto-preview img {
  position: absolute; 
  top:0; 
  left:0;
  width: 100%; 
  height: 100%;
  object-fit: cover;
  display: none;
}
.aluno-foto-placeholder {
  position: absolute; 
  inset: 0;
  display: flex; 
  align-items: center; 
  justify-content: center;
  color:#9aa0a6; 
  font-size:12px;
}

/* Inputs Estilo Material */
.form-control {
  border-radius: 12px;
  border: 1px solid #d0d7de;
  height: 42px;
  padding: 8px 12px;
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus {
  border-color: #3F51B5;
  box-shadow: 0 0 0 3px rgba(63,81,181,.15);
}

/* Botões Customizados */
.btn {
  border-radius: 10px;
  padding: 8px 14px;
  font-weight: 600;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:hover {
  filter: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.10);
}
.btn:active {
  transform: translateY(1px);
}
.btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(63,81,181,.18);
}
.btn .mdi, .btn .fa { 
  margin-right: 6px; 
}

/* Cores dos Botões */
.btn-orange {
  background:#ff6d00;
  border-color:#ff6d00;
  color:#fff;
}
.btn-orange:hover { 
  background:#e65f00; 
  border-color:#e65f00; 
}

.btn-success {
  background:#166534;
  border-color:#166534;
  color:#fff;
}
.btn-success:hover { 
  background:#14532d; 
  border-color:#14532d; 
}

.btn-warning {
  background:#f59e0b;
  border-color:#f59e0b;
  color:#fff;
}
.btn-warning:hover { 
  background:#d97706; 
  border-color:#d97706; 
}

.btn-danger {
  background:#dc2626;
  border-color:#dc2626;
  color:#fff;
}
.btn-danger:hover { 
  background:#b91c1c; 
  border-color:#b91c1c; 
}

.btn-default {
  background:#ffffff;
  color:#37474F;
  border-color:#d0d7de;
}
.btn-default:hover {
  background:#f7f7f7;
  border-color:#c5ccd3;
}

.btn-info {
  background:#0ea5e9;
  border-color:#0ea5e9;
  color:#fff;
}
.btn-info:hover { 
  background:#0284c7; 
  border-color:#0284c7; 
}

.btn-primary {
  background: #3F51B5;
  border-color: #3F51B5;
  color: #fff;
}
.btn-primary:hover {
  background: #303F9F;
  border-color: #303F9F;
}

/* Switch Android (Prioritária) */
.android-switch input[type=checkbox] { 
  display:none; 
}
.android-switch span {
  position:relative; 
  padding-left:48px; 
  line-height:28px; 
  cursor:pointer; 
  user-select:none;
}
.android-switch span:before {
  content:''; 
  position:absolute; 
  left:0; 
  top:2px; 
  width:44px; 
  height:24px;
  background:#c6c9cc; 
  border-radius:24px; 
  transition:.2s;
}
.android-switch span:after {
  content:''; 
  position:absolute; 
  left:2px; 
  top:4px; 
  width:20px; 
  height:20px;
  background:#fff; 
  border-radius:50%; 
  transition:.2s; 
  box-shadow:0 1px 2px rgba(0,0,0,.2);
}
.android-switch input:checked + span:before { 
  background:#3F51B5; 
}
.android-switch input:checked + span:after { 
  transform:translateX(20px); 
}

/* Filtros */
#filtroIdade { 
  max-width:70px; 
}

.filtro-placeholder {
  display:flex; 
  align-items:center; 
  justify-content:center; 
  min-height:180px;
}
.placeholder-card {
  background:#fafafa; 
  border:1px dashed #cfd8dc; 
  border-radius:12px;
  padding:24px 28px; 
  text-align:center; 
  max-width:680px; 
  box-shadow:0 1px 3px rgba(0,0,0,.06);
}
.placeholder-title { 
  font-weight:700; 
  font-size:18px; 
  margin-bottom:6px; 
  color:#37474F; 
}
.placeholder-text { 
  color:#607D8B; 
}

/* Paginação */
.pagination-wrap { 
  display:flex; 
  justify-content:center; 
}
.pagination-ul { 
  list-style:none; 
  display:flex; 
  gap:6px; 
  padding:0; 
  margin:0; 
}
.pagination-ul .page-item.disabled .page-link { 
  opacity:.4; 
  pointer-events:none; 
}
.pagination-ul .page-item.active .page-link {
  background:#3F51B5; 
  color:#fff; 
  border-color:#3F51B5;
}
.pagination-ul .page-link {
  display:inline-block; 
  min-width:36px; 
  text-align:center;
  padding:6px 10px; 
  border:1px solid #d0d7de; 
  border-radius:999px;
  text-decoration:none; 
  color:#37474F; 
  background:#fff;
  box-shadow:0 1px 2px rgba(0,0,0,.06);
}
.pagination-ul .page-link:hover { 
  filter:brightness(.96); 
}

/* Grid de Filtros */
#filtroCriancasWrap {
  padding: 12px 14px;
  background:#fafafa;
  border:1px solid #e5e7eb;
  border-radius:12px;
}

#filterCriancas.filters-grid {
  display:flex !important;
  flex-wrap:wrap;
  align-items:flex-end;
  gap:12px 16px;
}

#filterCriancas .filter-item {
  display:flex;
  flex-direction:column;
  min-width:180px;
}

#filterCriancas .filter-item .form-control {
  height:38px;
  border-radius:10px;
}

#filterCriancas #filtroIdade { 
  max-width:70px; 
}

#filterCriancas .filter-item:last-of-type {
  order:2;
  flex-basis:100%;
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:10px;
}
#filterCriancas .filter-item:last-of-type > label { 
  margin:0; 
}

#filterCriancas .filter-actions {
  order:3;
  margin-left:auto;
  display:flex;
  gap:10px;
}

#filterCriancas [name="periodo"] {
  min-width: 180px;
  max-width: 240px;
}

@media (max-width: 640px) {
  #filterCriancas .filter-item { 
    min-width:unset; 
    width:100%; 
  }
  #filterCriancas .filter-actions { 
    width:100%; 
    justify-content:flex-end; 
  }
}

table .no-print {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

/* ==================== IMPRESSÃO DE LISTA ==================== */
@media print {
  @page { 
    size: A4 portrait; 
    margin: 6mm 8mm; 
  }
  html, body { 
    background:#fff !important; 
    font: 8.5pt/1.15 Arial, Helvetica, sans-serif; 
    color:#000; 
  }

  .no-print,
  .fixed-navbar,
  .main-menu,
  .modal,
  .nav,
  .nav-tabs,
  .btn,
  .alert,
  .ml-auto,
  .pagination-wrap,
  .pagination-ul,
  footer, .footer, .site-footer, .page-footer, .copyright { 
    display:none !important; 
  }

  .box-title { 
    display:none !important; 
  }

  .print-only { 
    display:block !important; 
  }
  .print-header { 
    margin:0 0 4mm !important; 
  }
  .print-header h2 { 
    margin:0 0 2mm; 
    font-size: 11pt; 
    font-weight:700; 
  }
  .print-header div { 
    margin:0; 
    font-size: 8pt; 
  }

  #wrapper, .content, .main-content,
  .row, [class*="col-"],
  .box-content, .card, .card.white, .card-content,
  .table-responsive, .print-area {
    width:100% !important; 
    max-width:none !important;
    margin:0 !important; 
    padding:0 !important;
    box-shadow:none !important; 
    background:transparent !important; 
    border:0 !important;
  }
  .table-responsive { 
    overflow: visible !important; 
  }

  table, .table { 
    width:100% !important; 
    border-collapse:collapse !important; 
    table-layout:fixed; 
    margin:0 !important; 
  }
  .table thead { 
    display: table-header-group; 
  }
  .table tfoot { 
    display: table-footer-group; 
  }

  .table thead th {
    font-size: 9.5pt; 
    font-weight:700; 
    text-transform: uppercase;
    padding: 3px 4px; 
    border: 0.4pt solid #444;
    background:#f1f1f1 !important; 
    -webkit-print-color-adjust: exact; 
    print-color-adjust: exact;
  }
  .table tbody td {
    font-size: 8.5pt; 
    line-height:1.15;
    padding: 2px 4px; 
    border: 0.4pt solid #666; 
    vertical-align: middle !important;
    word-break: break-word; 
    hyphens: auto;
  }
  .table tbody tr:nth-child(odd) td {
    background:#fafafa !important; 
    -webkit-print-color-adjust: exact; 
    print-color-adjust: exact;
  }

  .print-table { 
    page-break-inside:auto; 
  }
  .print-table tr { 
    page-break-inside:avoid; 
    page-break-after:auto; 
  }

  .print-table th:nth-child(1) { width:24%; }
  .print-table th:nth-child(2) { width:20%; }
  .print-table th:nth-child(3) { width:12%; }
  .print-table th:nth-child(4) { width:8%; }
  .print-table th:nth-child(5) { width:8%; }
  .print-table th:nth-child(6) { width:14%; }
  .print-table th:nth-child(7) { width:14%; }

  a[href]:after { 
    content:""; 
  }
}

/* ==================== FICHA DE CADASTRO - VISUALIZAÇÃO NA TELA ==================== */
.ficha-wrapper {
  background: #fff;
  max-width: 210mm;
  margin: 0 auto;
  padding: 15mm 20mm;
  box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.ficha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 12px 0;
  border-bottom: 2px solid #000;
  margin-bottom: 15px;
}

.ficha-logo {
  max-width: 90px;
  max-height: 90px;
  object-fit: contain;
}

.ficha-title {
  text-align: center;
  flex: 1;
}

.ficha-title h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #000;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ficha-subtitle {
  margin: 3px 0 0;
  font-size: 11px;
  color: #333;
  font-weight: normal;
}

.ficha-container {
  padding: 0;
}

.ficha-foto-section {
  display: flex;
  justify-content: flex-end;
  margin: -70px 0 10px 0;
}

.ficha-foto {
  width: 2.5cm;
  height: 3.5cm;
  object-fit: cover;
  border: 1.5px solid #000;
  background: #fff;
}

.ficha-foto-placeholder {
  width: 2.5cm;
  height: 3.5cm;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #000;
  background: #fff;
  font-size: 9px;
  color: #999;
  text-align: center;
}

.ficha-section {
  margin-bottom: 12px;
  page-break-inside: avoid;
}

.ficha-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #000;
  background: #e8e8e8;
  padding: 3px 8px;
  margin: 0 0 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-left: 3px solid #000;
}

.ficha-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 4px 8px;
}

.ficha-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ficha-field-full {
  grid-column: 1 / -1;
}

.ficha-field label {
  font-size: 8px;
  font-weight: 600;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}

.ficha-field span {
  font-size: 10px;
  color: #000;
  padding: 2px 0;
  border-bottom: 1px solid #000;
  min-height: 18px;
  display: flex;
  align-items: center;
  background: transparent;
}

.ficha-badge-priority {
  background: #fff !important;
  color: #000 !important;
  font-weight: 700;
  padding: 3px 10px !important;
  border: 1.5px solid #000 !important;
  display: inline-flex !important;
  align-items: center;
  font-size: 10px;
}

.ficha-badge-benefit {
  display: inline-block;
  background: #fff;
  color: #000;
  padding: 3px 8px;
  border: 1px solid #000;
  font-size: 9px;
  font-weight: 600;
  margin-right: 6px;
  margin-bottom: 4px;
}

.ficha-beneficios {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  background: transparent;
  border: none;
}

.ficha-telefones {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  background: transparent;
  border: none;
}

.ficha-telefone-item {
  font-size: 10px;
  padding: 2px 0;
  border-bottom: 1px dotted #999;
}

.ficha-telefone-item:last-child {
  border-bottom: none;
}

.ficha-tel-obs {
  color: #666;
  font-size: 9px;
  font-style: italic;
}

.ficha-observacoes {
  padding: 6px;
  background: transparent;
  border: 1px solid #000;
  line-height: 1.4;
  font-size: 10px;
  color: #000;
  margin: 0;
  min-height: 40px;
}

.ficha-footer {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid #000;
  page-break-inside: avoid;
}

.ficha-footer-line {
  text-align: left;
  margin-bottom: 20px;
  font-size: 10px;
  color: #000;
}

.ficha-assinatura {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-top: 25px;
}

.ficha-assinatura-linha {
  text-align: center;
}

.ficha-assinatura-linha span {
  display: block;
  width: 100%;
  min-height: 55px;
  margin-bottom: 8px;
  border-bottom: 2px solid #000;
  padding-bottom: 0;
}

.ficha-assinatura-linha p {
  font-size: 11px;
  color: #000;
  margin: 0;
  font-weight: 600;
  text-transform: uppercase;
}

.ficha-actions {
  text-align: center;
  margin: 20px 0;
  padding: 15px;
  background: #f5f5f5;
  border-radius: 8px;
}

.ficha-actions .btn {
  margin: 0 5px;
}

/* ==================== IMPRESSÃO DA FICHA (OTIMIZADA PARA 1 PÁGINA) ==================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 10mm 12mm;
  }

  body {
    background: #fff;
    margin: 0;
    padding: 0;
  }
  
  .ficha-wrapper {
    padding: 0 !important;
    max-width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
  }
  
  .ficha-actions {
    display: none !important;
  }
  
  .ficha-header {
    padding: 0 0 6px 0 !important;
    margin-bottom: 8px !important;
    border-bottom: 1.5px solid #000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .ficha-logo {
    max-width: 90px !important;
    max-height: 90px !important;
  }
  
  .ficha-title h2 {
    font-size: 14px !important;
    margin: 0 !important;
  }
  
  .ficha-subtitle {
    font-size: 9px !important;
    margin: 2px 0 0 !important;
  }
  
  .ficha-foto-section {
    margin: -60px 0 4px 0 !important;
  }
  
  .ficha-foto,
  .ficha-foto-placeholder {
    width: 2cm !important;
    height: 2.8cm !important;
    border-width: 1px !important;
  }
  
  .ficha-foto-placeholder {
    font-size: 8px !important;
  }
  
  .ficha-foto-placeholder .mdi {
    font-size: 50px !important;
  }
  
  .ficha-section {
    margin-bottom: 5px !important;
    page-break-inside: avoid !important;
  }
  
  .ficha-section-title {
    font-size: 9.5px !important;
    padding: 2px 6px !important;
    margin: 0 0 3px 0 !important;
    background: #e8e8e8 !important;
    border-left: 2.5px solid #000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ficha-grid {
    gap: 2px 6px !important;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
  }
  
  .ficha-field {
    gap: 1px !important;
  }
  
  .ficha-field label {
    font-size: 7px !important;
    letter-spacing: 0.1px !important;
  }
  
  .ficha-field span {
    font-size: 9px !important;
    padding: 1px 0 !important;
    min-height: 15px !important;
    border-bottom: 0.8px solid #000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ficha-badge-priority {
    font-size: 8.5px !important;
    padding: 2px 8px !important;
    border: 1px solid #000 !important;
    background: #fff !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ficha-badge-benefit {
    font-size: 8px !important;
    padding: 2px 6px !important;
    margin-right: 3px !important;
    margin-bottom: 2px !important;
    border: none !important;
    background: transparent !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ficha-beneficios {
    gap: 2px !important;
    padding: 2px !important;
  }
  
  .ficha-telefones {
    gap: 1px !important;
  }
  
  .ficha-telefone-item {
    font-size: 9px !important;
    padding: 1px 0 !important;
    border-bottom: 0.5px dotted #999 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ficha-tel-obs {
    font-size: 8px !important;
  }
  
  .ficha-observacoes {
    padding: 4px !important;
    font-size: 9px !important;
    line-height: 1.3 !important;
    min-height: 25px !important;
    border: 0.8px solid #000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ficha-footer {
    margin-top: 12px !important;
    padding-top: 8px !important;
    border-top: 0.8px solid #000 !important;
    page-break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ficha-footer-line {
    margin-bottom: 20px !important;
    font-size: 9px !important;
  }
  
  .ficha-assinatura {
    gap: 40px !important;
    margin-top: 45px !important;
  }
  
  .ficha-assinatura-linha span {
    display: block !important;
    width: 100% !important;
    min-height: 70px !important;
    margin-bottom: 10px !important;
    border-bottom: 2px solid #000 !important;
    border-top: none !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .ficha-assinatura-linha p {
    font-size: 10px !important;
    font-weight: 600 !important;
  }
  
  .ficha-container {
    page-break-inside: avoid !important;
  }
  
  .ficha-section:last-of-type {
    page-break-after: avoid !important;
  }
}