/* ========== Gift Message Generator (Woo) ========== */

:root {
  --gmg-border: #e6e6e6;
  --gmg-border-soft: #eee;
  --gmg-text: #111;
  --gmg-muted: #666;
  --gmg-muted-2: #444;
  --gmg-bg: #fafafa;
  --gmg-primary: #111;
  --gmg-primary-contrast: #fff;
  --gmg-focus: #0a84ff; /* alto contraste para accesibilidad */
}

.gmg {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--gmg-border);
  border-radius: 10px;
  background: #fff;
  color: var(--gmg-text);
  font-size: 14px;
  line-height: 1.4;
}

.gmg__title {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
}

.gmg__subtitle {
  margin: 0 0 12px;
  color: var(--gmg-muted-2);
}

/* Controles */
.gmg__controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.gmg__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.gmg__field--grow {
  flex: 1;
  min-width: 240px;
}

.gmg__select,
.gmg__input {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: var(--gmg-text);
}

/* Botones */
.gmg__btn {
  padding: 8px 12px;
  border: 1px solid var(--gmg-primary);
  border-radius: 8px;
  background: var(--gmg-primary);
  color: var(--gmg-primary-contrast);
  cursor: pointer;
  transition: transform .06s ease-in-out, box-shadow .06s ease-in-out, background .12s ease-in-out;
  white-space: nowrap;
  font-size: 14px;
}

.gmg__btn--ghost {
  background: #f7f7f7;
  color: var(--gmg-text);
  border-color: #ddd;
}

.gmg__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}

.gmg__btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.gmg__btn:focus-visible {
  outline: 2px solid var(--gmg-focus);
  outline-offset: 2px;
}

/* Resultados */
.gmg__results { margin-top: 8px; }

.gmg__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gmg__item {
  padding: 10px;
  border: 1px solid var(--gmg-border-soft);
  border-radius: 8px;
  background: var(--gmg-bg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.gmg__text {
  flex: 1;
  min-width: 0;              /* evita estiramientos raros */
  word-break: break-word;    /* no cortar layout en frases largas */
}

/* Acciones finales (More + counter) */
.gmg__actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.gmg__counter {
  color: var(--gmg-muted);
  font-size: 12px;
}

.gmg__tip {
  margin-top: 10px;
  color: var(--gmg-muted);
  font-size: 12px;
}

/* Responsive fino */
@media (max-width: 480px) {
  .gmg__controls {
    flex-direction: column;
  }
  .gmg__field--grow {
    min-width: 100%;
  }
  .gmg__item {
    flex-direction: column;
    align-items: stretch;
  }
  .gmg__btn {
    width: 100%;
    text-align: center;
  }
}

/* Respeto a preferencias de movimiento reducidas */
@media (prefers-reduced-motion: reduce) {
  .gmg__btn {
    transition: none;
  }
}


/* Inline UI bajo el textarea */
.gmg-inline { margin-top:10px; }
.gmg__btn--icon {
  padding:8px 12px; 
  border:1px solid #111; 
  border-radius:8px;
  background:#111; 
  color:#fff; 
  cursor:pointer;
  font-size: 13px;
}
.gmg__panel { margin-top:12px; padding:12px; border:1px solid #e6e6e6; border-radius:10px; background:#fff; }



/* Flecha visible en el <select> */
.gmg__select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #666 50%),
    linear-gradient(135deg, #666 50%, transparent 50%),
    linear-gradient(to right, transparent, transparent);
  background-position:
    calc(100% - 16px) calc(50% - 4px),
    calc(100% - 10px) calc(50% - 4px),
    calc(100% - 2.2em) 0.5em;
  background-size: 6px 6px, 6px 6px, 1px 2.2em;
  background-repeat: no-repeat;
  padding-right: 2.4em;
}
.gmg__select:focus { outline: 2px solid #0a84ff; outline-offset: 2px; }

/* Inline contenedor */
.gmg-inline { margin-top:10px; }
.gmg__btn--icon { padding:8px 12px; border:1px solid #111; border-radius:8px; background:#111; color:#fff; cursor:pointer; }
.gmg__panel { margin-top:12px; padding:12px; border:1px solid #e6e6e6; border-radius:10px; background:#fff; }



/* === Igualar alto del botón y del select === */
:root { --gmg-control-h: 40px; }                /* elegí el alto que te guste */

.gmg__controls { align-items: center; }       /* estira todos los hijos a la misma altura */

.gmg__select,
.gmg__input {
  height: var(--gmg-control-h);
  padding: 0 12px;                              /* quita padding vertical para que cierre justo */
  box-sizing: border-box;
}

.gmg__btn {
  height: var(--gmg-control-h);
  padding: 0 16px;                              /* solo horizontal */
  display: inline-flex;
  align-items: center;                          /* centra el texto verticalmente */
  box-sizing: border-box;
  margin-top: 24px;
}



/* ========= OVERRIDE CLARO DE LA FLECHA (▼ real con SVG) =========
   Estas reglas pisan el hack anterior y muestran una flecha abajo clara. */
.gmg__select {
  /* quitamos las “marcas” previas */
  background-image: none !important;
  /* flecha SVG: chevron hacia abajo */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  background-size: 14px 14px !important;
  padding-right: 2.2em !important; /* deja espacio para la flecha */
}
