/*
========================================
  Fenix Custom Fields CF7 – Estilos
  Archivo para editar estilos de los campos personalizados.
  Secciones comentadas por campo para una edición sencilla.
========================================
*/

/*
========================================
  Teléfono (fenix_tel)
========================================
*/
/* Grupo contenedor del prefijo + input */
.fenix-tel-group {
  width: 100% !important;
}

/* Botón del selector de país/prefijo */
.fenix-tel-dropdown {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: #111827;
}

/* Etiqueta del prefijo mostrado (ej. +503) */
.fenix-tel-label {
  width: 63px !important;
  font-size: 14px;
  font-weight: 400;
}

/* Chevron del desplegable */
.fenix-tel-chevron {
  border-top-color: #334155;
}

/* Menú desplegable de países */
.fenix-tel-menu {
  width: 320px !important;
  max-height: 260px !important;
}

/* Campo de teléfono local */
.fenix-tel-field input[type="tel"] {
  width: 100% !important;
}

/*
========================================
  País (fenix_country)
========================================
*/
/* Select de país (muestra bandera como fondo del select) */
select.fenix-country {
  width: 100% !important;
  padding-left: 30px !important;
  background-repeat: no-repeat !important;
  background-position: 5px center !important;
  background-size: 1.2em !important;
}

/* Opciones del select; puedes ajustar tipografía/espaciado si lo deseas */
.fenix-country option {
  /* Ejemplo: font-size: 14px; */
}

/*
========================================
  Subida de archivos (fenix_upload / mfile)
========================================
*/
/* Contenedor redesign (Drag and Drop) */
.fenix-upload-stile {
  display: inline-block;
  text-align: center;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  margin-bottom: 16px;
  position: relative;
  padding: 20px;
  background: #fafafa;
  transition: border-color .2s, background .2s;
  width: 100% !important;
}
/* Contador superior derecho (ej. \"0 de 10\") */
.fenix-upload-count {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 12px;
  color: #64748b;
}

/* Encabezado dentro del dropzone */
.fenix-upload-header {
  width: 100%;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  font-weight: 600;
  font-size: 14px;
  color: #334155;
}
.fenix-upload-header-text {
  display: inline;
}

/* Acciones (botón y texto informativo) */
.fenix-upload-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}
.fenix-upload-or {
  margin: 8px 0;
  color: #64748b;
}
.fenix-upload-browse {
  margin: 0;
  display: inline-block;
  border: 1px solid #fafafa;
  border-radius: 8px;
  padding: 8px 12px;
  background: #fafafa;
  color: #111827;
}

/* Texto informativo de tipos y límite */
.fenix-upload-info {
  margin: 8px 0;
  color: #64748b;
}

.fenix-upload-descrip {
  margin: 0;
  color: #64748b;
  text-align: center;
}

/* Lista de archivos subidos */
.fenix-upload-list {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  gap: 12px !important;
  margin-top: 14px;
  width: 100%;
}

@media (max-width: 1024px) {
  .fenix-upload-list {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  }
}

@media (max-width: 640px) {
  .fenix-upload-list {
    grid-template-columns: 1fr !important;
  }
}

