/**
 * components.css — Botones, galería de imágenes, modales, FABs, tooltip.
 *
 * ORIGEN v1: especificos.css (la mayoría) + styleNew.css (tooltip, help-icon).
 * PROBLEMAS corregidos:
 *   - .tooltip y .help-icon duplicados en ambos ficheros → una sola definición aquí
 *   - #3e5f8a → var(--color-brand)
 *   - DodgerBlue/teal/tomato → mantenidos como semántica de acción (info/success/danger)
 */

@import './tokens.css';

/* ── Botones de acción principal ───────────────────────────────────────────── */
.btn {
  background-color: var(--color-danger);
  border: none; color: var(--color-white);
  padding: 6px 8px; font-size: var(--font-size-md);
  cursor: pointer; width: 133px;
}
.btn:hover { background-color: var(--color-gainsboro); }

.btn1 {
  background-color: var(--color-info);
  border: none; color: var(--color-white);
  padding: 3px 4px; font-size: var(--font-size-md);
  cursor: pointer; width: 100%;
}
.btn1:hover { background-color: var(--color-gainsboro); }

.btn2 {
  margin: var(--space-md) 1px; display: block;
  border: none; background-color: var(--color-info); color: var(--color-white);
  padding: 6px; font-size: var(--font-size-md); cursor: pointer; width: 100%; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn2Plus {
  margin: var(--space-md) 1px; display: block;
  border: none; background-color: teal; color: var(--color-white);
  padding: 6px; font-size: var(--font-size-md); cursor: pointer; width: 150px; text-align: center;
}
.btn4Plus {
  margin: var(--space-md) 1px; display: block;
  border: none; background-color: teal; color: var(--color-white);
  padding: 6px; font-size: var(--font-size-md); cursor: pointer; width: 450px; text-align: center;
}
.btn2:hover, .btn2Plus:hover, .btn4Plus:hover { background-color: var(--color-gainsboro); }

.btn3 { background-color: tomato; border: none; color: var(--color-white); padding: 3px 4px; font-size: var(--font-size-md); cursor: pointer; width: 100%; }
.btn3:hover { background-color: var(--color-gainsboro); }

.btn4 { border: none; background-color: var(--color-warning); color: var(--color-white); padding: 6px 8px; font-size: var(--font-size-md); cursor: pointer; width: 133px; }
.btn4:hover { background-color: var(--color-gainsboro); }

/* ── Botones de PDF ─────────────────────────────────────────────────────────── */
.buttonpdf  { border: none; color: var(--color-white); padding: 15px 32px; text-align: center; text-decoration: none; display: inline-block; font-size: var(--font-size-md); margin: 4px 2px; cursor: pointer; }
.buttonpdf1 { background-color: var(--color-success); }
.buttonpdf2 { background-color: var(--color-brand); }
.buttonpdf3 { background-color: #d4e069; }

/* ── Botón genérico (legacy .button) ───────────────────────────────────────── */
.button {
  border: none; outline: 0; display: inline-block;
  padding: 10px; color: var(--color-white);
  background-color: var(--color-gainsboro);
  text-align: center; cursor: pointer; width: 100%;
}
.button:hover { background-color: #999; }

.button1 { background-color: var(--color-brand); display: block; width: 100%; }

/* ── Contenedores de botones ────────────────────────────────────────────────── */
.containerBtn2 {
  padding: 4px; background: var(--color-white); width: 100%;
  display: flex; gap: 10px; justify-content: center; align-items: center;
}
.button-container { width: 100%; justify-content: center; display: flex; }

/* ── Galería de imágenes (selección de ejercicios) ──────────────────────────── */
div.gallery {
  margin: 3px; padding: 1px;
  border: 1px solid var(--color-border);
  float: left; width: 102px; height: 186px;
  text-align: center; font-size: var(--font-size-xs);
  color: var(--color-text); background-color: var(--color-border);
}
div.gallery:hover { border: 1px solid var(--color-border); }

.imgsel {
  margin: 1px; width: 98px; height: 120px;
  object-fit: scale-down; cursor: pointer;
  text-align: center; font-size: var(--font-size-xs); padding: 1px;
}
.imgsel3 {
  margin: 1px; width: 98px; height: 120px;
  object-fit: scale-down; cursor: pointer;
  color: var(--color-border); font-size: var(--font-size-xs); padding: 1px;
  background-color: var(--color-border);
}
div.desc { padding: 10px; text-align: center; }

/* ── Imágenes de ejercicio (estado seleccionado / no seleccionado) ─────────── */
.img-rounded-border-si {
  margin: 0; border: 1px solid var(--color-danger); border-radius: var(--radius-full);
  object-fit: scale-down; width: var(--img-thumb-w); height: var(--img-thumb-h);
}
.img-rounded-border-no {
  margin: 0; object-fit: scale-down;
  width: var(--img-thumb-w); height: var(--img-thumb-h);
}
.img-margin {
  margin: 0; object-fit: scale-down; width: 100%; height: auto; display: block;
  background-color: var(--color-white);
}
.img-square-border {
  border: 1px solid var(--color-white); margin: 0;
  object-fit: scale-down; width: var(--img-grid-w); height: var(--img-grid-h);
}

/* ── Grid de imágenes ──────────────────────────────────────────────────────── */
.containerGrid {
  display: block; width: 100%; height: 77vh;
  padding: 0; background-color: var(--color-border); overflow-y: auto;
}
.containerGrid4 {
  display: block; width: 100%; height: 77vh;
  padding: 0; background-color: var(--color-border); overflow-y: auto;
  justify-content: center; align-items: center;
}
.grid-container, .video-container4, .grid-container4 {
  background-color: var(--color-border);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--img-grid-w), 1fr));
  grid-auto-rows: minmax(var(--img-grid-h), auto);
  gap: 4px; padding: 1px; width: 100%;
}
.grid-container img, .grid-container4 img {
  border: 1px solid var(--color-white); margin: 0;
  object-fit: scale-down; width: var(--img-grid-w); height: var(--img-grid-h);
}

