/* ==== VARIABLES DE MARCA ==== */
:root{
  --brand-navy: #335D9B;
  --brand-navy-hover: #3F6FB0;
  --brand-teal: #0CB0AF;
  --table-head-bg: #F6FAFF;
}

/* ==== LAYOUT GENERAL ==== */
.estudios-container { background-color: #f8f9fa; min-height: 100vh; padding: 1rem 0; }

/* ==== ENCABEZADO PRINCIPAL ==== */
.estudios-header{
  background:none; border:none; border-radius:0; padding:1.25rem 1.5rem 0 1.5rem;
  box-shadow:none; margin-bottom: .75rem; border-bottom: 1.5px solid #e9ecef;
}

/* ==== BLOQUE DE ATENCIÓN ==== */
.atencion-block{
  border:none; border-top:3px solid var(--brand-navy); background:#fff; border-radius:7px;
  box-shadow:0 2px 8px rgba(51,93,155,0.06); margin-bottom:2rem; padding:0 0 1rem 0;
}

/* ==== HEADER DE ATENCIÓN ==== */
.page-header{ background:none; border-bottom:none; padding:.75rem 1rem; }
.page-header h3{ margin:0; color:var(--brand-navy); font-size:1.75rem; font-weight:600; }
.page-header p{ margin:.5rem 0 0 0; color:#64728a; font-size:1rem; }
.area-text{ color:#6c757d; font-size:.85rem; font-weight:normal; }

/* ==== TABLA ==== */
.table-container{ background:white; border:1px solid #dee2e6; border-radius:6px; overflow:hidden; }
.table{ background:transparent; border-radius:0 0 8px 8px; margin:0; font-size:1rem; }

/* Alineación */
.estudios-table th,
.estudios-table td { vertical-align: middle !important; text-align: left; }
.estudios-table th:last-child { text-align: center; }
.estudios-table td.td-acciones { text-align: right !important; vertical-align: middle !important; }

.table th,.table td{ background:#fff; border:none !important; }
.table thead th{
  background-color: var(--table-head-bg);
  border-bottom: 2px solid rgba(51,93,155,.18);
  font-weight:600; color:#2e3a55; padding:1rem; font-size:.95rem;
}
.table tbody td{ padding:1rem; font-size:1rem; }
.table tbody tr{ border-bottom:1px solid #dee2e6; }
.table tbody tr:hover{ background-color:#f6f9ff; }
.table td.text-end,.table th.text-end{ text-align:right !important; vertical-align:middle; }

/* Encabezado: solo desktop/tablet */
.thead-desktop{ display: table-header-group; }
@media (max-width: 575.98px){ .thead-desktop{ display: none; } }

/* ==== BOTONES BASE ==== */
.btn-action{
  padding:.6rem 1.2rem; font-size:.95rem; font-weight:500; border-radius:5px; border:1px solid;
  min-height:44px; text-decoration:none; display:inline-block; text-align:center;
  transition: all .2s ease; cursor:pointer;
}

/* Botón icon-only */
.btn-icon{
  padding:.6rem; min-width:44px; line-height:1;
  display:inline-flex; align-items:center; justify-content:center; box-sizing:border-box;
}

/* ==== BOTONES ESPECÍFICOS ==== */
/* Informe (azul) */
.btn-informe{ background:#fff; color:var(--brand-navy); border-color:var(--brand-navy); }
.btn-informe:hover{ background:var(--brand-navy); color:#fff; border-color:var(--brand-navy); }
.btn-informe:focus{ box-shadow: 0 0 0 .2rem rgba(51,93,155,.25); }

/* Imágenes (verde) */
.btn-imagen{ background:#fff; color:#198754; border-color:#198754; }
.btn-imagen:hover{ background:#198754; color:#fff; border-color:#198754; }
.btn-imagen:focus{ box-shadow: 0 0 0 .2rem rgba(25,135,84,.25); }

/* Enviar (WhatsApp) */
.btn-enviar{ background:#fff; color:#198754; border-color:#198754; }
.btn-enviar:hover{ background:#198754; color:#fff; border-color:#198754; }

/* Sin informar */
.btn-sin-informe{
  background:transparent; color:#6c757d; border:1px solid #cfd6dd; cursor:default;
}
.btn-sin-informe:hover{ background:transparent; color:#6c757d; border-color:#cfd6dd; }

/* PDF (rojo) */
.btn-pdf{
  background:#dc3545; color:#fff;
  border:1px solid #dc3545; border-radius:5px;
  font-weight:500; transition: all .2s ease;
}
.btn-pdf:hover{ background:#c82333; color:#fff; border-color:#c82333; }

/* Normalizar altura en modal footer */
.modal-footer .btn,
.modal-footer .btn-pdf {
  display: inline-flex; align-items: center; justify-content: center;
  padding:.6rem 1.2rem; font-size:.95rem; line-height:1.25; white-space: nowrap; min-height:44px;
}

/* Compactar en móviles */
@media (max-width: 480px){
  .modal-footer .btn, .modal-footer .btn-pdf { font-size:.9rem; padding:.5rem 1rem; }
}

/* Estado de carga */
.btn-label-full{ display:inline; }
.btn-label-short{ display:none; }
.btn-label-loading{ display:none; }
.btn-loading .btn-label-full, .btn-loading .btn-label-short{ display:none; }
.btn-loading .btn-label-loading{ display:inline; }

@media (max-width: 360.98px){
  .btn-label-full{ display:none; }
  .btn-label-short{ display:inline; }
}

/* ==== MODAL (minimal + formal) ==== */
.modal-content{
  background:#fff; border:1px solid #e7eaee; border-radius:12px;
  box-shadow:0 12px 28px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06);
  overflow:hidden;
}
.modal-header{
  background:#fff; border-bottom:1px solid #e7eaee; padding:1rem 1.25rem; position:relative;
}
.modal-header::before{
  content:""; position:absolute; inset:0 auto auto 0; height:3px; width:100%; background:var(--brand-navy);
}
.modal-title{ margin:0; font-size:1.15rem; font-weight:700; color:#1f2a44; letter-spacing:.1px; }
.btn-close{ filter: grayscale(1) invert(.45); opacity:.8; } .btn-close:hover{ opacity:1; }

.modal-body{
  padding:1.25rem;
  overflow-y:auto;
  font-size:1rem; line-height:1.55; background:#fff;
}

/* footer estándar (si lo usás en otros modales) */
.modal-footer{ background:#fafbfc; border-top:1px solid #e7eaee; padding:1rem 1.25rem; }

/* ==== MODAL DE MARCA ==== */
.modal-brand .modal-content{ border:0; border-radius:12px; overflow:hidden; box-shadow:0 16px 36px rgba(0,0,0,.18); }
.modal-brand .modal-header{ background:var(--brand-navy); color:#fff; border:0; padding:1rem 1.25rem; }
.modal-brand .modal-title{ color:#fff; }
.modal-brand .modal-title i{ color:#fff; opacity:.9; }
.modal-brand .btn-close{ filter: invert(1); opacity:.85; }
.modal-brand .btn-close:hover{ opacity:1; }
.modal-brand .modal-footer{ background:#f2f5f9; border-top:0; }

/* Informe y firma */
.report-content{
  background:white; border:1px solid #dee2e6; border-radius:6px; padding:1.5rem; margin-bottom:1rem;
  white-space:pre-wrap; font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
}
.signature-section{
  background:white; border:1px solid #dee2e6; border-radius:6px; text-align:center; padding:1.5rem; margin-top:1rem;
}
.signature-section h6{ color:#495057; font-size:.9rem; margin-bottom:1rem; font-weight:600; }
.signature-section img{ max-height:140px; border:1px solid #dee2e6; border-radius:4px; padding:.5rem; background:white; }

/* ==== FAB Volver ==== */
.fab-back{
  position:fixed; right:16px; bottom:16px; z-index:1080;
  border-radius:9999px; padding:.75rem 1rem; display:inline-flex; align-items:center; gap:.5rem;
  background:var(--brand-navy); border:1px solid var(--brand-navy);
  color:#fff; box-shadow:0 10px 20px rgba(0,0,0,.12), 0 3px 6px rgba(0,0,0,.08);
  text-decoration:none;
}
.fab-back:hover{ background:var(--brand-navy-hover); border-color:var(--brand-navy-hover); color:#fff; }
@supports(padding:max(0px)){ .fab-back{ right:max(16px, env(safe-area-inset-right)); bottom:max(16px, env(safe-area-inset-bottom)); } }
@media (max-width: 420px){ .fab-back{ padding:.65rem .8rem; } .fab-back .fab-text{ display:none; } }

/* ==== RESPONSIVE COMÚN ==== */
@media (max-width: 768px){
  .estudios-container{ padding:0; background:white; }
  .atencion-block{ border-radius:0; box-shadow:none; }
  .page-header{ margin:0; border-radius:0; border:none; padding:1rem; }
  .page-header h3{ font-size:1.4rem; }
  .table-container{ margin:0; border-radius:0; border-left:none; border-right:none; border-top:1px solid #dee2e6; }
  .table{ font-size:.95rem; }
  .table thead th, .table tbody td{ font-size:1rem; padding:.75rem 1rem; }

  .modal-dialog{ margin:0; max-width:100%; }
  .modal-content{ border-radius:0; border:none; box-shadow:none; }

  .modal-header{
    position:relative; border-radius:0; padding:1rem;
    border-left:none; border-bottom:1px solid #e7eaee; background:#fff;
  }
  .modal-header::before{ content:""; position:absolute; inset:0 auto auto 0; height:3px; width:100%; background:var(--brand-navy); }

  .modal-body{ padding:1rem; font-size:1rem; }
  .modal-footer{
    display:flex !important; flex-direction:row !important; gap:.5rem;
    padding:1rem; border-radius:0; background:#fafbfc; border-top:1px solid #e7eaee;
  }
  .modal-footer .btn{ flex:1; margin-bottom:0; }

  .signature-section img{ max-height:160px; }
}

/* ==== MÓVIL: fila apilada ==== */
@media (max-width: 575.98px){
  .tr-study{ display:block; }
  .tr-study > td{ display:block; width:100%; padding:.5rem 1rem; }
  .td-datos{ padding-bottom:.25rem; }
  .mob-datos{ margin-top:.35rem; color:#6c757d; }
  .mob-servicio{ margin-bottom:.1rem; }
  .mob-acc small{ color:#6c757d; }

  .td-acciones{ padding-top:.25rem !important; border-top:1px dashed #e3e8ee; }
  .mob-acciones .btn-row{ display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.25rem; }
}

/* ===================== */
/*  MODAL INFORME (PDF)  */
/* ===================== */

/* Más aire abajo para que no aparezca franja y no tape el FAB */
#modalInforme .modal-body{
  padding-bottom: 96px; /* << añadido */
}

/* FAB de PDF dentro del modal de Informe (más arriba) */
#modalInforme .pdf-fab{
  position: fixed;
  left: 16px;
  bottom: 32px;              /* << antes 16px */
  z-index: 1065;
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .6rem 1rem;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(0,0,0,.12);
}

/* Safe area iOS */
@supports(padding: max(0px)){
  #modalInforme .pdf-fab{
    left: max(16px, env(safe-area-inset-left));
    bottom: max(32px, env(safe-area-inset-bottom)); /* << antes 16px */
  }
}

/* En móviles chicos: un poco más arriba */
@media (max-width: 480px){
  #modalInforme .pdf-fab{
    left: 12px;
    bottom: 24px;            /* << antes 12px */
    padding: .65rem 1.1rem;
  }
}

/* Si tenés otro FAB a la derecha (Reportar), no se pisan */
.btn-reportar-fixed{ right: 16px; }

/* Esconder FABs cuando hay modal abierto */
body.modal-open .fab-back,
body.modal-open .btn-reportar-fixed{
  display: none !important;
}