/* Ítem de archivo dentro de la lista */
.fenix-upload-list .item {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.fenix-upload-list .item .dnd-upload-image {
  flex: 0 0 72px;
}

.fenix-upload-list .item .dnd-upload-details,
.fenix-upload-list .item .name {
  min-width: 0;
}

.fenix-upload-list .item .name {
  display: block;
  padding-right: 28px;
  word-break: break-word;
  color: #000000;
}

.fenix-upload-list .item .name > span:first-child {
  display: inline;
  overflow-wrap: anywhere;
}

.fenix-upload-list .item .dnd-progress-bar {
  width: 100%;
}

@media (max-width: 480px) {
  .fenix-upload-list .item {
    flex-direction: column;
  }

  .fenix-upload-list .item .dnd-upload-image {
    flex-basis: auto;
  }

  .fenix-upload-list .item .name {
    padding-right: 0;
  }
}

/* Botón para eliminar un archivo */
.fenix-upload-list .item .remove-file {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

/*
========================================
  Image Checkbox (fenix_image_checkbox)
========================================
*/
.fenix-image-checkbox-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
  gap: 16px !important;
}

.fenix-image-checkbox-item {
  position: relative !important;
  cursor: pointer !important;
  display: block !important;
  margin: 0 !important;
}

/* Hide actual input */
.fenix-image-checkbox-item input[type='checkbox'],
.fenix-image-checkbox-item input[type='radio'] {
  position: absolute !important;
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
  pointer-events: none !important;
}

/* Visual container */
.fenix-image-checkbox-visual {
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  transition: all 0.2s ease;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  text-align: center !important;
  height: auto !important; /* Allow height to grow */
  min-height: 100% !important;
  overflow: visible !important; /* Ensure content isn't clipped */
}

.fenix-image-checkbox-visual img {
  width: 100% !important;
  height: auto !important;
 
  flex: 0 0 auto !important; /* Don't force stretch, let it sit naturally */
  border-radius: 8px !important;
  margin-bottom: 12px !important; /* More space between img and text */
  object-fit: contain !important;
  background: #fff;
  display: block !important;
}

.fenix-image-checkbox-label {
  font-size: 14px !important;
  color: #000000 !important; /* Force black for visibility */
  font-weight: 600 !important;
  line-height: 1.4 !important;
  display: block !important;
  margin-top: auto !important; /* Push to bottom if extra space exists */
  width: 100% !important;
  z-index: 10;
  position: relative;
  word-wrap: break-word !important; /* Prevent text overflow issues */
}

/* Hover state */
.fenix-image-checkbox-item:hover .fenix-image-checkbox-visual {
  border-color: #94a3b8;
  background: #f8fafc;
}

/* Selected state */
.fenix-image-checkbox-item input:checked + .fenix-image-checkbox-visual {
  border-color: #16a34a !important; /* Green */
  background: #f0fdf4 !important;
  box-shadow: 0 4px 6px -1px rgba(22, 163, 74, 0.1), 0 2px 4px -1px rgba(22, 163, 74, 0.06) !important;
}

/* Checkmark badge */
.fenix-image-checkbox-item input:checked + .fenix-image-checkbox-visual::after {
  content: '✓';
  position: absolute;
  top: 23px;
  right: 23px;
  background: #16a34a;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Column customization overrides */
.fenix-image-checkbox-grid.fenix-cols-1 { grid-template-columns: repeat(1, 1fr) !important; }
.fenix-image-checkbox-grid.fenix-cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.fenix-image-checkbox-grid.fenix-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.fenix-image-checkbox-grid.fenix-cols-4 { grid-template-columns: repeat(4, 1fr) !important; }
.fenix-image-checkbox-grid.fenix-cols-5 { grid-template-columns: repeat(5, 1fr) !important; }
.fenix-image-checkbox-grid.fenix-cols-6 { grid-template-columns: repeat(6, 1fr) !important; }

/* Responsive adjustments for custom columns */
@media (max-width: 600px) {
    /* On mobile/tablet, force 2 columns max for larger images */
    .fenix-image-checkbox-grid.fenix-cols-6,
    .fenix-image-checkbox-grid.fenix-cols-5,
    .fenix-image-checkbox-grid.fenix-cols-4,
    .fenix-image-checkbox-grid.fenix-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 480px) {
    /* On small screens, force 1 column for maximum visibility */
    .fenix-image-checkbox-grid.fenix-cols-6,
    .fenix-image-checkbox-grid.fenix-cols-5,
    .fenix-image-checkbox-grid.fenix-cols-4,
    .fenix-image-checkbox-grid.fenix-cols-3,
    .fenix-image-checkbox-grid.fenix-cols-2 {
        grid-template-columns: 1fr !important;
    }
}

.wpcf7-form .wpcf7-not-valid-tip {
  color: #dc2626 !important;
  font-size: 13px !important;
  margin-top: 4px !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  font-weight: 500 !important;
}
