/* tmailaja — animated gradient buttons (loaded after the main stylesheet) */

@keyframes tm-gradient-move {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

:root {
  --tm-g1: #f59e0b; /* amber  */
  --tm-g2: #f43f5e; /* rose   */
  --tm-g3: #f97316; /* orange */
  --tm-g4: #facc15; /* yellow */
}

/*
 * "Buttons" = real buttons, role=button controls and the header pill links.
 * Message rows in the inbox list are role=button too, but they are list cards,
 * so they keep their normal look.
 */
:is(button, [role="button"], a[data-slot="button"], header nav a[class*="rounded-full"]):not(li > [role="button"], [data-testid="inbox-message-item"]) {
  background-size: 250% 250%;
  animation: tm-gradient-move 5s ease-in-out infinite;
  transition: filter 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  background-image: linear-gradient(
    120deg,
    color-mix(in oklch, var(--tm-g1) 22%, transparent),
    color-mix(in oklch, var(--tm-g2) 18%, transparent),
    color-mix(in oklch, var(--tm-g3) 10%, transparent),
    color-mix(in oklch, var(--tm-g4) 20%, transparent)
  );
}

/* main buttons (Alamat baru, Salin, Masuk) and the active header pill: full vivid gradient */
:is(button, [role="button"], a)[class~="bg-primary"],
header nav a[class~="bg-foreground"] {
  background-image: linear-gradient(110deg, var(--tm-g1) 0%, var(--tm-g2) 25%, var(--tm-g4) 50%, var(--tm-g3) 75%, var(--tm-g1) 100%) !important;
  background-size: 200% 200% !important;
  color: #1a0f02 !important;
  box-shadow: 0 6px 22px -10px color-mix(in oklch, var(--tm-g2) 85%, transparent);
}

/* destructive (Hapus / delete) buttons: red gradient.
   Note: every button carries "aria-invalid:border-destructive", so match the real colour classes only. */
:is(button, [role="button"], a[data-slot="button"]):is([class~="text-destructive"], [class~="bg-destructive"], [class*="bg-destructive/"]) {
  background-image: linear-gradient(
    120deg,
    color-mix(in oklch, #ef4444 30%, transparent),
    color-mix(in oklch, #f43f5e 14%, transparent),
    color-mix(in oklch, #fb923c 24%, transparent),
    color-mix(in oklch, #ef4444 30%, transparent)
  ) !important;
}

/* interaction: brighter and faster on hover, small press */
:is(button:not(:disabled), [role="button"], a[data-slot="button"], header nav a[class*="rounded-full"]):not(li > [role="button"], [data-testid="inbox-message-item"]):hover {
  animation-duration: 2s;
  filter: brightness(1.12) saturate(1.2);
}
:is(button, [role="button"], a)[class~="bg-primary"]:not(:disabled):hover {
  box-shadow: 0 10px 28px -10px color-mix(in oklch, var(--tm-g2) 90%, transparent);
}
:is(button:not(:disabled), a[data-slot="button"]):active {
  transform: translateY(1px) scale(0.985);
}

/* disabled buttons keep their gradient but stop moving */
button:disabled,
button[aria-disabled="true"] {
  animation: none;
}

/* respect users who turn off motion: keep the gradient, stop the movement */
@media (prefers-reduced-motion: reduce) {
  button,
  [role="button"],
  a[data-slot="button"],
  header nav a {
    animation: none !important;
  }
}
