/* =============================================================
   LocalModels — Modal Styling
   Custom styling for Bootstrap modals (error, success, confirm)
   with full dark mode support.
   ============================================================= */

/* Base modal styling */
.modal-content {
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.15);
}

.modal-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 24px;
}

.modal-header .modal-title,
.modal-header h6.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 0;
}

.modal-body {
  padding: 24px;
  color: #475569;
  font-size: 14px;
  line-height: 1.6;
}

.modal-body p {
  margin: 0;
}

.modal-body h6 {
  font-size: 14px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 12px 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  gap: 8px;
}

.modal-footer .btn {
  min-width: 100px;
}

.btn-close {
  color: #64748b;
  opacity: 1;
}

.btn-close:hover {
  color: #0f172a;
  opacity: 1;
}

/* Dark mode — modal content */
html[data-lm-theme="dark"] .modal-content,
html.lm-dark .modal-content {
  background: #1e293b;
  border-color: #334155;
}

html[data-lm-theme="dark"] .modal-header,
html.lm-dark .modal-header {
  background: #1e293b;
  border-color: #334155;
}

html[data-lm-theme="dark"] .modal-header .modal-title,
html.lm-dark .modal-header .modal-title,
html[data-lm-theme="dark"] .modal-header h6.modal-title,
html.lm-dark .modal-header h6.modal-title {
  color: #f1f5f9;
}

html[data-lm-theme="dark"] .modal-body,
html.lm-dark .modal-body {
  color: #cbd5e1;
}

html[data-lm-theme="dark"] .modal-body h6,
html.lm-dark .modal-body h6 {
  color: #f1f5f9;
}

html[data-lm-theme="dark"] .modal-footer,
html.lm-dark .modal-footer {
  background: #0f172a;
  border-color: #334155;
}

html[data-lm-theme="dark"] .btn-close,
html.lm-dark .btn-close {
  color: #94a3b8;
  opacity: 1;
}

html[data-lm-theme="dark"] .btn-close:hover,
html.lm-dark .btn-close:hover {
  color: #f1f5f9;
  opacity: 1;
}

/* Modal buttons */
.modal .btn-primary {
  background: #0F6F4F;
  border-color: #0F6F4F;
  color: #fff;
  font-weight: 600;
}

.modal .btn-primary:hover {
  background: #0A5439;
  border-color: #0A5439;
}

.modal .btn-light {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #0f172a;
  font-weight: 600;
}

.modal .btn-light:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: #0f172a;
}

/* Dark mode — modal buttons */
html[data-lm-theme="dark"] .modal .btn-light,
html.lm-dark .modal .btn-light {
  background: #334155;
  border-color: #475569;
  color: #f1f5f9;
}

html[data-lm-theme="dark"] .modal .btn-light:hover,
html.lm-dark .modal .btn-light:hover {
  background: #475569;
  border-color: #64748b;
  color: #f1f5f9;
}

/* Alert in modals */
.modal .alert {
  border-radius: 8px;
  font-size: 13px;
}

.modal .alert-danger {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #B91C1C;
}

html[data-lm-theme="dark"] .modal .alert-danger,
html.lm-dark .modal .alert-danger {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
  color: #ef4444;
}

/* Form controls in modals */
.modal .form-control {
  border-color: #cbd5e1;
  color: #0f172a;
  font-size: 14px;
}

.modal .form-control:focus {
  border-color: #0F6F4F;
  box-shadow: 0 0 0 3px rgba(15, 111, 79, 0.1);
}

.modal .form-label {
  color: #475569;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 6px;
}

/* Dark mode — form controls in modals */
html[data-lm-theme="dark"] .modal .form-control,
html.lm-dark .modal .form-control {
  background: #0f172a;
  border-color: #475569;
  color: #f1f5f9;
}

html[data-lm-theme="dark"] .modal .form-control:focus,
html.lm-dark .modal .form-control:focus {
  background: #0f172a;
  border-color: #0F6F4F;
  box-shadow: 0 0 0 3px rgba(15, 111, 79, 0.2);
  color: #f1f5f9;
}

html[data-lm-theme="dark"] .modal .form-label,
html.lm-dark .modal .form-label {
  color: #cbd5e1;
}

html[data-lm-theme="dark"] .modal .form-text,
html.lm-dark .modal .form-text {
  color: #94a3b8;
}

/* Text-center modals (success/error/info) */
.modal-body.text-center {
  text-align: center !important;
}

.modal-body.text-center .main-icon {
  color: #0F6F4F;
  margin-bottom: 16px;
}

.modal-body.text-center h4 {
  font-size: 18px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 8px 0;
}

.modal-body.text-center p {
  color: #475569;
  margin-top: 12px;
  line-height: 1.6;
}

/* Dark mode — centered modals */
html[data-lm-theme="dark"] .modal-body.text-center .main-icon,
html.lm-dark .modal-body.text-center .main-icon {
  color: #2ea16f;
}

html[data-lm-theme="dark"] .modal-body.text-center h4,
html.lm-dark .modal-body.text-center h4 {
  color: #f1f5f9;
}

html[data-lm-theme="dark"] .modal-body.text-center p,
html.lm-dark .modal-body.text-center p {
  color: #cbd5e1;
}

