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

.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: 28px;
  height: 28px;
  overflow: visible;
}

.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;
}

.gemini-fab-float {
  position: absolute;
  left: 50%;
  top: -6px;
  z-index: 6;
  transform: translate(-50%, 0);
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  color: #3a342c;
  background: linear-gradient(180deg, #fff8ef 0%, #ffe9c2 100%);
  box-shadow:
    0 4px 14px rgba(60, 50, 40, 0.16),
    0 0 0 1px rgba(220, 180, 120, 0.35);
  pointer-events: none;
  animation: gemini-fab-float-up 1.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.gemini-fab-float--streak {
  background: linear-gradient(180deg, #eefaf4 0%, #d8f0e4 100%);
  color: #2f5a45;
  box-shadow:
    0 4px 14px rgba(47, 90, 69, 0.16),
    0 0 0 1px rgba(95, 158, 120, 0.35);
}

.gemini-fab-float--plus {
  background: linear-gradient(180deg, #fff8ef 0%, #ffe2a8 100%);
  color: #6a4e18;
}

.gemini-fab-float--grown {
  background: linear-gradient(180deg, #f3fafc 0%, #d9f1f5 100%);
  color: #155e6d;
  box-shadow:
    0 4px 14px rgba(21, 94, 109, 0.14),
    0 0 0 1px rgba(0, 174, 200, 0.28);
}

@keyframes gemini-fab-float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px) scale(0.86);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -2px) scale(1.04);
  }
  70% {
    opacity: 1;
    transform: translate(-50%, -14px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -26px) scale(0.96);
  }
}

@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-read {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: 1px solid rgba(21, 94, 109, 0.14);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--dark-blue, #155e6d);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

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

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

.gemini-drawer-read[aria-pressed="true"] {
  background: rgba(0, 174, 200, 0.16);
  border-color: rgba(0, 174, 200, 0.5);
}

.gemini-read-icon {
  width: 18px;
  height: 18px;
}

.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;
  font-size: 14px;
  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: translate(-50%, -12px);
  }

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