/**
 * components.css
 * --------------
 * Shared component patterns loaded on every page, after tokens.css and
 * before any page-specific stylesheet (styles.css / auth-pages.css).
 * Page-specific files should only contain layout unique to that page.
 */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 0%, var(--bg-top), transparent 42%),
    linear-gradient(160deg, var(--bg-base), color-mix(in srgb, var(--bg-base) 85%, white) 42%, color-mix(in srgb, var(--bg-top) 70%, var(--bg-base)) 100%);
  padding: 3rem 1rem 2rem;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.2;
  font-family: "Fraunces", Georgia, serif;
}

p {
  margin: 0;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

/* ---------------------------------------------------------------------- */
/* Skip link                                                              */
/* ---------------------------------------------------------------------- */

.skip-link {
  position: fixed;
  top: -60px;
  left: 12px;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------------------------------------------------------------------- */
/* Theme toggle                                                           */
/* ---------------------------------------------------------------------- */

.theme-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 30;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 999px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: var(--panel-solid);
}

/* ---------------------------------------------------------------------- */
/* Cards / panels (dashboard ".panel" and auth-page ".card" share a look) */
/* ---------------------------------------------------------------------- */

.card,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.panel {
  padding: 1rem;
  animation: rise 0.55s ease both;
}

/* ---------------------------------------------------------------------- */
/* Forms                                                                  */
/* ---------------------------------------------------------------------- */

.stack {
  display: grid;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.58rem 0.62rem;
  background: var(--panel-solid);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

input:focus,
textarea:focus,
select:focus {
  border-color: transparent;
}

/* ---------------------------------------------------------------------- */
/* Buttons                                                                */
/* ---------------------------------------------------------------------- */

button,
.button-link {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 0.62rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.14s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

button.secondary,
.secondary-btn,
.button-link.secondary {
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary:hover,
.secondary-btn:hover,
.button-link.secondary:hover {
  background: color-mix(in srgb, var(--accent-soft) 80%, var(--ink) 6%);
}

button.warn,
.list-delete-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
}

button.warn:hover,
.list-delete-btn:hover {
  background: color-mix(in srgb, var(--danger-soft) 70%, var(--danger) 10%);
}

button.icon-button {
  padding: 0.5rem;
  width: 40px;
  height: 40px;
}

/* ---------------------------------------------------------------------- */
/* Badges / tags                                                         */
/* ---------------------------------------------------------------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.2rem 0.5rem;
}

.tag.urgent {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag.answered {
  background: var(--ok-soft);
  color: var(--ok);
}

.system-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ---------------------------------------------------------------------- */
/* Icons                                                                  */
/* ---------------------------------------------------------------------- */

.icon {
  display: inline-flex;
  flex: none;
  width: var(--icon-size, 16px);
  height: var(--icon-size, 16px);
}

.icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------------- */
/* Toasts                                                                 */
/* ---------------------------------------------------------------------- */

.toast-region {
  position: fixed;
  right: 12px;
  bottom: 12px;
  display: grid;
  gap: 0.5rem;
  width: min(360px, calc(100vw - 24px));
  z-index: 40;
}

.toast {
  border-left: 4px solid var(--accent-2);
  background: var(--panel-solid);
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 0.7rem;
  box-shadow: var(--shadow);
  animation: rise 0.24s ease both;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
}

.toast-action {
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.toast-action:hover {
  background: color-mix(in srgb, var(--accent-soft) 80%, var(--ink) 6%);
}

/* ---------------------------------------------------------------------- */
/* Skeleton loading placeholders                                         */
/* ---------------------------------------------------------------------- */

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--panel-solid) 70%, transparent),
    transparent
  );
  animation: shimmer 1.4s infinite;
}

.skeleton-list-row {
  height: 68px;
  margin-bottom: 0.55rem;
}

.skeleton-card {
  height: 140px;
  border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after {
    animation: none;
  }
}

/* ---------------------------------------------------------------------- */
/* Error / empty states                                                  */
/* ---------------------------------------------------------------------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  background: color-mix(in srgb, var(--panel-solid) 45%, transparent);
}

.error-state {
  display: grid;
  gap: 0.6rem;
  justify-items: start;
}

/* ---------------------------------------------------------------------- */
/* Modal / dialog                                                        */
/* ---------------------------------------------------------------------- */

dialog.modal {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: var(--shadow);
  width: min(440px, calc(100vw - 2rem));
  max-height: min(600px, calc(100vh - 2rem));
}

dialog.modal::backdrop {
  background: var(--scrim);
}

.modal-inner {
  display: grid;
  gap: 0.9rem;
  padding: 1.3rem;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.modal-head h2 {
  font-size: 1.2rem;
}

.modal-close {
  background: transparent;
  color: var(--ink-soft);
  padding: 0.3rem;
  width: 32px;
  height: 32px;
  flex: none;
}

.modal-close:hover {
  background: var(--accent-soft);
  color: var(--ink);
  transform: none;
}

.modal-body {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.modal-actions button.danger {
  background: var(--danger);
}

.modal-actions button.danger:hover {
  background: color-mix(in srgb, var(--danger) 85%, black 10%);
}

/* ---------------------------------------------------------------------- */
/* Floating action button                                                */
/* ---------------------------------------------------------------------- */

.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  --icon-size: 22px;
}

/* ---------------------------------------------------------------------- */
/* Decorative background glow                                            */
/* ---------------------------------------------------------------------- */

.bg-glow {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(45px);
  z-index: -1;
}

.bg-glow-1 {
  width: 260px;
  height: 260px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  top: -90px;
  right: 12%;
}

.bg-glow-2 {
  width: 230px;
  height: 230px;
  background: color-mix(in srgb, var(--accent-2) 22%, transparent);
  bottom: 8%;
  left: -80px;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .toast,
  .prayer-card {
    animation: none !important;
  }
}