/* Spinner in modals */
.modal .spinner-border {
  border-color: rgba(15, 111, 79, 0.2);
  border-right-color: #0F6F4F;
}

html[data-lm-theme="dark"] .modal .spinner-border,
html.lm-dark .modal .spinner-border {
  border-color: rgba(46, 161, 111, 0.2);
  border-right-color: #2ea16f;
}

/* Modal backdrop */
.modal-backdrop {
  background: rgba(15, 23, 42, 0.5);
}

html[data-lm-theme="dark"] .modal-backdrop,
html.lm-dark .modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
}

/* =============================================================
   Forget-password "Verification Code" modal (branded)
   ============================================================= */
.lm-verify-body {
  text-align: center;
  padding: 32px 28px 24px;
}

.lm-verify-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #F3F8F5;
  color: #0F6F4F;
}

.lm-verify-lead {
  font-size: 14px;
  line-height: 1.6;
  color: #475569;
  margin: 0 auto 14px;
  max-width: 360px;
}

.lm-verify-sentto {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
}

.lm-verify-email {
  display: inline-block;
  font-weight: 600;
  color: #0F6F4F;
  background: #F3F8F5;
  border: 1px solid #DCEBE2;
  border-radius: 999px;
  padding: 3px 12px;
  margin-top: 4px;
}

.lm-verify-field {
  margin: 0 auto;
  max-width: 280px;
}

.lm-verify-input {
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.5em;
  padding: 12px 8px;
  height: auto;
  text-indent: 0.5em; /* compensate trailing letter-spacing for centering */
}

.lm-verify-input::placeholder {
  color: #cbd5e1;
  letter-spacing: 0.4em;
}

.lm-verify-input:focus {
  border-color: #0F6F4F;
  box-shadow: 0 0 0 3px rgba(15, 111, 79, 0.12);
}

/* Dark mode */
html[data-lm-theme="dark"] .lm-verify-icon,
html.lm-dark .lm-verify-icon {
  background: rgba(46, 161, 111, 0.14);
  color: #2ea16f;
}

html[data-lm-theme="dark"] .lm-verify-lead,
html.lm-dark .lm-verify-lead {
  color: #cbd5e1;
}

html[data-lm-theme="dark"] .lm-verify-sentto,
html.lm-dark .lm-verify-sentto {
  color: #94a3b8;
}

html[data-lm-theme="dark"] .lm-verify-email,
html.lm-dark .lm-verify-email {
  color: #5ec79a;
  background: rgba(46, 161, 111, 0.14);
  border-color: rgba(46, 161, 111, 0.3);
}

html[data-lm-theme="dark"] .lm-verify-input::placeholder,
html.lm-dark .lm-verify-input::placeholder {
  color: #475569;
}

html[data-lm-theme="dark"] .lm-verify-input:focus,
html.lm-dark .lm-verify-input:focus {
  border-color: #2ea16f;
  box-shadow: 0 0 0 3px rgba(46, 161, 111, 0.18);
}

/* =============================================================
   Semantic modal icons (error / success / info / confirm)
   The shared centered modals (#modal-error/success/info/confirm-payment)
   render the SAME .main-icon with no per-type hook, so all icons were green.
   Worse, report.svg / info.svg / market.svg ship HARDCODED fills (#5e72e4
   blue, #3cacb6) that ignore `color`. Force those glyphs to currentColor,
   then colour by the per-type class added on the modal body. Placed after the
   default `.modal-body.text-center .main-icon` rule so these win by order.
   ============================================================= */
.modal-body.text-center .main-icon svg,
.modal-body.text-center .main-icon svg path { fill: currentColor !important; }

.modal-body.lm-mico-error .main-icon   { color: #C0392B; }  /* error  = red */
.modal-body.lm-mico-success .main-icon { color: #0F6F4F; }  /* success = brand green */
.modal-body.lm-mico-info .main-icon    { color: #2563EB; }  /* info   = calm blue */
.modal-body.lm-mico-confirm .main-icon { color: #0F6F4F; }  /* payment confirm = brand */

html[data-lm-theme="dark"] .modal-body.lm-mico-error .main-icon,
html.lm-dark .modal-body.lm-mico-error .main-icon   { color: #F08A7E; }
html[data-lm-theme="dark"] .modal-body.lm-mico-success .main-icon,
html.lm-dark .modal-body.lm-mico-success .main-icon { color: #3FCF8E; }
html[data-lm-theme="dark"] .modal-body.lm-mico-info .main-icon,
html.lm-dark .modal-body.lm-mico-info .main-icon    { color: #60A5FA; }
html[data-lm-theme="dark"] .modal-body.lm-mico-confirm .main-icon,
html.lm-dark .modal-body.lm-mico-confirm .main-icon { color: #3FCF8E; }

/* Branded close (X). Bootstrap's btn-close uses a background SVG; the core
   overrides it to WHITE, which is invisible on the light LM header. Set a grey
   glyph for light and a light-grey one for dark. */
.modal .btn-close {
  --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2364748b'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
  opacity: 1;
}
html[data-lm-theme="dark"] .modal .btn-close,
html.lm-dark .modal .btn-close {
  --bs-btn-close-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%2394a3b8'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e");
}
