/* Mismo estilo que herramientas (frontend/pages/servicios/public/css/base.css). */
body {
  font-family: Arial, sans-serif;
  margin: 20px;
  padding-bottom: 50px; /* espacio para el pie fijo */
  background: #fff;
  color: #222;
}
.hidden { display: none !important; }
.muted { color: #888; }

header.header { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.header-top { display: flex; justify-content: space-between; width: 90%; align-items: flex-start; gap: 12px; }
.logo { width: 15vw; min-width: 160px; max-width: 360px; height: auto; }
.header-title { margin-top: 10px; text-align: center; }
.header-title h2 { margin: 0; }
.header-title h3 { margin: 6px 0 0; min-height: 1em; color: #555; }

input {
  width: 100%; padding: 8px; margin: 6px 0; border: 1px solid #ccc; border-radius: 4px; max-width: 400px;
  font: inherit;
}

button {
  padding: 10px 15px; background-color: #1e88e5; color: white; border: none; border-radius: 4px;
  cursor: pointer; font-weight: 600; font-family: inherit; transition: background-color 0.15s ease;
}
button:hover { background-color: #1565c0; }
button:active { background-color: #0d47a1; }
button:disabled { background-color: #797878 !important; cursor: not-allowed; opacity: 0.6; }

.form { max-width: 820px; margin: 0 auto 18px; padding: 8px 12px; box-sizing: border-box; }
.form_row { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.form_row label { width: 170px; flex: 0 0 170px; font-weight: 600; }
.form_row input {
  flex: 1 1 200px; padding: 8px 10px; border: 1px solid #cfcfcf; border-radius: 6px; font-size: 15px;
  box-sizing: border-box; min-width: 0; max-width: none; margin: 0;
}
.form_row button { flex: 0 0 auto; width: 160px; }
.form_row input:disabled { background: #f5f5f5; }

#loader { text-align: center; margin: 20px; font-weight: bold; color: #555; }
.spinner {
  border: 6px solid #f3f3f3; border-top: 6px solid #4285f4; border-radius: 50%;
  width: 40px; height: 40px; animation: spin 1s linear infinite; margin: auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.section { width: 90%; margin: 0 auto; }
.section-title { text-align: center; margin: 22px 0 6px; }

.table-wrapper { width: 100%; max-height: 55vh; overflow-y: auto; }
table {
  width: 100%; table-layout: fixed; border-collapse: collapse; margin: 16px auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); font-size: 13px; word-wrap: break-word;
}
th, td { border: 1px solid #ccc; padding: 6px 8px; text-align: left; vertical-align: middle; }
th {
  background-color: #f29900; color: white; text-align: center; font-size: 13px; padding: 8px;
  line-height: 1.2; position: sticky; top: 0; z-index: 2;
}
td.center { text-align: center; }

/* Selectores (como el de contrato de herramientas) */
.selectors { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 24px; }
.selector-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 280px; max-width: 400px; }
.selector-field label { font-weight: 600; font-size: 14px; text-align: center; }
select {
  padding: 8px 10px; border: 1px solid #cfcfcf; border-radius: 6px; font-size: 15px; font-family: inherit;
  background: #fff; color: #222; box-sizing: border-box; width: 100%;
}
select:disabled { background-color: #f5f5f5; color: #888; }
.hint { text-align: center; color: #666; font-size: 13px; margin: 0 0 6px; }

/* Tarjeta flotante del lugar */
.pop {
  position: absolute; z-index: 500; width: 300px; max-width: calc(100vw - 24px); box-sizing: border-box;
  background: #fff; border-radius: 12px; padding: 16px 18px 14px; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  border-top: 4px solid #f29900;
}
.pop h3 { margin: 0 26px 10px 0; font-size: 16px; text-transform: uppercase; overflow-wrap: anywhere; }
.pop .close { top: 6px; right: 12px; }
.pop-event { padding: 10px 0; border-top: 1px solid #e5e5e5; display: flex; flex-direction: column; gap: 6px; }
.pop-event:first-child { border-top: 0; padding-top: 0; }
.pop-event .tipo { font-weight: bold; font-size: 13px; }
.pop-event .fecha { font-size: 14px; }
.pop-event button { align-self: stretch; }
.pop-event .chip { align-self: flex-start; }

/* Ruta: lugares unidos por flechas; en el teléfono, en vertical. */
.chain {
  list-style: none; margin: 10px 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center;
  align-items: stretch; gap: 10px 0;
}
.chain li { display: flex; align-items: center; }
.chain li + li::before { content: '➜'; color: #f29900; font-size: 24px; padding: 0 12px; }
.chain li.break + li::before { content: '⋯'; color: #888; }
.node {
  min-width: 160px; max-width: 240px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 12px 14px; border-radius: 8px; border: 2px solid #ccc; background: #fff; color: #222;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); font-weight: normal;
}
.node:hover { background: #f7f9fc; border-color: #1e88e5; }
.node:active { background: #e3f2fd; }
.node.selected { border-color: #1e88e5; background: #e3f2fd; }
.node .place { font-weight: bold; text-transform: uppercase; overflow-wrap: anywhere; text-align: center; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.chip { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 4px; white-space: nowrap; color: #fff; }
.chip.ok { background: #2e7d32; }
.chip.pending { background: #e65100; }

/* Mensajes */
body.modal-open { overflow: hidden; }
.modal {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5); z-index: 9999;
}
.modal.show { display: flex; }
.modal-content {
  background-color: #fff; padding: 20px 25px; border-radius: 12px; max-width: 90vw; max-height: 85vh;
  overflow-y: auto; box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25); position: relative; box-sizing: border-box;
}
.close { position: absolute; top: 10px; right: 15px; color: #888; font-size: 24px; font-weight: bold; cursor: pointer; }
.close:hover { color: #000; }
#modal_message .modal-content { width: 380px; text-align: center; padding: 18px 22px; }
#modal_text { margin: 0; font-size: 15px; line-height: 1.4; }

/* Visor de fotos */
.viewer-content {
  width: 92vw; height: 92vh; max-height: 92vh; max-width: 1400px; overflow: hidden;
  display: flex; flex-direction: column; gap: 10px; padding: 16px 20px;
}
#vTitle { margin: 0 30px 0 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-stage {
  position: relative; flex: 1; min-height: 0; overflow: hidden; display: grid; place-items: center;
  background: #f0f0f0; border: 1px solid #ccc; border-radius: 6px; touch-action: none;
}
.v-stage.zoomed { cursor: grab; }
.v-stage.dragging { cursor: grabbing; }
.v-stage img { max-width: 100%; max-height: 100%; user-select: none; will-change: transform; }
.v-msg { position: absolute; inset: auto 16px 16px; text-align: center; color: #555; font-weight: bold; }
.v-bar { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 30px; }
.v-group { display: flex; align-items: center; gap: 6px; }
.v-group button { min-width: 44px; height: 40px; padding: 0 12px; font-size: 16px; }
.v-count { min-width: 64px; text-align: center; font-weight: bold; font-variant-numeric: tabular-nums; }
#vZoom { width: 160px; margin: 0; padding: 0; border: 0; accent-color: #1e88e5; }

.sticky-footer {
  position: fixed; bottom: 0; left: 0; width: 100%; text-align: center; padding: 6px; box-sizing: border-box;
  display: flex; flex-direction: column; align-items: center; gap: 2px; background-color: #f0f0f0; z-index: 100;
}
.sticky-footer > span { font-weight: bold; }
.sticky-footer.static { position: static !important; margin-top: 20px; }

@media (max-width: 700px) {
  body { margin: 12px; }
  .header-top, .section { width: 100%; }
  .form_row label { width: 100%; flex-basis: 100%; }
  .form_row button { flex: 1 1 0; }
  .chain { flex-direction: column; flex-wrap: nowrap; gap: 0; }
  .chain li { flex-direction: column; align-items: stretch; }
  .chain li + li::before { content: '⬇'; text-align: center; padding: 4px 0; }
  .node { max-width: none; width: 100%; box-sizing: border-box; }
  table { font-size: 12px; }
  .viewer-content { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; border-radius: 0; padding: 12px; }
}