/* ── Botones de imagen en grid (acción) ─────────────────────────────────────── */
.buttonx {
  background-color: var(--color-gainsboro); width: 100%; height: 90px;
  border: none; color: teal; cursor: pointer; text-align: center;
  font-size: var(--font-size-sm); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; padding: 2px;
}
.buttonx:hover { overflow: visible; }

.buttonh {
  background-color: var(--color-gainsboro); width: 100%; height: 15px;
  border: none; color: var(--color-white); cursor: pointer; text-align: center;
  font-size: var(--font-size-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.buttonh:hover { overflow: visible; }

.buttonf {
  background-color: var(--color-gainsboro); float: left; width: 100%; height: 25px;
  border: none; color: var(--color-white); cursor: pointer; text-align: center;
  font-size: var(--font-size-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 10px 0;
}
.buttonf:hover { overflow: visible; }

/* ── Modal ──────────────────────────────────────────────────────────────────── */
#id04 .modal-content { text-align: left; }

.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background-color: rgba(0,0,0,.5); justify-content: center; align-items: center;
  z-index: var(--z-modal);
}
.modal-content {
  background-color: var(--color-border); width: 95%; height: 95%; padding: 20px;
  border-radius: 5px; box-shadow: var(--shadow-sm); text-align: center; overflow-y: auto;
  z-index: var(--z-modal);
}
.modal-buttons   { margin-top: 20px; }
.modal-button    { padding: 10px 20px; margin: 0 10px; border: none; border-radius: 5px; cursor: pointer; }
.cancel-button   { color: var(--color-white); }
.confirm-button  { color: var(--color-white); }
.select-button   { color: var(--color-white); }

/* ── FAB: botón flotante + tooltip ──────────────────────────────────────────── */
/* DEDUPLICADO: era idéntico en styleNew.css y especificos.css */
.help-icon, .plus-icon {
  position: fixed; bottom: 70px;
  width: 40px; height: 40px; border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--font-size-2xl); cursor: pointer;
  background: rgba(0,123,255,.8); color: var(--color-white);
  box-shadow: var(--shadow-fab); z-index: var(--z-modal);
}
.help-icon { right: 20px; }
.plus-icon { left: 20px; }

/* DEDUPLICADO: era idéntico en styleNew.css y especificos.css */
.tooltip {
  position: fixed; bottom: 120px; right: 20px;
  background: rgba(0,123,255,.9); color: var(--color-white);
  padding: 10px; border-radius: 5px; font-size: 14px;
  display: none; max-width: 250px; box-shadow: var(--shadow-fab); z-index: var(--z-modal);
}
.tooltip p   { display: flex; align-items: center; gap: var(--space-md); margin: 10px 0; }
.tooltip i   { margin-right: var(--space-md); }
.icon        { width: 24px; text-align: center; }

/* ── QR oculto (solo para generación PDF) ──────────────────────────────────── */
#qr_code { display: none; width: 40px; height: 40px; }

/* ── Selector de segmentos ──────────────────────────────────────────────────── */
.selectto2 {
  width: 90px; border: none; background-color: #f1f1f1; color: var(--color-text);
  cursor: pointer; height: 26px; outline: none; font-size: 14px;
}

/* ── Dropdown del sidenav ───────────────────────────────────────────────────── */
.dropdown-btn {
  padding: 8px 8px 8px 22px; text-decoration: none; font-size: var(--font-size-md);
  display: block; border: none; background: none; width: 100%;
  text-align: left; cursor: pointer; outline: none; color: var(--color-text);
}
.dropdown-btn:hover  { color: var(--color-white); }
.active              { background-color: grey; color: var(--color-white); }
.dropdown-container  { display: none; background-color: var(--color-border); padding-left: 8px; }
.fa-caret-down       { float: right; padding-right: 8px; }

/* ── Misceláneo de layout de contenido ─────────────────────────────────────── */
.content {
  border: none; background-color: var(--color-gainsboro);
  padding: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
}
.content > div {
  display: flex; flex-direction: column; width: 100%; flex: 1; overflow: hidden;
}
.solid { border-top: 3px solid ghostwhite; }
.imgTitulo { padding-left: 10px; }

.item  { white-space: nowrap; display: inline; float: left; }
.item2 { padding: 10px 0 10px 10px; white-space: nowrap; display: inline; float: left; width: 150px; background-color: var(--color-white); }
.item4 { padding-left: 2px; white-space: nowrap; display: inline; float: left; width: 100%; height: 100%; }

.frame { display: flex; justify-content: left; align-items: center; width: 100%; }

#div1, #div2 {
  float: left; margin: 0; padding: 2px; width: 100%;
  border: 1px solid whitesmoke; background-color: var(--color-white); display: block;
}
#div1.feedme, #div2.feedme { background: var(--color-white); }

