/* =========================================================
   FENAUTO DOC - THEME PROFESIONAL
   Blanco / Gris / Negro + Rojo
   ========================================================= */

:root{
  --bg: #f3f4f6;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 10px 30px rgba(0,0,0,.08);

  --red: #c40000;
  --red-dark: #990000;

  --black: #0f172a;
}

/* ===================== BASE ===================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 25px;
}

h1, h2, h3 {
  margin: 0 0 10px 0;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

/* ===================== TOPBAR ===================== */

.topbar {
  background: var(--black);
  padding: 16px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
  border-bottom: 4px solid var(--red);
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar .title b {
  display: block;
  font-size: 15px;
}

.topbar .title span {
  font-size: 13px;
  opacity: .7;
}

.topbar .actions {
  display: flex;
  gap: 10px;
}

/* ===================== CARDS ===================== */

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ===================== BOTONES ===================== */

.btn {
  display: inline-block;
  background: var(--red);
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--red);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: all .2s ease;
  cursor: pointer;
}

.btn:hover {
  background: var(--red-dark);
  border-color: var(--red-dark);
}

.btn.secondary {
  background: #ffffff;
  color: var(--text);
  border: 1px solid #d1d5db;
}

.btn.secondary:hover {
  background: #f3f4f6;
}

.btn.danger {
  background: #000;
  border-color: #000;
}

.btn.danger:hover {
  background: #111;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
}

/* ===================== FORMULARIOS ===================== */

.form .field {
  margin-bottom: 14px;
}

.form label {
  display: block;
  font-size: 13px;
  margin-bottom: 6px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 14px;
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(196,0,0,0.15);
}

.row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.row .field {
  flex: 1;
  min-width: 220px;
}

/* ===================== TABLAS ===================== */

.table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  table-layout: fixed;
}

.table thead th {
  background: #f5f5f5;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.table tbody th {
  background: #f8f8f8;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  width: 420px;
  border-bottom: 1px solid var(--border);
  /* Evita el efecto "texto en vertical" en móvil */
  word-break: normal;
  overflow-wrap: break-word;
}

.table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid #f1f1f1;
  /* Evita el efecto "texto en vertical" en móvil */
  word-break: normal;
  overflow-wrap: break-word;
}

.table tbody tr:hover td,
.table tbody tr:hover th {
  background: #f1f5f9;
}


/* ===================== TABLA RESPONSIVE WRAPPER ===================== */

