/* ─── Buy Me a Coffee ─────────────────────────────────────────────────────── */

/* ── Sidebar trigger button ─────────────────────────────────────────────── */

.coffee-btn {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.15), rgba(245, 158, 11, 0.08)) !important;
  border-color: rgba(251, 191, 36, 0.35) !important;
  color: #fbbf24 !important;
  position: relative;
  overflow: hidden;
}

.coffee-btn:hover {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(245, 158, 11, 0.14)) !important;
  border-color: rgba(251, 191, 36, 0.55) !important;
  color: #fcd34d !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(251, 191, 36, 0.2);
}

.coffee-btn span {
  color: inherit !important;
}

.coffee-btn svg {
  stroke: currentColor;
}

/* Subtle shimmer on the coffee button */
.coffee-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
      transparent 40%,
      rgba(251, 191, 36, 0.12) 45%,
      rgba(251, 191, 36, 0.18) 50%,
      rgba(251, 191, 36, 0.12) 55%,
      transparent 60%);
  animation: coffee-shimmer 3.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes coffee-shimmer {
  0% {
    transform: translateX(-120%);
  }

  60%,
  100% {
    transform: translateX(120%);
  }
}

body[data-theme="light"] .coffee-btn {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(251, 191, 36, 0.1)) !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
  color: #b45309 !important;
}

body[data-theme="light"] .coffee-btn:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(251, 191, 36, 0.16)) !important;
  border-color: rgba(245, 158, 11, 0.6) !important;
  color: #92400e !important;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.15);
}

/* ── Modal overlay ──────────────────────────────────────────────────────── */

#coffee-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#coffee-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

body[data-theme="light"] #coffee-modal-overlay {
  background: rgba(0, 0, 0, 0.35);
}

/* ── Modal card ─────────────────────────────────────────────────────────── */

#coffee-modal {
  width: min(440px, 92vw);
  max-height: 90vh;
  background: linear-gradient(165deg,
      rgba(30, 30, 36, 0.96),
      rgba(20, 20, 24, 0.98));
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 1px 0 rgba(255, 255, 255, 0.1) inset;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#coffee-modal-overlay.active #coffee-modal {
  transform: scale(1) translateY(0);
}

body[data-theme="light"] #coffee-modal {
  background: linear-gradient(165deg,
      rgba(255, 255, 255, 0.95),
      rgba(248, 248, 252, 0.98));
  border-color: rgba(0, 0, 0, 0.1);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(0, 0, 0, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

/* ── Modal header ───────────────────────────────────────────────────────── */

#coffee-modal-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] #coffee-modal-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}

.coffee-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.coffee-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow:
    0 4px 12px rgba(251, 191, 36, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}
.coffee-icon svg {
  width: 20px;
  height: 20px;
}

.coffee-header-text h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -0.01em;
}

.coffee-header-text p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 3px 0 0 0;
}

#coffee-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

#coffee-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

body[data-theme="light"] #coffee-modal-close {
  background: rgba(0, 0, 0, 0.05);
}

body[data-theme="light"] #coffee-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

/* ── Modal body ─────────────────────────────────────────────────────────── */

#coffee-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

/* ── Payment method tabs ────────────────────────────────────────────────── */

.coffee-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 20px;
}

body[data-theme="light"] .coffee-tabs {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.06);
}

.coffee-tab {
  flex: 1;
  padding: 10px 8px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.coffee-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .coffee-tab:hover {
  background: rgba(0, 0, 0, 0.04);
}

.coffee-tab .tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: box-shadow 0.2s;
}

.coffee-tab[data-tab="momo"] .tab-dot {
  background: #a50064;
}

.coffee-tab[data-tab="zalopay"] .tab-dot {
  background: #008fe5;
}

.coffee-tab[data-tab="bank"] .tab-dot {
  background: #22c55e;
}

/* Active tab states */
.coffee-tab.active {
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.coffee-tab[data-tab="momo"].active {
  background: linear-gradient(135deg, rgba(165, 0, 100, 0.2), rgba(165, 0, 100, 0.08));
  border: 1px solid rgba(165, 0, 100, 0.3);
}

.coffee-tab[data-tab="momo"].active .tab-dot {
  box-shadow: 0 0 8px rgba(165, 0, 100, 0.5);
}

.coffee-tab[data-tab="zalopay"].active {
  background: linear-gradient(135deg, rgba(0, 143, 229, 0.2), rgba(0, 143, 229, 0.08));
  border: 1px solid rgba(0, 143, 229, 0.3);
}

.coffee-tab[data-tab="zalopay"].active .tab-dot {
  box-shadow: 0 0 8px rgba(0, 143, 229, 0.5);
}

.coffee-tab[data-tab="bank"].active {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(34, 197, 94, 0.08));
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.coffee-tab[data-tab="bank"].active .tab-dot {
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
}

/* ── Tab content panels ─────────────────────────────────────────────────── */

.coffee-tab-panel {
  display: none;
  animation: coffeeFadeIn 0.3s ease;
}

.coffee-tab-panel.active {
  display: block;
}

@keyframes coffeeFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── QR code display card ───────────────────────────────────────────────── */

.coffee-qr-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

body[data-theme="light"] .coffee-qr-card {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.08);
}