.htit-element {
  font-size: 18px; text-align: center; margin: 0;
  border: 1px solid rgb(207,204,204); background-color: whitesmoke;
  color: var(--color-text); height: 22px; width: 100%;
}

.dragging { border: 1px dashed rgb(14,78,228); cursor: move; }

/* ── Botón de selección en panel M9 (qaction-button) ───────────────────────── */
buttonl {
  border: 1px solid var(--color-gainsboro);
  background-color: tomato;
  color: var(--color-white);
  padding: 2px 4px;
  width: 96px;
  height: 36px;
  text-align: center;
  display: inline-block;
  font-size: 20px;
  font-weight: bold;
  margin: 1px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

/* ── Galería de ejercicios por subcategoría (formfield/column) ─────────────── */
formfield {
  display: block;
  float: left;
  width: 100%;
  overflow: hidden;
}

legend {
  display: block;
  background-color: crimson;
  text-align: center;
  color: var(--color-white);
  width: 100%;
  height: 25px;
  padding: 5px 0;
  box-sizing: border-box;
  clear: both;
}

/* ── Columnas de ejercicios (especificos/personalizados): tamaño fijo, auto-fill ── */
.column {
  float: left;
  width: 110px;
  height: 175px;
  display: block;
  padding: 1px;
  border: 1px solid whitesmoke;
  background-color: var(--color-gainsboro);
  overflow: hidden;
}

.w3manual {
  font-size: var(--font-size-sm);
  text-align: center;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 108px;
}

/* ── Galería de PDFs (genericos): grid responsivo, portrait ────────────────── */
formfield:has(.content) {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  float: none;
}

.column:has(.content) {
  float: none;
  width: auto;
  height: auto;
  aspect-ratio: 3 / 4;
  box-sizing: border-box;
  min-width: 0;
  overflow: hidden;
}

@media (max-width: 600px) {
  formfield:has(.content) { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 601px) and (max-width: 900px) {
  formfield:has(.content) { grid-template-columns: repeat(3, 1fr); }
}
