/* ==========================================================================
   word-math-and-donation.css
   1. Shared .word-math-format-picker across all 11 Word export surfaces
   2. Personal VietQR Community Support Modal & Banner
   ========================================================================== */

/* --- 1. Shared System-Wide Word Formula Format Picker --- */
.word-math-format-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: 9px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  max-width: 100%;
  flex-wrap: wrap;
}

.word-math-format-picker.is-compact {
  padding: 0.15rem;
  border-radius: 8px;
}

.word-math-format-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.36rem 0.68rem;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  line-height: 1.25;
  white-space: nowrap;
}

.word-math-format-picker.is-compact .word-math-format-btn {
  font-size: 0.73rem;
  padding: 0.28rem 0.55rem;
}

.word-math-format-btn.is-active {
  background: #ffffff;
  color: #0369a1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] .word-math-format-picker {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .word-math-format-btn {
  color: #cbd5e1;
}

[data-theme="dark"] .word-math-format-btn.is-active {
  background: #0284c7;
  color: #ffffff;
}

/* --- 1.1 Shared Math Font Size Picker --- */
.word-math-font-size-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  max-width: 100%;
}

.word-math-font-size-picker button[data-math-font-size] {
  appearance: none;
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.24rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  line-height: 1.2;
  white-space: nowrap;
}

.word-math-font-size-picker button[data-math-font-size].is-active {
  background: #ffffff;
  color: #0369a1;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] .word-math-font-size-picker {
  background: #1e293b;
  border-color: #334155;
}

[data-theme="dark"] .word-math-font-size-picker button[data-math-font-size] {
  color: #cbd5e1;
}

[data-theme="dark"] .word-math-font-size-picker button[data-math-font-size].is-active {
  background: #0284c7;
  color: #ffffff;
}

/* --- 2. Voluntary Personal VietQR Donation Banner & Modal --- */
[data-theme="dark"] .p2w-donation-modal-card {
  --p2w-bg: #0b1120;
  --p2w-surface: #111827;
  --p2w-surface-alt: #1e293b;
  --p2w-border: #334155;
  --p2w-text: #f8fafc;
  --p2w-muted: #94a3b8;
  --p2w-primary: #38bdf8;
  --p2w-primary-dark: #0284c7;
  --p2w-donate: #8b5cf6;
}

.p2w-donation-banner {
  margin-top: 1.25rem;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.09), rgba(2, 132, 199, 0.09));
  border: 1px solid var(--p2w-border, #e2e8f0);
  border-radius: 16px;
  padding: 1.2rem;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.8fr);
  gap: 1rem;
  align-items: center;
}

.p2w-donation-mini-qr {
  text-align: center;
}

.p2w-donation-mini-qr img {
  max-width: 165px;
  border-radius: 10px;
  background: #fff;
  padding: 0.35rem;
}

.p2w-donation-modal-card {
  max-width: 720px;
  width: calc(100% - 1.25rem);
  max-height: 92vh;
  overflow-y: auto;
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  color: var(--p2w-text, #0f172a) !important;
  border-radius: 16px !important;
  padding: 1.15rem;
  box-sizing: border-box;
  opacity: 1 !important;
}

[data-theme="dark"] .p2w-donation-modal-card {
  background: #111827 !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

.p2w-donation-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--p2w-border, #e2e8f0);
}

.p2w-donation-modal-title {
  font-size: 1.08rem;
  font-weight: 800;
  margin: 0;
}

.p2w-donation-modal-grid {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 1rem;
  margin-top: 0.9rem;
}

.p2w-qr-frame {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.5rem;
  text-align: center;
}

.p2w-qr-frame img {
  width: 100%;
  max-width: 210px;
  height: auto;
}

.p2w-amount-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.p2w-amount-chip {
  min-height: 38px;
  padding: 0.3rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--p2w-border, #cbd5e1);
  background: var(--p2w-surface-alt, #f1f5f9);
  color: var(--p2w-text, #0f172a);
  font-weight: 700;
  cursor: pointer;
}

.p2w-amount-chip.is-active {
  background: #6d28d9;
  color: #ffffff;
  border-color: #6d28d9;
}

.p2w-account-info-card {
  margin: 0.75rem 0;
  padding: 0.7rem;
  border-radius: 10px;
  background: var(--p2w-surface-alt, #f8fafc);
  border: 1px solid var(--p2w-border, #e2e8f0);
  font-size: 0.82rem;
}

.p2w-account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.28rem 0;
}

.p2w-copy-inline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.p2w-mobile-bank-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.p2w-mobile-bank-row select.p2w-input {
  flex: 1 1 180px;
  min-width: 0;
}

.p2w-mobile-bank-row button.p2w-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.p2w-donation-modal-card input.p2w-input,
.p2w-donation-modal-card select.p2w-input {
  width: 100% !important;
  box-sizing: border-box !important;
  min-height: 42px !important;
  padding: 0.45rem 0.75rem !important;
  border-radius: 10px !important;
  border: 1px solid var(--p2w-border, #e2e8f0) !important;
  background: var(--p2w-surface, #ffffff) !important;
  color: var(--p2w-text, #0f172a) !important;
  font-size: 0.85rem !important;
}

[data-theme="dark"] .p2w-donation-modal-card input.p2w-input,
[data-theme="dark"] .p2w-donation-modal-card select.p2w-input {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

.p2w-btn-donate-pill {
  min-height: 38px;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.08);
  color: #7c3aed;
  border: 1px solid rgba(124, 58, 237, 0.28);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.p2w-btn-donate-pill:hover {
  background: rgba(124, 58, 237, 0.16);
  border-color: #7c3aed;
  color: #6d28d9;
  transform: translateY(-1px);
}

[data-theme="dark"] .p2w-btn-donate-pill {
  background: rgba(139, 92, 246, 0.16);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.4);
}

[data-theme="dark"] .p2w-btn-donate-pill:hover {
  background: rgba(139, 92, 246, 0.26);
  color: #ffffff;
}

.p2w-legal-disclosure-box {
  margin-top: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  background: var(--p2w-surface-alt, #f1f5f9);
  font-size: 0.76rem;
  color: var(--p2w-muted, #475569);
  line-height: 1.45;
}

.p2w-admin-config-box {
  margin-top: 0.85rem;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px dashed #94a3b8;
}

.p2w-admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.6rem;
  margin-top: 0.65rem;
}

@media (max-width: 900px) {
  .p2w-donation-banner,
  .p2w-donation-modal-grid {
    grid-template-columns: 1fr;
  }
}
