/* ==========================================================================
   ELISEE SCOUT — TIDE Download Button (@code_and_chill inspired)
   Animated circular progress ring, real-time percentage & outcome states
   ========================================================================== */

.tide-btn {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--blue, #1d6bff);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  padding: 0;
  box-shadow: 0 4px 14px rgba(29, 107, 255, 0.28);
  transition: transform 0.18s cubic-bezier(0.34, 1.2, 0.4, 1), box-shadow 0.25s ease, background 0.25s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.tide-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(29, 107, 255, 0.4);
}

.tide-btn:active {
  transform: translateY(0) scale(0.97);
}

.tide-btn[data-state="loading"] {
  background: var(--blue, #1d6bff);
  box-shadow: 0 6px 18px rgba(29, 107, 255, 0.35);
  cursor: wait;
}

.tide-btn[data-state="success"] {
  background: #10b981;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.4);
}

.tide-btn[data-state="fail"] {
  background: #e0304a;
  box-shadow: 0 6px 18px rgba(224, 48, 74, 0.4);
}

/* Anello Circolare SVG */
.tide-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  pointer-events: none;
}

.tide-ring circle {
  fill: none;
  stroke-width: 3.5;
  stroke-linecap: round;
}

.tide-ring .track {
  stroke: rgba(255, 255, 255, 0.22);
}

.tide-ring .arc {
  stroke: #ffffff;
  stroke-dasharray: 302;
  stroke-dashoffset: 302;
  transition: stroke-dashoffset 0.12s ease-out;
}

/* Icone SVG */
.tide-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.tide-icon svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  stroke: #ffffff;
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.34, 1.3, 0.4, 1);
  transform: scale(0.85);
}

.ic-arrow {
  opacity: 1 !important;
  transform: scale(1) !important;
}

.tide-btn[data-state="loading"] .ic-arrow {
  opacity: 0 !important;
  transform: scale(0.6) translateY(4px) !important;
}

.tide-btn[data-state="success"] .ic-arrow,
.tide-btn[data-state="fail"] .ic-arrow {
  opacity: 0 !important;
}

.tide-btn[data-state="success"] .ic-check {
  opacity: 1 !important;
  transform: scale(1.1) !important;
}

.tide-btn[data-state="fail"] .ic-x {
  opacity: 1 !important;
  transform: scale(1.1) !important;
}

/* Percentuale live numerica */
.ic-pct {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: inherit;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
  color: #ffffff;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  transform: scale(0.85);
  letter-spacing: -0.02em;
}

.tide-btn[data-state="loading"] .ic-pct {
  opacity: 1;
  transform: scale(1);
}

/* Wrapper con label per l'integrazione con il layout del sito */
.tide-download-wrap {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--panel, rgba(255, 255, 255, 0.05));
  border: 1px solid var(--line, rgba(255, 255, 255, 0.12));
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}

.tide-download-wrap:hover {
  border-color: var(--blue, #1d6bff);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.tide-download-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 2px;
  -webkit-user-select: none;
  user-select: none;
}

.tide-download-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #ffffff);
  line-height: 1.25;
}

.tide-download-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim, #94a3b8);
  line-height: 1.2;
}

/* Variante compatta per barre strumenti fitte */
.tide-btn--compact {
  width: 44px;
  height: 44px;
}
.tide-btn--compact .tide-icon svg {
  width: 18px;
  height: 18px;
}
.tide-btn--compact .ic-pct {
  font-size: 10px;
}
