/* Gemini AI — quiet companion (namespaced) */

/* Production static (narsoz-web) hides FAB + drawer */
html.gemini-off .gemini-fab,
html.gemini-off .gemini-backdrop,
html.gemini-off .gemini-drawer {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.gemini-fab {
  --life: 0;
  position: fixed;
  z-index: 900;
  right: max(16px, calc(50% - 224px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(160deg, #1a6b7a 0%, var(--dark-blue, #155e6d) 55%, #0f4a56 100%);
  box-shadow:
    0 4px 18px rgba(21, 94, 109, 0.28),
    0 1px 4px rgba(0, 174, 200, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  transition:
    transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.25s ease,
    opacity 0.25s ease;
  opacity: 0.92;
}

/* Soft rising fill behind the icon */
.gemini-fab-life {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--life) * 72%);
  background: linear-gradient(
    180deg,
    rgba(127, 232, 245, 0.28) 0%,
    rgba(0, 174, 200, 0.22) 100%
  );
  pointer-events: none;
  z-index: 0;
  transition: height 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

/* One clear icon per growth stage */
.gemini-fab-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.86);
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.gemini-fab-stage svg {
  width: 34px;
  height: 34px;
  overflow: visible;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.22));
}

.gemini-fab[data-growth="seed"] .gemini-fab-stage--seed,
.gemini-fab[data-growth="sprout"] .gemini-fab-stage--sprout,
.gemini-fab[data-growth="bud"] .gemini-fab-stage--bud,
.gemini-fab[data-growth="flower"] .gemini-fab-stage--flower,
.gemini-fab[data-growth="tree"] .gemini-fab-stage--tree {
  opacity: 1;
  transform: scale(1);
}

.gemini-fab.is-growing .gemini-fab-stage--sprout,
.gemini-fab.is-bloomed .gemini-fab-stage--bud,
.gemini-fab.is-bloomed .gemini-fab-stage--flower,
.gemini-fab.is-bloomed .gemini-fab-stage--tree {
  animation: gemini-life-breathe 3.2s ease-in-out infinite;
}

.gemini-fab.is-bloomed {
  box-shadow:
    0 4px 20px rgba(21, 94, 109, 0.32),
    0 0 16px rgba(127, 232, 245, 0.28),
    0 1px 4px rgba(0, 174, 200, 0.22);
}

.gemini-fab:hover,
.gemini-fab:focus-visible {
  transform: scale(1.04);
  opacity: 1;
  box-shadow:
    0 6px 22px rgba(21, 94, 109, 0.35),
    0 2px 8px rgba(0, 174, 200, 0.28);
  outline: none;
}

.gemini-fab:active {
  transform: scale(0.96);
}

.gemini-fab.is-pop {
  animation: gemini-fab-pop 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.gemini-fab.is-revealing {
  pointer-events: none;
}

/* +N / streak fills the whole FAB and holds longer so it can be read */
.gemini-fab.has-float .gemini-fab-stage {
  opacity: 0 !important;
  transform: scale(0.7);
  transition:
    opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

.gemini-fab-float {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  margin: 0;
  padding: 5px 6px;
  border-radius: 50%;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  text-align: center;
  color: #fff;
  background:
    radial-gradient(
      circle at 50% 36%,
      #ffe9a8 0%,
      #00aec8 52%,
      #155e6d 100%
    );
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.35);
  pointer-events: none;
  animation: gemini-fab-fill-burst 2.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.gemini-fab-float-num {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  text-shadow: 0 1px 3px rgba(15, 60, 70, 0.4);
}

.gemini-fab-float-num--stage {
  font-size: 13px;
  letter-spacing: -0.01em;
  line-height: 1.05;
  max-width: 100%;
  padding: 0 2px;
}

.gemini-fab-float-caption {
  display: block;
  max-width: 44px;
  margin-top: 1px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  opacity: 0.95;
  text-shadow: 0 1px 2px rgba(15, 60, 70, 0.35);
}

.gemini-fab-float--plus .gemini-fab-float-num {
  font-size: 28px;
}

.gemini-fab-float--plus {
  background:
    radial-gradient(
      circle at 50% 34%,
      #fff0bf 0%,
      #00aec8 48%,
      #0f4a56 100%
    );
}

.gemini-fab-float--streak {
  background:
    radial-gradient(
      circle at 50% 34%,
      #e4f8ec 0%,
      #5f9e78 50%,
      #2f5a45 100%
    );
}

.gemini-fab-float--streak .gemini-fab-float-num {
  font-size: 24px;
}

.gemini-fab-float--grown {
  background:
    radial-gradient(
      circle at 50% 34%,
      #dff5f9 0%,
      #00aec8 52%,
      #155e6d 100%
    );
}

@keyframes gemini-fab-fill-burst {
  0% {
    opacity: 0;
    transform: scale(0.45);
  }
  8% {
    opacity: 1;
    transform: scale(1.1);
  }
  14% {
    opacity: 1;
    transform: scale(1);
  }
  78% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.03);
  }
}

@keyframes gemini-fab-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes gemini-life-surface {
  0%, 100% { transform: translateY(-50%) scaleX(1); }
  50% { transform: translateY(-50%) scaleX(1.08); }
}

@keyframes gemini-life-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.gemini-backdrop {
  position: fixed;
  inset: 0;
  z-index: 910;
  background: rgba(21, 94, 109, 0.38);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.gemini-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.gemini-drawer {
  position: fixed;
  z-index: 920;
  left: 50%;
  bottom: 0;
  width: min(100%, 480px);
  max-height: 52dvh;
  display: flex;
  flex-direction: column;
  background: #f7fafb;
  color: #1a1a1a;
  border-radius: 20px 20px 0 0;
  box-shadow:
    0 -10px 36px rgba(21, 94, 109, 0.16),
    0 -2px 8px rgba(0, 0, 0, 0.04);
  transform: translate(-50%, 100%);
  transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.gemini-drawer.is-open {
  transform: translate(-50%, 0);
}

.gemini-drawer-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(21, 94, 109, 0.08);
  flex-shrink: 0;
}

.gemini-drawer-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(21, 94, 109, 0.06);
  color: var(--dark-blue, #155e6d);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.gemini-drawer-close:hover,
.gemini-drawer-close:focus-visible {
  background: rgba(21, 94, 109, 0.12);
  outline: none;
}

.gemini-drawer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--dark-blue, #155e6d);
  flex: 1;
  min-width: 0;
}

.gemini-drawer-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-flag, #00aec8);
  box-shadow: 0 0 6px rgba(0, 174, 200, 0.45);
  animation: gemini-pulse 2.4s ease-in-out infinite;
}

@keyframes gemini-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.gemini-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.gemini-chapter-label {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(21, 94, 109, 0.55);
}

.gemini-chapter-text {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.4;
  color: #2a2a2a;
}

.gemini-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.gemini-chip {
  border: 1px solid rgba(21, 94, 109, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--dark-blue, #155e6d);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.gemini-chip:hover:not(:disabled),
.gemini-chip:focus-visible:not(:disabled) {
  background: rgba(0, 174, 200, 0.1);
  border-color: rgba(0, 174, 200, 0.45);
  outline: none;
}

.gemini-chip:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gemini-response {
  min-height: 80px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid rgba(21, 94, 109, 0.1);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a1a;
  white-space: pre-wrap;
  word-break: break-word;
}

.gemini-response.is-empty {
  color: rgba(21, 94, 109, 0.45);
  font-style: italic;
}

.gemini-skeleton {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gemini-skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(21, 94, 109, 0.06) 0%,
    rgba(0, 174, 200, 0.12) 50%,
    rgba(21, 94, 109, 0.06) 100%
  );
  background-size: 200% 100%;
  animation: gemini-skeleton 1.2s ease-in-out infinite;
}

.gemini-skeleton-line:nth-child(2) { width: 92%; animation-delay: 0.1s; }
.gemini-skeleton-line:nth-child(3) { width: 78%; animation-delay: 0.2s; }
.gemini-skeleton-line:nth-child(4) { width: 85%; animation-delay: 0.3s; }

@keyframes gemini-skeleton {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.gemini-drawer-footer {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid rgba(21, 94, 109, 0.08);
  flex-shrink: 0;
  background: #fff;
}

.gemini-input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(21, 94, 109, 0.14);
  border-radius: 12px;
  background: #f7fafb;
  color: #1a1a1a;
  font: inherit;
  /* 16px minimum — iOS Safari zooms the page for inputs under 16px */
  font-size: 16px;
  padding: 10px 12px;
}

.gemini-input::placeholder {
  color: rgba(21, 94, 109, 0.4);
}

.gemini-input:focus {
  outline: none;
  border-color: rgba(0, 174, 200, 0.55);
  box-shadow: 0 0 0 2px rgba(0, 174, 200, 0.15);
}

.gemini-send {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(160deg, #1a6b7a, var(--dark-blue, #155e6d));
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gemini-send:hover:not(:disabled),
.gemini-send:focus-visible:not(:disabled) {
  filter: brightness(1.06);
  outline: none;
}

.gemini-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.gemini-send svg {
  width: 20px;
  height: 20px;
}

body.gemini-drawer-open {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .gemini-fab,
  .gemini-drawer-status-dot,
  .gemini-skeleton-line,
  .gemini-fab.is-growing .gemini-fab-stage--sprout,
  .gemini-fab.is-bloomed .gemini-fab-stage--bud,
  .gemini-fab.is-bloomed .gemini-fab-stage--flower,
  .gemini-fab.is-bloomed .gemini-fab-stage--tree,
  .gemini-fab.is-pop,
  .gemini-fab-float {
    animation: none !important;
  }

  .gemini-fab-life,
  .gemini-fab-stage {
    transition: none !important;
  }

  .gemini-fab-float {
    opacity: 1;
    transform: none;
    inset: 0;
  }

  .gemini-drawer,
  .gemini-backdrop {
    transition-duration: 0.01ms !important;
  }
}