.table-responsive{
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Evita que el scroll corte bordes redondeados */
.table-responsive .table{
  min-width: 700px;
}

/* PF (buscar.php): deja que la tabla se adapte y no "aplastes" columnas */
.table.pf-results{
  table-layout: auto;
}

/* ===================== PF (buscar.php) ===================== */

/* En PF interesa que el navegador calcule anchos y no aplaste columnas */
.table.pf-results{
  table-layout: auto;
}

.table.pf-results th,
.table.pf-results td{
  word-break: normal;
  overflow-wrap: break-word;
}


/* ===================== ALERTAS ===================== */

.alert {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 14px;
}

.alert.error {
  background: #fff1f1;
  color: #7a0000;
  border: 1px solid rgba(196,0,0,0.3);
}

.alert.success {
  background: #f0fff5;
  color: #065f46;
  border: 1px solid rgba(16,185,129,0.3);
}

.alert.info {
  background: #f5f7ff;
  color: #1e3a8a;
  border: 1px solid rgba(59,130,246,0.3);
}

/* ===================== LINKS ===================== */

a {
  color: var(--red);
}

a:hover {
  color: var(--red-dark);
}

/* ===================== RESPONSIVE ===================== */



/* ===================== LOGO TOPBAR ===================== */

.topbar-right{
  display:flex;
  align-items:center;
  gap: 14px;
}

.topbar-logo{
  display:flex;
  align-items:center;
}

.topbar-logo img{
  max-width: 140px;
  object-fit: contain;
  display:block;
}

/* ===================== RESPONSIVE (logo) ===================== */
@media (max-width: 768px){
  .topbar-right{
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .topbar-logo{
    align-self: flex-end;
  }

  .topbar-logo img{
    height: 35px;
    max-width: 160px;
  }
}


@media (max-width: 768px) {

  .row {
    flex-direction: column;
  }

  .table tbody th {
    width: 180px;
  }

  .container {
    padding: 15px;
  }


  .topbar{
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar .actions{
    width: 100%;
    flex-wrap: wrap;
  }

  .topbar .actions .btn{
    flex: 1;
    text-align: center;
  }

  .card{
    padding: 16px;
  }

  /* tablas: usa scroll horizontal en móvil */
  .table-responsive .table{
    min-width: 600px;
  }

}
/* ===================== Acciones ===================== */

.td-actions {
  white-space: normal;
}

.td-actions .btn {
  margin: 2px 6px 2px 0;
}

/* ===================== Responsive móvil ===================== */

@media (max-width: 768px) {

  .td-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 110px;
  }

  .pf-results th,
  .pf-results td {
    font-size: 13px;
    padding: 10px 8px;
  }

  /* En móvil: prioriza scroll horizontal en lugar de "aplastar" columnas */
  .table-responsive .table.pf-results{
    min-width: 900px;
  }

  /* Ocultamos columnas menos importantes en móvil */
  .pf-results th:nth-child(4),
  .pf-results td:nth-child(4),
  .pf-results th:nth-child(5),
  .pf-results td:nth-child(5),
  .pf-results th:nth-child(6),
  .pf-results td:nth-child(6) {
    display: none;
  }

  /* ===================== DETALLE PF (detalle.php) ===================== */
  /* En móvil, cada fila se apila: etiqueta arriba, valor abajo (sin scroll lateral) */
  .pf-detail .table.pf-detail-table,
  .pf-detail .table.pf-detail-table tbody,
  .pf-detail .table.pf-detail-table tr,
  .pf-detail .table.pf-detail-table th,
  .pf-detail .table.pf-detail-table td {
    display: block;
    width: 100%;
  }

  .pf-detail .table.pf-detail-table colgroup {
    display: none;
  }

  .pf-detail .table.pf-detail-table tbody tr {
    border-bottom: 1px solid var(--border);
  }

  .pf-detail .table.pf-detail-table tbody th {
    width: 100%;
    border-bottom: none;
  }

  .pf-detail .table.pf-detail-table tbody td {
    padding-top: 6px;
    border-bottom: none;
  }
}

/* =========================================================
   OVERRIDE NUCLEAR — PERMISOS
   Checkbox delante + texto pegado (anula reglas globales)
   ========================================================= */

.permisos-box { text-align:left !important; }

/* Cada opción: nada de space-between, nada de width 100% que lo separe */
.permisos-box .perm-item{
  display:flex !important;
  flex-direction:row !important;
  align-items:center !important;
  justify-content:flex-start !important;
  gap:10px !important;

  width:auto !important;
  max-width:100% !important;

  /* anula cualquier cosa rara */
  float:none !important;
}

/* Checkbox: evitar floats y márgenes auto */
.permisos-box .perm-item > input[type="checkbox"]{
  order:0 !important;
  float:none !important;
  position:static !important;
  margin:0 !important;
  width:auto !important;
  flex:0 0 auto !important;
  align-self:center !important;
}

/* Texto: impedir que se vaya a la derecha por margin-left:auto / flex:1 */
.permisos-box .perm-item > span{
  order:1 !important;
  margin:0 !important;
  margin-left:0 !important;
  margin-right:0 !important;

  width:auto !important;
  max-width:100% !important;

  flex:0 0 auto !important;
  text-align:left !important;

  float:none !important;
}
/* =========================================
   TABLA LISTA INSCRITOS (solo esta página)
   ========================================= */

.inscritos-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 15px;
}

.inscritos-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1600px; /* ancho amplio */
  font-size: 14px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.inscritos-table th {
  background: #f5f5f5;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  border-bottom: 1px solid #ddd;
  white-space: nowrap;
}

.inscritos-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f0f0f0;
  white-space: nowrap;        /* 🔥 evita texto vertical */
}

.inscritos-table tr:hover td {
  background: #f9fafb;
}

