/* --- ACCOUNT PAGE --- */

.main-content.account-main {
  box-sizing: border-box;
  align-items: center;
}

.account-page {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 44px;
  box-sizing: border-box;
}

.account-hero,
.account-card {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px;
  box-sizing: border-box;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.32);
}

.account-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 20px;
  background:
    radial-gradient(circle at top left, rgba(0, 212, 255, 0.16), transparent 32%),
    linear-gradient(135deg, rgba(13, 39, 49, 0.96), rgba(22, 27, 34, 0.96));
  border-color: rgba(0, 212, 255, 0.36);
}

.account-hero h2 {
  margin: 0 0 10px;
  color: #ffffff;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  line-height: 1.1;
  text-transform: uppercase;
}

.account-hero p,
.account-card p {
  color: #8b949e;
  line-height: 1.55;
  margin: 8px 0 0;
}

.account-status {
  margin-bottom: 20px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #8b949e;
}

.account-status[data-type="success"] {
  color: #00ff88;
  border-color: rgba(0, 255, 136, 0.42);
}

.account-status[data-type="error"] {
  color: #ff7b72;
  border-color: rgba(255, 123, 114, 0.42);
}

.account-card {
  margin-bottom: 20px;
}

.account-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.account-card h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.15rem;
}

.overview-grid,
.subscription-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.overview-item {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 14px;
  padding: 16px;
  box-sizing: border-box;
}

.overview-item span {
  display: block;
  color: #8b949e;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.overview-item strong {
  color: #ffffff;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.account-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.account-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.account-form-grid label.full-span {
  grid-column: 1 / -1;
}

.account-form-grid span {
  color: #8b949e;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.account-form-grid input,
.account-form-grid select {
  width: 100%;
  background: #0d1117;
  color: #ffffff;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 12px 13px;
  font: inherit;
  box-sizing: border-box;
  outline: none;
}

.account-form-grid input:focus,
.account-form-grid select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.account-form-grid input:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.account-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
}

.subscription-account-card .btn-main {
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .account-page {
    width: 94%;
  }

  .account-hero,
  .account-card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .overview-grid,
  .subscription-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .account-page {
    width: 100%;
  }

  .account-hero,
  .account-card {
    padding: 22px;
  }

  .overview-grid,
  .subscription-summary {
    grid-template-columns: 1fr;
  }

  .account-actions,
  .account-actions .btn-main,
  .account-card-header .btn-main {
    width: 100%;
  }
}


/* --- SUBSCRIPTION ACCOUNT CONTROLS --- */

.account-subscription-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.account-subscription-actions .btn-main {
  min-height: 40px;
  white-space: nowrap;
}

.account-subscription-actions .btn-main:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.subscription-account-note {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 12px;
  background: rgba(0, 212, 255, 0.07);
  border: 1px solid rgba(0, 212, 255, 0.22);
  color: #a8b3c7;
}

@media (max-width: 640px) {
  .account-subscription-actions,
  .account-subscription-actions .btn-main {
    width: 100%;
  }
}

/* --- MANUAL SUBSCRIPTION RECEIPT UPLOAD --- */

.subscription-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  background: rgba(0, 212, 255, 0.18);
  border: 1px solid rgba(0, 212, 255, 0.36);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.subscription-mode-badge[data-mode="manual"] {
  background: rgba(0, 212, 255, 0.18);
  border-color: rgba(0, 212, 255, 0.36);
}

.subscription-mode-badge[data-mode="gateway"] {
  background: rgba(0, 255, 136, 0.16);
  border-color: rgba(0, 255, 136, 0.34);
}

.subscription-mode-badge[data-mode="unavailable"] {
  background: rgba(255, 123, 114, 0.12);
  border-color: rgba(255, 123, 114, 0.34);
}

.manual-subscription-panel,
.pending-subscription-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  background: #0d1117;
  border: 1px solid #30363d;
  box-sizing: border-box;
}

.manual-subscription-header {
  margin-bottom: 16px;
}

.manual-subscription-header h4,
.pending-subscription-panel h4 {
  margin: 4px 0 6px;
  color: #ffffff;
  font-size: 1rem;
}

.manual-subscription-header p,
.pending-subscription-panel p {
  margin: 0;
  color: #8b949e;
  line-height: 1.55;
}

.pending-subscription-panel {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 18px !important;
  background: rgba(255, 193, 7, 0.08);
  border-color: rgba(255, 193, 7, 0.28);
}

.pending-subscription-content {
  min-width: 0 !important;
}

.pending-subscription-actions {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  min-width: 150px !important;
}

.pending-subscription-actions #pendingSubscriptionReceiptLink {
  width: auto !important;
  min-width: 132px !important;
  margin: 0 !important;
  white-space: nowrap !important;
  text-align: center !important;
  justify-content: center !important;
}

.field-helper {
  color: #8b949e;
  font-size: 0.78rem;
  line-height: 1.35;
}

.account-form-grid input[type="file"] {
  padding: 10px;
}

@media (max-width: 700px) {
  .pending-subscription-panel {
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    padding: 18px !important;
  }

  .pending-subscription-actions {
    width: 100% !important;
    min-width: 0 !important;
    margin-top: 16px !important;
    justify-content: stretch !important;
  }

  .pending-subscription-actions #pendingSubscriptionReceiptLink,
  .pending-subscription-panel .btn-main,
  .subscription-mode-badge {
    width: 100% !important;
    min-height: 44px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }
}

/* --- PENDING SUBSCRIPTION VISIBILITY SAFETY --- */

