/*
 * AstroChat Pro - Premium frontend stylesheet.
 * Theme-agnostic, mobile-first, dark-mode aware, RTL-safe.
 */

:root {
  --acp-primary: #7c3aed;
  --acp-primary-dark: #6d28d9;
  --acp-primary-light: #ede9fe;
  --acp-bg: #ffffff;
  --acp-surface: #f8fafc;
  --acp-text: #0f172a;
  --acp-text-muted: #64748b;
  --acp-border: #e2e8f0;
  --acp-success: #10b981;
  --acp-warning: #f59e0b;
  --acp-danger: #ef4444;
  --acp-radius: 14px;
  --acp-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
  --acp-shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --acp-bg: #0f172a;
    --acp-surface: #1e293b;
    --acp-text: #f1f5f9;
    --acp-text-muted: #94a3b8;
    --acp-border: #334155;
    --acp-primary-light: #2e1065;
  }
}

.acp-dark {
  --acp-bg: #0f172a;
  --acp-surface: #1e293b;
  --acp-text: #f1f5f9;
  --acp-text-muted: #94a3b8;
  --acp-border: #334155;
  --acp-primary-light: #2e1065;
}

/* === Layout primitives === */
.acp-container { max-width: 1200px; margin: 0 auto; padding: 24px 16px; color: var(--acp-text); }
.acp-grid { display: grid; gap: 20px; }
.acp-cols-2 { grid-template-columns: repeat(2, 1fr); }
.acp-cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .acp-cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) {
  .acp-cols-2, .acp-cols-3 { grid-template-columns: 1fr; }
}

/* === Buttons === */
.acp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; cursor: pointer; text-decoration: none;
  transition: transform .12s, box-shadow .12s, background .15s;
}
.acp-btn:hover { transform: translateY(-1px); box-shadow: var(--acp-shadow); }
.acp-btn:active { transform: translateY(0); }
.acp-btn-primary { background: var(--acp-primary); color: #fff; }
.acp-btn-primary:hover { background: var(--acp-primary-dark); color: #fff; }
.acp-btn-ghost { background: transparent; color: var(--acp-text); border-color: var(--acp-border); }
.acp-btn-danger { background: var(--acp-danger); color: #fff; }
.acp-btn-block { width: 100%; }

/* === Astrologer card === */
.acp-astro-card {
  background: var(--acp-bg);
  border: 1px solid var(--acp-border);
  border-radius: var(--acp-radius);
  padding: 18px;
  box-shadow: var(--acp-shadow);
  position: relative;
  display: flex; flex-direction: column; gap: 12px;
  transition: transform .15s, box-shadow .15s;
}
.acp-astro-card:hover { transform: translateY(-3px); box-shadow: var(--acp-shadow-lg); }

.acp-astro-photo {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--acp-primary-light);
}

.acp-astro-head { display: flex; gap: 14px; align-items: center; }
.acp-astro-name { font-size: 17px; font-weight: 700; margin: 0; color: var(--acp-text); }
.acp-astro-meta { color: var(--acp-text-muted); font-size: 13px; margin-top: 3px; }

.acp-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--acp-primary-light); color: var(--acp-primary-dark);
  margin: 2px 4px 2px 0;
}

.acp-status-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: #94a3b8; margin-inline-end: 6px; vertical-align: middle;
}
.acp-status-online  { background: var(--acp-success); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.acp-status-busy    { background: var(--acp-warning); }
.acp-status-offline { background: #cbd5e1; }

.acp-rate {
  font-weight: 700; font-size: 16px;
  color: var(--acp-primary-dark);
}
.acp-rate small { font-weight: 500; color: var(--acp-text-muted); font-size: 12px; }

.acp-stars { color: #f59e0b; font-size: 14px; }

/* === Chat UI === */
.acp-chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 75vh;
  max-height: 720px;
  border-radius: var(--acp-radius);
  border: 1px solid var(--acp-border);
  overflow: hidden;
  background: var(--acp-bg);
  box-shadow: var(--acp-shadow);
}
.acp-chat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--acp-primary), var(--acp-primary-dark));
  color: #fff;
}
.acp-chat-header img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.4); }
.acp-chat-header .acp-chat-name { font-weight: 700; font-size: 15px; }
.acp-chat-header .acp-chat-sub  { font-size: 12px; opacity: .85; }
.acp-chat-timer {
  margin-inline-start: auto;
  background: rgba(255,255,255,.18);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}

