/* ==========================================================================
   commercial-modals-dark-and-micro.css
   Dark-Mode Contrast Closure (WCAG AA/AAA) for Subscription, VietQR & Zalo Modals
   + 320px Micro-Viewport Student Portal Overflow & FAB Collision Guard
   ========================================================================== */

/* 1. VietQR Bank Search Input Icon Spacing (All Themes) */
#modal-subscription-payment .bank-search-input-box > span:first-child {
  left: 0.75rem !important;
  z-index: 2;
  pointer-events: none;
}

#modal-subscription-payment #input-search-bank {
  padding-left: 2.35rem !important;
  padding-right: 2.2rem !important;
}

/* 2. Subscription & Pricing Modal — Dark Mode High Contrast */
[data-theme="dark"] #modal-teacher-subscription .modal-content,
html.theme-dark #modal-teacher-subscription .modal-content {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-teacher-subscription .sub-modal-title,
html.theme-dark #modal-teacher-subscription .sub-modal-title,
[data-theme="dark"] #modal-teacher-subscription #tab-my-sub h4,
html.theme-dark #modal-teacher-subscription #tab-my-sub h4 {
  color: #f8fafc !important;
}

[data-theme="dark"] #modal-teacher-subscription .sub-modal-subtitle,
html.theme-dark #modal-teacher-subscription .sub-modal-subtitle {
  color: #94a3b8 !important;
}

[data-theme="dark"] #modal-teacher-subscription .sub-modal-header-icon,
html.theme-dark #modal-teacher-subscription .sub-modal-header-icon {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #34d399 !important;
}

[data-theme="dark"] #modal-teacher-subscription #tab-my-sub > div:first-child,
html.theme-dark #modal-teacher-subscription #tab-my-sub > div:first-child {
  background: linear-gradient(135deg, #1e293b 0%, #172554 100%) !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-teacher-subscription #sub-plan-title,
html.theme-dark #modal-teacher-subscription #sub-plan-title,
[data-theme="dark"] #modal-teacher-subscription #sub-breakdown-periodic,
html.theme-dark #modal-teacher-subscription #sub-breakdown-periodic {
  color: #93c5fd !important;
}

[data-theme="dark"] #modal-teacher-subscription #sub-pages-remaining,
html.theme-dark #modal-teacher-subscription #sub-pages-remaining {
  color: #60a5fa !important;
}

[data-theme="dark"] #modal-teacher-subscription #sub-quota-breakdown > div,
html.theme-dark #modal-teacher-subscription #sub-quota-breakdown > div {
  background: rgba(15, 23, 42, 0.78) !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-teacher-subscription #sub-breakdown-bonus,
html.theme-dark #modal-teacher-subscription #sub-breakdown-bonus {
  color: #4ade80 !important;
}

[data-theme="dark"] #modal-teacher-subscription #tab-my-sub > div:nth-child(2),
html.theme-dark #modal-teacher-subscription #tab-my-sub > div:nth-child(2) {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

[data-theme="dark"] #modal-teacher-subscription #tab-my-sub ul,
html.theme-dark #modal-teacher-subscription #tab-my-sub ul,
[data-theme="dark"] #modal-teacher-subscription #tab-my-sub li,
html.theme-dark #modal-teacher-subscription #tab-my-sub li {
  color: #cbd5e1 !important;
}

[data-theme="dark"] #modal-teacher-subscription .cycle-switcher-wrapper,
html.theme-dark #modal-teacher-subscription .cycle-switcher-wrapper {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-teacher-subscription .cycle-switch-btn:not(.active),
html.theme-dark #modal-teacher-subscription .cycle-switch-btn:not(.active) {
  color: #cbd5e1 !important;
  background: transparent !important;
}

[data-theme="dark"] #modal-teacher-subscription .pricing-card,
html.theme-dark #modal-teacher-subscription .pricing-card,
[data-theme="dark"] #modal-teacher-subscription .booster-plan-card,
html.theme-dark #modal-teacher-subscription .booster-plan-card {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-teacher-subscription .pricing-card.popular-glow,
html.theme-dark #modal-teacher-subscription .pricing-card.popular-glow {
  border-color: #6366f1 !important;
}

[data-theme="dark"] #modal-teacher-subscription .plan-workload-badge,
html.theme-dark #modal-teacher-subscription .plan-workload-badge {
  background: rgba(99, 102, 241, 0.22) !important;
  color: #c7d2fe !important;
}

[data-theme="dark"] #modal-teacher-subscription .pricing-card-price-container,
html.theme-dark #modal-teacher-subscription .pricing-card-price-container {
  background: #0f172a !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-teacher-subscription .pricing-card-monthly-eyebrow,