#pendingSubscriptionPanel[hidden],
.pending-subscription-panel[hidden],
#manualSubscriptionRequestPanel[hidden],
.manual-subscription-panel[hidden] {
  display: none !important;
}


/* --- BILLING HISTORY LINK --- */

.billing-history-cta {
  margin-top: 18px;
  padding: 18px;
  border-radius: 14px;
  background: #0d1117;
  border: 1px solid #30363d;
  box-sizing: border-box;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.billing-history-cta[hidden],
#billingRecordsBlock[hidden] {
  display: none !important;
}

.billing-history-copy,
.billing-history-cta > div {
  flex: 1 1 auto;
  min-width: 0;
}

.billing-history-cta h4 {
  margin: 4px 0 6px;
  color: #ffffff;
  font-size: 1rem;
}

.billing-history-cta p {
  margin: 0;
  color: #8b949e;
  line-height: 1.55;
}

.billing-history-cta .btn-main,
.billing-history-cta .secondary {
  flex: 0 0 auto;
  white-space: nowrap;
  justify-content: center;
}

@media (max-width: 700px) {
  .billing-history-cta {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .billing-history-cta .btn-main,
  .billing-history-cta .secondary {
    width: 100%;
  }
}

/* --- Subscription lifecycle status notices --- */
.subscription-account-note[data-status="success"] {
  background: rgba(0, 255, 136, 0.08);
  border-color: rgba(0, 255, 136, 0.28);
  color: #b9ffd9;
}

.subscription-account-note[data-status="warning"] {
  background: rgba(255, 193, 7, 0.09);
  border-color: rgba(255, 193, 7, 0.32);
  color: #ffe6a6;
}

.subscription-account-note[data-status="danger"] {
  background: rgba(255, 87, 87, 0.1);
  border-color: rgba(255, 87, 87, 0.34);
  color: #ffb7b7;
}

.subscription-account-note[data-status="info"] {
  background: rgba(0, 212, 255, 0.07);
  border-color: rgba(0, 212, 255, 0.22);
  color: #a8dff0;
}

/* --- MY ACCOUNT PAGE RAIL NORMALIZATION ---
   The outer #mainContent frame is controlled globally by main.css and
   scripts/script.js, like the other public/private pages. Account-specific CSS
   only controls the inner content cards so it does not fight the sidebar rail. */

.account-page,
.account-hero,
.account-card,
.billing-history-cta,
.manual-subscription-panel,
.pending-subscription-panel {
  min-width: 0;
}

.account-page {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* --- MY ACCOUNT: ARABIC / RTL SUPPORT --- */
html[dir="rtl"] .account-page,
html[dir="rtl"] .account-hero,
html[dir="rtl"] .account-card,
html[dir="rtl"] .account-status,
html[dir="rtl"] .manual-subscription-panel,
html[dir="rtl"] .pending-subscription-panel,
html[dir="rtl"] .billing-history-cta {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .account-hero,
html[dir="rtl"] .account-card-header,
html[dir="rtl"] .account-subscription-actions,
html[dir="rtl"] .billing-history-cta {
  flex-direction: row-reverse;
}

html[dir="rtl"] .account-actions { justify-content: flex-start; }
html[dir="rtl"] .pending-subscription-panel { grid-template-columns: auto minmax(0, 1fr) !important; }
html[dir="rtl"] .pending-subscription-content { grid-column: 2; }
html[dir="rtl"] .pending-subscription-actions { grid-column: 1; justify-content: flex-start !important; }
html[dir="rtl"] #pendingSubscriptionReceiptLink { margin-right: 0 !important; margin-left: 0 !important; }
html[dir="rtl"] .account-form-grid input,
html[dir="rtl"] .account-form-grid select { text-align: right; }
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] #subscriptionPaymentReference,
html[dir="rtl"] #paymentAccountNumber,
html[dir="rtl"] #organizerPhone,
html[dir="rtl"] #phoneNumber,
html[dir="rtl"] #paymentWhatsappNumber { direction: ltr; text-align: left; }
html[dir="rtl"] .overview-item strong,
html[dir="rtl"] #subscriptionPlan,
html[dir="rtl"] #subscriptionStatus,
html[dir="rtl"] #subscriptionPeriod,
html[dir="rtl"] #pendingSubscriptionAmount,
html[dir="rtl"] #pendingSubscriptionSubmitted { unicode-bidi: plaintext; }

@media (max-width: 900px) {
  html[dir="rtl"] .account-hero,
  html[dir="rtl"] .account-card-header { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 700px) {
  html[dir="rtl"] .pending-subscription-panel { grid-template-columns: 1fr !important; }
  html[dir="rtl"] .pending-subscription-content,
  html[dir="rtl"] .pending-subscription-actions { grid-column: 1; }
  html[dir="rtl"] .billing-history-cta { flex-direction: column !important; }
}

/* =========================================================
   MY ACCOUNT MOBILE CTA STABILITY
   Keep account cards and billing actions inside the normal mobile page rail.
   The outer main-content width/padding is handled by styles/main.css.
   ========================================================= */
@media (max-width: 1023px) {
  .account-page,
  .account-hero,
  .account-card,
  .billing-history-cta,
  .manual-subscription-panel,
  .pending-subscription-panel {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .billing-history-cta {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 16px !important;
  }

  .billing-history-copy,
  .billing-history-cta > div {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 0 1 auto !important;
  }

  .billing-history-cta .btn-main,
  .billing-history-cta .secondary,
  #viewBillingHistoryBtn {
    position: static !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 44px !important;
    margin: 0 !important;
    align-self: stretch !important;
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }
}