.acp-chat-body {
  padding: 18px; overflow-y: auto; background: var(--acp-surface);
  display: flex; flex-direction: column; gap: 8px;
}

.acp-msg { max-width: 78%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.45; word-break: break-word; }
.acp-msg-user      { align-self: flex-end; background: var(--acp-primary); color: #fff; border-bottom-right-radius: 4px; }
.acp-msg-astrologer{ align-self: flex-start; background: var(--acp-bg); color: var(--acp-text); border: 1px solid var(--acp-border); border-bottom-left-radius: 4px; }
.acp-msg-system    { align-self: center; background: transparent; color: var(--acp-text-muted); font-size: 12px; font-style: italic; }

.acp-msg-meta { font-size: 10px; opacity: .7; margin-top: 4px; text-align: end; }
.acp-msg-seen::after { content: ' ✓✓'; }

.acp-typing {
  align-self: flex-start; padding: 10px 14px; background: var(--acp-bg);
  border: 1px solid var(--acp-border); border-radius: 14px; display: inline-flex; gap: 4px;
}
.acp-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--acp-text-muted); animation: acp-bounce 1.4s infinite ease-in-out; }
.acp-typing span:nth-child(2) { animation-delay: .2s; }
.acp-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes acp-bounce { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }

.acp-chat-input {
  display: flex; gap: 8px; padding: 12px; background: var(--acp-bg);
  border-top: 1px solid var(--acp-border);
}
.acp-chat-input input[type=text] {
  flex: 1; border: 1px solid var(--acp-border); border-radius: 999px;
  padding: 10px 16px; font-size: 14px; outline: none; background: var(--acp-surface); color: var(--acp-text);
}
.acp-chat-input input[type=text]:focus { border-color: var(--acp-primary); }

.acp-chat-input .acp-icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; background: var(--acp-surface);
  color: var(--acp-text); cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* === Wallet card === */
.acp-wallet-card {
  background: linear-gradient(135deg, var(--acp-primary), var(--acp-primary-dark));
  color: #fff; padding: 24px; border-radius: var(--acp-radius);
  box-shadow: var(--acp-shadow-lg);
}
.acp-wallet-balance { font-size: 36px; font-weight: 800; margin-top: 6px; }
.acp-wallet-label { opacity: .8; font-size: 13px; }

.acp-recharge-pill {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--acp-border); margin: 4px; cursor: pointer; background: var(--acp-bg); color: var(--acp-text);
  transition: background .15s;
}
.acp-recharge-pill:hover { background: var(--acp-primary-light); border-color: var(--acp-primary); }
.acp-recharge-pill.active { background: var(--acp-primary); color: #fff; border-color: var(--acp-primary); }

/* === Modal === */
.acp-modal-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.6); display: none;
  align-items: center; justify-content: center; z-index: 99999; padding: 16px;
}
.acp-modal-overlay.acp-open { display: flex; }
.acp-modal {
  background: var(--acp-bg); border-radius: var(--acp-radius); padding: 24px;
  max-width: 460px; width: 100%; box-shadow: var(--acp-shadow-lg);
  animation: acp-pop .2s ease-out;
}
@keyframes acp-pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.acp-modal h3 { margin-top: 0; font-size: 20px; color: var(--acp-text); }
.acp-modal-actions { display: flex; gap: 8px; margin-top: 16px; }