html.theme-dark #modal-teacher-subscription .pricing-card-monthly-eyebrow,
[data-theme="dark"] #modal-teacher-subscription .pricing-card-monthly-amount,
html.theme-dark #modal-teacher-subscription .pricing-card-monthly-amount {
  color: #a5b4fc !important;
}

[data-theme="dark"] #modal-teacher-subscription .pricing-card-total-footnote,
html.theme-dark #modal-teacher-subscription .pricing-card-total-footnote {
  color: #cbd5e1 !important;
  border-top-color: #334155 !important;
}

[data-theme="dark"] #modal-teacher-subscription .pricing-card-total-footnote strong,
html.theme-dark #modal-teacher-subscription .pricing-card-total-footnote strong {
  color: #f8fafc !important;
}

[data-theme="dark"] #modal-teacher-subscription .pricing-card-daily-pill,
html.theme-dark #modal-teacher-subscription .pricing-card-daily-pill {
  background: rgba(16, 185, 129, 0.18) !important;
  color: #6ee7b7 !important;
  border-color: rgba(52, 211, 153, 0.35) !important;
}

[data-theme="dark"] #modal-teacher-subscription #tab-booster-packs > div:first-child,
html.theme-dark #modal-teacher-subscription #tab-booster-packs > div:first-child {
  background: rgba(30, 58, 138, 0.35) !important;
  border-color: rgba(96, 165, 250, 0.35) !important;
}

[data-theme="dark"] #modal-teacher-subscription #tab-booster-packs > div:first-child h3,
html.theme-dark #modal-teacher-subscription #tab-booster-packs > div:first-child h3 {
  color: #93c5fd !important;
}

[data-theme="dark"] #modal-teacher-subscription #tab-booster-packs > div:first-child p,
html.theme-dark #modal-teacher-subscription #tab-booster-packs > div:first-child p {
  color: #dbeafe !important;
}

[data-theme="dark"] #modal-teacher-subscription #usage-desktop-container thead tr,
html.theme-dark #modal-teacher-subscription #usage-desktop-container thead tr {
  background: #1e293b !important;
}

[data-theme="dark"] #modal-teacher-subscription #usage-desktop-container th,
html.theme-dark #modal-teacher-subscription #usage-desktop-container th {
  color: #e2e8f0 !important;
}

/* 3. VietQR Payment Modal — Dark Mode High Contrast */
[data-theme="dark"] #modal-subscription-payment .modal-content,
html.theme-dark #modal-subscription-payment .modal-content {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-subscription-payment #payment-modal-title,
html.theme-dark #modal-subscription-payment #payment-modal-title {
  color: #4ade80 !important;
}

[data-theme="dark"] #modal-subscription-payment #payment-plan-name,
html.theme-dark #modal-subscription-payment #payment-plan-name {
  color: #93c5fd !important;
}

[data-theme="dark"] #modal-subscription-payment .vietqr-app-transfer-card,
html.theme-dark #modal-subscription-payment .vietqr-app-transfer-card,
[data-theme="dark"] #modal-subscription-payment .vietqr-transfer-info-card,
html.theme-dark #modal-subscription-payment .vietqr-transfer-info-card {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-subscription-payment .vietqr-app-transfer-card > div:first-child > span:first-child,
html.theme-dark #modal-subscription-payment .vietqr-app-transfer-card > div:first-child > span:first-child,
[data-theme="dark"] #modal-subscription-payment #payment-bank-name,
html.theme-dark #modal-subscription-payment #payment-bank-name,
[data-theme="dark"] #modal-subscription-payment #payment-account-name,
html.theme-dark #modal-subscription-payment #payment-account-name {
  color: #f8fafc !important;
}

[data-theme="dark"] #modal-subscription-payment #input-search-bank,
html.theme-dark #modal-subscription-payment #input-search-bank {
  background-color: #0f172a !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

[data-theme="dark"] #modal-subscription-payment #bank-dropdown-list,
html.theme-dark #modal-subscription-payment #bank-dropdown-list {
  background: #1e293b !important;
  border-color: #475569 !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #modal-subscription-payment #payment-live-status-container,
html.theme-dark #modal-subscription-payment #payment-live-status-container {
  background: rgba(22, 101, 52, 0.3) !important;
  border-color: rgba(74, 222, 128, 0.35) !important;
  color: #86efac !important;
}

/* 4. Zalo Integration Modal — Dark Mode High Contrast */
[data-theme="dark"] #modal-zalo-integration .zalo-modal-container,
html.theme-dark #modal-zalo-integration .zalo-modal-container {
  background: #0f172a !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-zalo-integration .zalo-modal-header,