.coffee-qr-wrapper {
  width: 200px;
  height: 200px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  padding: 8px;
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.coffee-qr-wrapper img {
  width: 100%;
  height: 100%;
  /* Using cover and transform to visually 'cut' the QR code out of the full image */
  object-fit: cover;
  transform: scale(1.35); /* Adjust this value if the box is too small/large */
  transform-origin: center center; /* Change to 'center top' or 'center bottom' if the QR isn't centered */
  border-radius: 6px;
}

/* Shimmer loading state */
.coffee-qr-wrapper.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
      transparent 40%,
      rgba(0, 0, 0, 0.04) 50%,
      transparent 60%);
  animation: qr-shimmer 1.5s ease-in-out infinite;
}

@keyframes qr-shimmer {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Colored glow behind QR for each payment method */
.coffee-tab-panel[data-panel="momo"] .coffee-qr-wrapper {
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.15),
    0 0 40px rgba(165, 0, 100, 0.12);
}

.coffee-tab-panel[data-panel="zalopay"] .coffee-qr-wrapper {
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.15),
    0 0 40px rgba(0, 143, 229, 0.12);
}

.coffee-tab-panel[data-panel="bank"] .coffee-qr-wrapper {
  box-shadow:
    0 4px 20px rgba(0, 0, 0, 0.15),
    0 0 40px rgba(34, 197, 94, 0.12);
}

.coffee-qr-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.coffee-qr-sublabel {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: -8px;
}

/* ── Amount selector ────────────────────────────────────────────────────── */

.coffee-amount-section {
  margin-top: 16px;
  margin-bottom: 8px;
}

.coffee-amount-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.coffee-amounts {
  display: flex;
  gap: 8px;
}

.coffee-amount-btn {
  flex: 1;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

.coffee-amount-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text);
}

.coffee-amount-btn.active {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.1));
  border-color: rgba(251, 191, 36, 0.4);
  color: #fbbf24;
  box-shadow: 0 2px 10px rgba(251, 191, 36, 0.15);
}

body[data-theme="light"] .coffee-amount-btn {
  border-color: rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.03);
}

body[data-theme="light"] .coffee-amount-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.15);
}

body[data-theme="light"] .coffee-amount-btn.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(251, 191, 36, 0.1));
  border-color: rgba(245, 158, 11, 0.5);
  color: #b45309;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.12);
}

/* Custom amount input */
.coffee-custom-amount {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.coffee-custom-amount input {
  flex: 1;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.coffee-custom-amount input::placeholder {
  color: var(--text-muted);
}

.coffee-custom-amount input:focus {
  border-color: rgba(251, 191, 36, 0.5);
}

body[data-theme="light"] .coffee-custom-amount input {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.03);
}

body[data-theme="light"] .coffee-custom-amount input:focus {
  border-color: rgba(245, 158, 11, 0.5);
}

.coffee-custom-amount span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Payment instructions ───────────────────────────────────────────────── */

.coffee-instructions {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .coffee-instructions {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}

.coffee-instructions ol {
  margin: 0;
  padding-left: 20px;
  list-style: decimal;
}

.coffee-instructions li {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
  padding: 1px 0;
}

.coffee-instructions li strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Deep link button (MoMo) ────────────────────────────────────────────── */

.coffee-deeplink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 11px 16px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.coffee-deeplink.momo-link {
  background: linear-gradient(135deg, #a50064, #d63384);
  color: #fff;
  box-shadow: 0 4px 16px rgba(165, 0, 100, 0.3);
}

.coffee-deeplink.momo-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(165, 0, 100, 0.4);
}

/* ── Modal footer ───────────────────────────────────────────────────────── */

#coffee-modal-footer {
  padding: 14px 24px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

body[data-theme="light"] #coffee-modal-footer {
  border-top-color: rgba(0, 0, 0, 0.06);
}

.coffee-thank-you {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.coffee-thank-you .heart {
  color: #ef4444;
  line-height: 0;
  animation: heartbeat 1.8s ease-in-out infinite;
}
.coffee-thank-you .heart svg {
  width: 14px;
  height: 14px;
}

@keyframes heartbeat {

  0%,
  100% {
    transform: scale(1);
  }

  15% {
    transform: scale(1.25);
  }

  30% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.15);
  }

  60% {
    transform: scale(1);
  }
}

/* ── Account info row ───────────────────────────────────────────────────── */

.coffee-account-info {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coffee-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

body[data-theme="light"] .coffee-account-row {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.06);
}

.coffee-account-row .label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.coffee-account-row .value {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  font-family: 'SFMono-Regular', 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

/* Copy button */
.coffee-copy-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-left: 8px;
}

.coffee-copy-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="light"] .coffee-copy-btn:hover {
  background: rgba(0, 0, 0, 0.06);
}

.coffee-copy-btn.copied {
  color: #22c55e;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  #coffee-modal {
    width: 96vw;
    border-radius: 16px;
  }

  #coffee-modal-header {
    padding: 16px 18px 14px;
  }

  #coffee-modal-body {
    padding: 16px 18px;
  }

  .coffee-tabs {
    flex-direction: column;
  }

  .coffee-amounts {
    flex-wrap: wrap;
  }

  .coffee-amount-btn {
    min-width: calc(50% - 4px);
  }

  .coffee-qr-wrapper {
    width: 180px;
    height: 180px;
  }
}