/* === Forms === */
.acp-form-group { margin-bottom: 14px; }
.acp-form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--acp-text); }
.acp-input, .acp-select, .acp-textarea {
  width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--acp-border); background: var(--acp-bg); color: var(--acp-text);
  font-size: 14px;
}
.acp-input:focus, .acp-select:focus, .acp-textarea:focus { outline: none; border-color: var(--acp-primary); }

.acp-notice {
  padding: 12px 16px; background: var(--acp-primary-light); color: var(--acp-primary-dark);
  border-radius: 10px; font-size: 14px;
}

/* === Tables === */
.acp-table { width: 100%; border-collapse: collapse; }
.acp-table th, .acp-table td { padding: 12px; text-align: start; border-bottom: 1px solid var(--acp-border); font-size: 14px; }
.acp-table th { font-weight: 700; color: var(--acp-text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* === RTL === */
html[dir="rtl"] .acp-msg-user { border-bottom-right-radius: 14px; border-bottom-left-radius: 4px; }
html[dir="rtl"] .acp-msg-astrologer { border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }

/* === Utilities === */
.acp-flex { display: flex; }
.acp-items-center { align-items: center; }
.acp-gap-2 { gap: 8px; }
.acp-mt-2 { margin-top: 8px; }
.acp-mt-4 { margin-top: 16px; }
.acp-text-muted { color: var(--acp-text-muted); }
.acp-text-sm { font-size: 13px; }
.acp-rounded { border-radius: 10px; }

/* === Cards & generic === */
.acp-card {
  background: var(--acp-bg);
  border: 1px solid var(--acp-border);
  border-radius: var(--acp-radius);
  padding: 20px;
  box-shadow: var(--acp-shadow);
}
.acp-muted { color: var(--acp-text-muted); }
.acp-help { display: block; margin-top: 6px; color: var(--acp-text-muted); font-size: 12px; }
.acp-label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--acp-text); }

/* === Pills/Status === */
.acp-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: var(--acp-surface);
  color: var(--acp-text-muted);
}
.acp-pill-online,
.acp-pill-active,
.acp-pill-paid,
.acp-pill-approved { background: rgba(16,185,129,.12); color: var(--acp-success); }
.acp-pill-busy,
.acp-pill-pending { background: rgba(245,158,11,.12); color: var(--acp-warning); }
.acp-pill-offline,
.acp-pill-rejected,
.acp-pill-expired,
.acp-pill-ended { background: rgba(239,68,68,.12); color: var(--acp-danger); }