html.theme-dark #modal-zalo-integration .zalo-modal-header,
[data-theme="dark"] #modal-zalo-integration .zalo-modal-tabs,
html.theme-dark #modal-zalo-integration .zalo-modal-tabs,
[data-theme="dark"] #modal-zalo-integration .zalo-modal-footer,
html.theme-dark #modal-zalo-integration .zalo-modal-footer {
  background: #1e293b !important;
  border-color: #334155 !important;
}

[data-theme="dark"] #modal-zalo-integration #zalo-modal-title,
html.theme-dark #modal-zalo-integration #zalo-modal-title,
[data-theme="dark"] #modal-zalo-integration .instruction-heading,
html.theme-dark #modal-zalo-integration .instruction-heading,
[data-theme="dark"] #modal-zalo-integration .card-subtitle,
html.theme-dark #modal-zalo-integration .card-subtitle,
[data-theme="dark"] #modal-zalo-integration .form-label-custom,
html.theme-dark #modal-zalo-integration .form-label-custom,
[data-theme="dark"] #modal-zalo-integration #zalo-user-name,
html.theme-dark #modal-zalo-integration #zalo-user-name,
[data-theme="dark"] #modal-zalo-integration .setting-title-row strong,
html.theme-dark #modal-zalo-integration .setting-title-row strong {
  color: #f8fafc !important;
}

[data-theme="dark"] #modal-zalo-integration .zalo-modal-subtitle,
html.theme-dark #modal-zalo-integration .zalo-modal-subtitle,
[data-theme="dark"] #modal-zalo-integration .footer-help-text,
html.theme-dark #modal-zalo-integration .footer-help-text,
[data-theme="dark"] #modal-zalo-integration .instruction-steps,
html.theme-dark #modal-zalo-integration .instruction-steps,
[data-theme="dark"] #modal-zalo-integration .instruction-steps li,
html.theme-dark #modal-zalo-integration .instruction-steps li,
[data-theme="dark"] #modal-zalo-integration .setting-description,
html.theme-dark #modal-zalo-integration .setting-description,
[data-theme="dark"] #modal-zalo-integration .zalo-test-hint,
html.theme-dark #modal-zalo-integration .zalo-test-hint {
  color: #cbd5e1 !important;
}

[data-theme="dark"] #modal-zalo-integration .zalo-qr-hero-card,
html.theme-dark #modal-zalo-integration .zalo-qr-hero-card,
[data-theme="dark"] #modal-zalo-integration .zalo-group-picker-card,
html.theme-dark #modal-zalo-integration .zalo-group-picker-card,
[data-theme="dark"] #modal-zalo-integration .zalo-connected-banner,
html.theme-dark #modal-zalo-integration .zalo-connected-banner,
[data-theme="dark"] #modal-zalo-integration .auto-grade-settings-card,
html.theme-dark #modal-zalo-integration .auto-grade-settings-card,
[data-theme="dark"] #modal-zalo-integration .zalo-unauth-card,
html.theme-dark #modal-zalo-integration .zalo-unauth-card {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

[data-theme="dark"] #modal-zalo-integration #btn-zalo-send-test-msg,
html.theme-dark #modal-zalo-integration #btn-zalo-send-test-msg,
[data-theme="dark"] #modal-zalo-integration #btn-footer-close-zalo,
html.theme-dark #modal-zalo-integration #btn-footer-close-zalo,
[data-theme="dark"] #modal-zalo-integration #btn-zalo-save-qr,
html.theme-dark #modal-zalo-integration #btn-zalo-save-qr {
  background: #1e293b !important;
  color: #f8fafc !important;
  border-color: #475569 !important;
}

/* 5. Student Portal 320px Micro-Viewport Overflow & Support FAB Guard */
@media (max-width: 480px) {
  html.portal-mode #ag-support-fab,
  body.portal-mode #ag-support-fab {
    display: none !important;
  }
}

@media (max-width: 360px) {
  #student-portal-view,
  #portal-wrap,
  #student-portal-view .flow-right-col,
  #portal-flow-grid,
  #portal-upload-card,
  #portal-ai-card,
  #portal-access-required-card,
  #portal-dropzone {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
  #portal-wrap {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  #portal-upload-card,
  #portal-ai-card {
    padding: 12px !important;
  }
  #portal-upload-card .portal-card-header-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  #portal-upload-card .portal-action-btn-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  #portal-upload-card .portal-action-btn-group .btn {
    width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
    font-size: 0.84rem !important;
    padding: 0.55rem 0.65rem !important;
  }
}
