@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap");

@font-face {
  font-family: "KFGQPC Nastaleeq";
  src: url("/assets/KFGQPC-Nastaleeq-368189be.woff2") format("woff2");
  font-display: swap;
}

:root {
  --ink: #1e2823;
  --muted: #657069;
  --paper: #f6f4ee;
  --surface: #fffefa;
  --line: #deddd5;
  --green: #235b46;
  --green-dark: #184333;
  --green-light: #e8f0eb;
  --gold: #b68a45;
  --danger: #a33b33;
  --danger-light: #faece9;
  --shadow: 0 12px 40px rgba(37, 47, 41, 0.07);
}

* { box-sizing: border-box; }
html { color: var(--ink); background: var(--paper); font-family: "DM Sans", system-ui, sans-serif; }
body { margin: 0; min-width: 320px; }
button, input, textarea { font: inherit; }
button, .button { -webkit-tap-highlight-color: transparent; }

.site-shell { min-height: 100vh; }
.site-header { height: 72px; padding: 0 max(24px, calc((100vw - 1120px) / 2)); background: rgba(255, 254, 250, 0.92); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 10; backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; letter-spacing: -0.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; color: #fff; background: var(--green); font-family: "KFGQPC Nastaleeq", serif; font-size: 22px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.brand-mark-large { width: 48px; height: 48px; border-radius: 14px; font-size: 30px; margin: 0 auto 28px; }
.account-menu { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 14px; }
.account-menu form { margin: 0; }

.page { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 64px 0 96px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(36px, 6vw, 54px); line-height: 1; letter-spacing: -0.045em; }
h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -0.025em; }
.eyebrow { margin-bottom: 10px; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.lede { margin-bottom: 0; color: var(--muted); font-size: 17px; }
.collection-count { min-width: 96px; padding: 13px 18px; border-left: 2px solid var(--gold); display: flex; flex-direction: column; }
.collection-count strong { font-size: 28px; line-height: 1; }
.collection-count span { margin-top: 4px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

.flash { width: min(1120px, calc(100% - 48px)); margin: 20px auto 0; padding: 13px 16px; border-radius: 10px; }
.flash-notice { background: var(--green-light); color: var(--green-dark); }
.flash-alert, .error-panel { background: var(--danger-light); color: #722a25; }
.error-panel { border: 1px solid #edc6c1; border-radius: 14px; padding: 20px 24px; margin-bottom: 20px; }
.error-panel h2 { font-size: 16px; margin-bottom: 8px; }
.error-panel ul { margin: 0; padding-left: 20px; }
.warning-panel { display: flex; align-items: center; gap: 13px; padding: 15px 18px; margin-bottom: 32px; color: #6b5127; background: #f5eddd; border: 1px solid #e9d8b7; border-radius: 12px; }
.warning-panel > span { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; font-weight: 700; }
.warning-panel p { margin: 0; font-size: 14px; }

.button { appearance: none; min-height: 42px; padding: 10px 17px; border: 1px solid transparent; border-radius: 9px; display: inline-flex; justify-content: center; align-items: center; cursor: pointer; text-decoration: none; font-weight: 600; transition: 150ms ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); color: #fff; box-shadow: 0 5px 14px rgba(35, 91, 70, .18); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: var(--green); background: var(--green-light); border-color: #cddfd3; }
.button-quiet { color: var(--muted); background: transparent; border-color: var(--line); }
.button-wide { width: 100%; }

.editor-toolbar, .preview-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.dua-list { display: grid; gap: 18px; }
.add-dua-button { margin-top: 18px; }
.dua-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); }
.dua-card-header { min-height: 56px; padding: 10px 16px 10px 20px; background: #fbfaf6; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.dua-identity, .row-actions { display: flex; align-items: center; gap: 10px; }
.dua-id-input { width: 72px; padding: 6px 8px; border: 1px solid #d6d7cf; border-radius: 7px; color: var(--ink); background: #fff; font: inherit; font-size: 13px; font-weight: 600; outline: none; }
.dua-id-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35, 91, 70, .1); }
.icon-button { min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--surface); cursor: pointer; font-size: 13px; }
.icon-button:hover:not(:disabled) { color: var(--green); border-color: var(--green); }
.icon-button:disabled { opacity: .35; cursor: default; }
.icon-button-danger:hover { color: var(--danger) !important; border-color: #d9a8a3 !important; background: var(--danger-light); }
.field-grid { padding: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { color: #4c5751; font-size: 12px; font-weight: 700; letter-spacing: .035em; }
.field input, .field textarea { width: 100%; border: 1px solid #d6d7cf; border-radius: 9px; padding: 11px 12px; color: var(--ink); background: #fff; outline: none; resize: vertical; line-height: 1.45; transition: border-color 120ms, box-shadow 120ms; }
.field textarea:focus, .field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(35, 91, 70, .1); }
.field-arabic { grid-column: 1 / -1; }
.field-arabic textarea { font-family: "KFGQPC Nastaleeq", serif; font-size: 24px; line-height: 1.7; }
.field-transliteration { grid-column: 1 / 2; }
.field-translation { grid-column: 2 / -1; }
.field-reference { grid-column: 1 / -1; }

.preview-section { margin-top: 36px; padding: 23px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.preview-heading { margin: 0; }
.preview-heading .eyebrow { margin-bottom: 5px; }
.json-preview { max-height: 440px; overflow: auto; margin: 20px 0 0; padding: 20px; color: #d8eadf; background: #17241e; border-radius: 10px; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.publish-bar { margin-top: 22px; padding: 20px 22px; background: var(--green-dark); color: #fff; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; gap: 24px; box-shadow: var(--shadow); }
.publish-bar div { display: flex; flex-direction: column; gap: 3px; }
.publish-bar span { color: #bdd0c6; font-size: 13px; }
.publish-bar .button-primary { background: #fff; color: var(--green-dark); }

.auth-page, .state-page { min-height: 100vh; padding: 40px 24px; display: grid; place-items: center; background: radial-gradient(circle at 50% 0, #e5eee8 0, var(--paper) 45%); }
.auth-card, .state-card { width: min(100%, 430px); padding: 42px; text-align: center; background: rgba(255, 254, 250, .96); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 24px 70px rgba(30, 40, 35, .1); }
.auth-card h1, .state-card h1 { font-size: 36px; }
.auth-intro, .auth-help, .state-card > p { color: var(--muted); }
.auth-form { margin-top: 28px; display: grid; gap: 17px; text-align: left; }
.auth-help { margin: 22px 0 0; font-size: 12px; }
.state-card { width: min(100%, 540px); }
.state-icon { width: 54px; height: 54px; margin: 0 auto 24px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.state-icon-success { color: var(--green); background: var(--green-light); }
.state-icon-error { color: var(--danger); background: var(--danger-light); }
.filename { margin: 24px 0; padding: 14px; background: #f0efe9; border-radius: 10px; display: flex; flex-direction: column; gap: 5px; }
.filename span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.filename code { overflow-wrap: anywhere; }
.state-note { margin: 22px 0 0 !important; font-size: 12px; }

@media (max-width: 720px) {
  .site-header { padding: 0 18px; }
  .account-menu > span { display: none; }
  .page { width: min(100% - 28px, 1120px); padding-top: 40px; }
  .page-heading { align-items: start; }
  .field-grid { grid-template-columns: 1fr; padding: 16px; }
  .field-arabic, .field-transliteration, .field-translation, .field-reference { grid-column: auto; }
  .field-id { max-width: 130px; }
  .dua-card-header { align-items: start; }
  .drag-handle { display: none; }
  .publish-bar { align-items: stretch; flex-direction: column; }
  .auth-card, .state-card { padding: 32px 24px; }
}