.acp-status-dot.is-online,
.acp-status-dot.is-active { background: var(--acp-success); box-shadow: 0 0 0 3px rgba(16,185,129,.18); }
.acp-status-dot.is-busy { background: var(--acp-warning); }
.acp-status-dot.is-offline,
.acp-status-dot.is-away { background: #cbd5e1; }

/* === Recharge pills (alias is-active) === */
.acp-recharge-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.acp-recharge-pill.is-active { background: var(--acp-primary); color: #fff; border-color: var(--acp-primary); }

.acp-recharge-summary {
  background: var(--acp-surface);
  border: 1px solid var(--acp-border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 18px 0;
  font-size: 14px;
}
.acp-recharge-summary > div {
  display: flex; justify-content: space-between; padding: 4px 0;
}
.acp-recharge-summary .acp-sum-total {
  border-top: 1px dashed var(--acp-border);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 700;
  font-size: 16px;
  color: var(--acp-primary-dark);
}

/* === Gateways === */
.acp-gateway-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.acp-gateway-option {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--acp-border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: border-color .15s, background .15s;
}
.acp-gateway-option:hover { border-color: var(--acp-primary); background: var(--acp-primary-light); }
.acp-gateway-option input[type=radio] { accent-color: var(--acp-primary); }

/* === Form messages (override generic .acp-msg when used as banner) === */
.acp-msg.is-error,
.acp-msg.is-success,
.acp-msg.is-info {
  display: block; align-self: stretch; max-width: none;
  padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-top: 12px;
  border: 1px solid transparent;
}
.acp-msg.is-error   { background: rgba(239,68,68,.08);  color: var(--acp-danger);  border-color: rgba(239,68,68,.25); }
.acp-msg.is-success { background: rgba(16,185,129,.08); color: var(--acp-success); border-color: rgba(16,185,129,.25); }
.acp-msg.is-info    { background: rgba(124,58,237,.08); color: var(--acp-primary-dark); border-color: rgba(124,58,237,.25); }

/* === Wallet card extras === */
.acp-wallet-sub { font-size: 13px; opacity: .85; margin-top: 6px; }

/* === Transactions list === */
.acp-txn-list { display: flex; flex-direction: column; gap: 8px; }
.acp-txn {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--acp-border);
  border-radius: 10px;
  background: var(--acp-surface);
}
.acp-txn-main { display: flex; flex-direction: column; gap: 4px; }
.acp-txn-cat { font-weight: 600; font-size: 14px; color: var(--acp-text); }
.acp-txn-meta { font-size: 12px; color: var(--acp-text-muted); }
.acp-txn-inv { font-family: ui-monospace, SFMono-Regular, monospace; }
.acp-txn-amount { font-weight: 700; font-size: 16px; }
.acp-txn.is-credit .acp-txn-amount { color: var(--acp-success); }
.acp-txn.is-debit  .acp-txn-amount { color: var(--acp-danger); }

/* === Astrologer Dashboard === */
.acp-dash-header {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.acp-dash-greet h2 { margin: 0; font-size: 22px; color: var(--acp-text); }
.acp-dash-status { display: flex; }
.acp-status-toggle {
  display: inline-flex; padding: 4px; border-radius: 999px;
  background: var(--acp-surface); border: 1px solid var(--acp-border);
}
.acp-status-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border: none; background: transparent; cursor: pointer;
  border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--acp-text-muted);
  transition: background .15s, color .15s;
}
.acp-status-btn:hover { color: var(--acp-text); }
.acp-status-btn.is-active { background: var(--acp-bg); color: var(--acp-text); box-shadow: var(--acp-shadow); }

.acp-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.acp-stats.acp-cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .acp-stats.acp-cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .acp-stats.acp-cols-3 { grid-template-columns: 1fr; } }
.acp-stat-card {
  background: var(--acp-bg);
  border: 1px solid var(--acp-border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--acp-shadow);
}
.acp-stat-label { font-size: 12px; color: var(--acp-text-muted); text-transform: uppercase; letter-spacing: .03em; }
.acp-stat-value { font-size: 24px; font-weight: 700; margin-top: 4px; color: var(--acp-text); }

/* === Reviews === */
.acp-review {
  padding: 14px 0;
  border-bottom: 1px solid var(--acp-border);
}
.acp-review:last-child { border-bottom: none; }
.acp-review-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.acp-review-text { margin: 6px 0 4px; color: var(--acp-text); font-size: 14px; line-height: 1.5; }

/* === Login === */
.acp-login-wrap { max-width: 480px; }
.acp-login-card { padding: 32px; }
.acp-login-head { text-align: center; margin-bottom: 24px; }
.acp-login-head h2 { margin: 0 0 6px; font-size: 22px; }
.acp-login-foot { font-size: 12px; color: var(--acp-text-muted); }

.acp-otp-input {
  text-align: center;
  font-size: 22px;
  letter-spacing: 8px;
  font-weight: 700;
}

/* === Search === */
.acp-search {
  margin-bottom: 18px;
}
.acp-search input {
  width: 100%; padding: 12px 16px; border-radius: 999px;
  border: 1px solid var(--acp-border); background: var(--acp-bg); color: var(--acp-text);
  font-size: 14px; outline: none;
}
.acp-search input:focus { border-color: var(--acp-primary); }

/* === Mobile chat sizing === */
@media (max-width: 600px) {
  .acp-chat { height: calc(100vh - 120px); max-height: none; border-radius: 0; border-left: 0; border-right: 0; }
  .acp-wallet-balance { font-size: 28px; }
  .acp-stat-value { font-size: 20px; }
}
