/* lock scroll when overlay is open */
body.lmat-overlay-open { overflow: hidden; }

/* overlay shell */
.lmat-overlay {
  position: fixed; inset: 0; z-index: 100000;
  display: grid; place-items: center;
  animation: fade-in .15s ease-out forwards; opacity: 0;
}
.lmat-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); }

/* card */
.lmat-box {
  position: relative; z-index: 1;
  width: min(92vw, 480px);
  background: #fff; color: #1d2327;
  border-radius: 12px; padding: 16px 16px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  border: 1px solid #e6e8eb;
  animation: rise .18s ease-out forwards; transform: translateY(6px);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji","Segoe UI Emoji";
}

/* dark mode */
@media (prefers-color-scheme: dark) {
  .lmat-box { background: #101418; color: #e8edf5; border-color: #1c232d; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
}

/* row */
.lmat-row { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: center; }

/* spinner & icons */
.lmat-spinner,
.lmat-icon { width: 24px; height: 24px; display: none; }

.lmat-spinner {
  box-sizing: border-box;
  border: 3px solid rgba(0,0,0,.1);
  border-top-color: #3db63d;
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@media (prefers-color-scheme: dark) {
  .lmat-spinner { border-color: rgba(255,255,255,.2); border-top-color: #56ce56; }
}

.lmat-icon { text-align: center; line-height: 24px; font-weight: 700; }
.lmat-icon--ok { color: #19a35b; }
.lmat-icon--err { color: #d23a3a; }

/* text */
.lmat-title { display: none; font-weight: 600; }
.lmat-desc  { display: none; color: #55606e; margin-top: 2px; }
@media (prefers-color-scheme: dark) { .lmat-desc { color: #a8b4c6; } }

/* progress bar */
.lmat-bar { height: 6px; background: rgba(0,0,0,.08); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.lmat-bar > span { display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, #3db63d8e, #3db63d);
  animation: slide 1.5s ease-in-out infinite; border-radius: 999px;
}
@media (prefers-color-scheme: dark) { .lmat-bar { background: rgba(255,255,255,.12); } }

/* state toggles */
.lmat-box[data-state="loading"] .lmat-spinner { display: block; }
.lmat-box[data-state="loading"] .lmat-title[data-label="loading"],
.lmat-box[data-state="loading"] .lmat-desc[data-label="loading"] { display: block; }

.lmat-box[data-state="success"] .lmat-icon--ok { display: block; }
.lmat-box[data-state="success"] .lmat-title[data-label="success"],
.lmat-box[data-state="success"] .lmat-desc[data-label="success"] { display: block; }
.lmat-box[data-state="success"] .lmat-bar { display: none; }

.lmat-box[data-state="error"] .lmat-icon--err { display: block; }
.lmat-box[data-state="error"] .lmat-title[data-label="error"],
.lmat-box[data-state="error"] .lmat-desc[data-label="error"] { display: block; }
.lmat-box[data-state="error"] .lmat-bar > span {
  background: linear-gradient(90deg, rgba(210,58,58,.2), rgba(210,58,58,.6));
}

/* animations */
@keyframes fade-in { to { opacity: 1; } }
@keyframes rise { to { transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slide {
  0% { transform: translateX(-60%); }
  50% { transform: translateX(6%); }
  100% { transform: translateX(110%); }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .lmat-overlay, .lmat-box, .lmat-spinner, .lmat-bar > span { animation: none !important; }
}
