/* Qızıl Farel admin panel · #00427f + ağ */
:root {
  --blue: #00427f; --blue-dark: #002f5c; --blue-soft: #e8f0f8; --line: #dbe5ef; --bg: #f4f7fb;
  --ink: #0f2236; --muted: #5a6b7d; --white: #fff; --ok: #16a34a; --ok-bg: #e9f8ef; --warn: #b45309; --warn-bg: #fef3e2;
  --red: #dc2626; --radius: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--blue); }

/* ── Düymələr ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px;
       border: 1.5px solid transparent; background: none; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--blue-dark); }
.btn--outline { border-color: var(--blue); color: var(--blue); background: #fff; }
.btn--outline:hover:not(:disabled) { background: var(--blue-soft); }
.btn--ghost { color: var(--blue); }
.btn--ghost:hover:not(:disabled) { background: var(--blue-soft); }
.btn--danger { border-color: #f3c2c2; color: var(--red); background: #fff; }
.btn--danger:hover:not(:disabled) { background: #fdeeee; }
.btn--block { width: 100%; height: 46px; }
.btn--sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 40px; padding: 0; border-color: var(--line); background: #fff; }
.btn--icon svg { width: 20px; height: 20px; fill: none; stroke: var(--blue); stroke-width: 1.8; }

/* ── Giriş ── */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
        background: radial-gradient(circle at 20% 10%, #0a5aa3 0, var(--blue) 40%, #00203f 100%); }
.auth__card { width: min(400px, 100%); background: #fff; border-radius: 20px; padding: 32px 28px; box-shadow: 0 30px 80px rgba(0, 20, 40, .35); }
.auth__logo { height: 52px; display: block; margin: 0 auto 18px; }
.auth h1 { font-size: 22px; text-align: center; color: var(--blue); }
.auth__sub { text-align: center; color: var(--muted); font-size: 14px; margin: 4px 0 22px; }
.auth__err { color: var(--red); font-size: 13.5px; min-height: 20px; margin: 4px 0 10px; }

/* ── Sahələr ── */
.fld { display: block; margin-bottom: 16px; }
.fld > span, .fld__label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.fld input, .fld textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
.fld input { height: 44px; }
.fld textarea { resize: vertical; min-height: 44px; line-height: 1.45; }
.fld input:focus, .fld textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 66, 127, .12); }
.fld small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.changed { font-size: 11px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 2px 8px; border-radius: 999px; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; margin-bottom: 16px; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }

/* ── Üst panel ── */
.app { min-height: 100%; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.top__brand { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--blue); }
.top__brand img { height: 36px; }
.top__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--bg); color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status.is-live { color: var(--ok); background: var(--ok-bg); }
.status.is-draft { color: var(--blue); background: var(--blue-soft); }
.status.is-dirty { color: var(--warn); background: var(--warn-bg); }
.menu { position: relative; }
.menu__pop { position: absolute; right: 0; top: 48px; width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0, 47, 92, .15); }
.menu__pop a, .menu__pop button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-decoration: none; color: var(--ink); font-size: 14px; }
.menu__pop a:hover, .menu__pop button:hover { background: var(--bg); }
.menu__who { padding: 8px 12px 10px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }

/* ── Addımlar + redaktor ── */
.layout { flex: 1; display: grid; grid-template-columns: 260px 1fr; gap: 24px; width: min(1180px, 100%); margin: 0 auto; padding: 24px 20px 40px; }
.steps { position: sticky; top: 84px; align-self: start; display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: none; cursor: pointer; text-align: left; color: var(--muted); font-weight: 500; }
.step:hover { background: #fff; }
.step b { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: 12.5px; color: var(--muted); }
.step.is-active { background: #fff; color: var(--blue); box-shadow: 0 4px 14px rgba(0, 47, 92, .06); }
.step.is-active b { background: var(--blue); border-color: var(--blue); color: #fff; }
.step .dot { width: 8px; height: 8px; border-radius: 50%; background: #f59e0b; margin-left: auto; }

.editor { min-width: 0; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.panel__head { margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.panel__head small { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--blue); }
.panel__head h2 { font-size: 24px; margin: 4px 0; }
.panel__head p { color: var(--muted); }
.group { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 4px; margin-bottom: 18px; }
.group > h3 { font-size: 14px; color: var(--blue); margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.pager { display: flex; justify-content: space-between; margin-top: 16px; }

/* ── Şəkil/video sahəsi ── */
.media { display: flex; gap: 16px; align-items: center; padding: 12px; border: 1.5px dashed var(--line); border-radius: 12px; background: #fafcfe; }
.media__thumb { width: 160px; aspect-ratio: 4 / 3; flex: none; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #0a5aa3, var(--blue)); }
.media__thumb img, .media__thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media__side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-width: 0; }
.media__side small { color: var(--muted); font-size: 12.5px; }
.media__progress { font-size: 12.5px; font-weight: 600; color: var(--blue); }
.media.is-busy { opacity: .7; pointer-events: none; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.gallery-grid .media { flex-direction: column; align-items: stretch; }
.gallery-grid .media__thumb { width: 100%; }

/* ── Publish addımı ── */
.diff { list-style: none; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.diff li { display: grid; grid-template-columns: 200px 1fr; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.diff li:first-child { border-top: 0; }
.diff b { color: var(--ink); font-weight: 600; }
.diff del { color: var(--red); text-decoration: line-through; opacity: .8; display: block; }
.diff ins { color: var(--ok); text-decoration: none; display: block; }
.empty { padding: 18px; border-radius: 12px; background: var(--ok-bg); color: var(--ok); font-weight: 600; margin-bottom: 18px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.history { list-style: none; }
.history li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.history span { color: var(--muted); }
.section-title { font-size: 16px; margin: 6px 0 10px; }

/* ── Dialoq + bildiriş ── */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(0, 20, 40, .45); }
.modal__box { position: relative; width: min(460px, 100%); background: #fff; border-radius: 18px; padding: 26px 24px 22px; box-shadow: 0 30px 80px rgba(0, 20, 40, .3); }
.modal__x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--bg); cursor: pointer; font-size: 16px; }
.modal h2 { font-size: 19px; margin: 0 40px 10px 0; }
.modal p { color: var(--muted); margin-bottom: 10px; }
.modal__btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-weight: 500; font-size: 14px; box-shadow: 0 14px 40px rgba(0, 0, 0, .25); max-width: calc(100% - 32px); }
.toast.is-error { background: var(--red); }

/* ── Telefon ── */
@media (max-width: 900px) {
  .top { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .top__brand span { display: none; }
  .status { order: 3; }
  .top__actions { margin-left: auto; }
  .top__actions .btn:not(.btn--icon) { padding: 0 11px; font-size: 13px; }
  #btnSave { display: none; }   /* telefonda draft avtomatik saxlanır */
  .layout { grid-template-columns: 1fr; padding: 14px 12px 32px; gap: 14px; }
  .steps { position: sticky; top: 108px; z-index: 10; flex-direction: row; overflow-x: auto; gap: 6px; padding: 4px; margin: 0 -12px; padding-inline: 12px; background: var(--bg); scrollbar-width: none; }
  .step { width: auto; flex: none; padding: 8px 12px; background: #fff; border: 1px solid var(--line); white-space: nowrap; }
  .step b { width: 22px; height: 22px; font-size: 11px; }
  .panel { padding: 20px 16px; border-radius: 14px; }
  .grid2 { grid-template-columns: 1fr; }
  .media { flex-direction: column; align-items: stretch; }
  .media__thumb { width: 100%; }
  .diff li { grid-template-columns: 1fr; gap: 4px; }
}

/* ── Geniş dialoq (kəsmə) ── */
.modal__box--wide { width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; }

/* ── Kəsmə: çərçivə saytdakı yerin formasındadır ── */
.crop { position: relative; width: min(100%, calc(60vh * var(--r, 1))); aspect-ratio: var(--r, 1); margin: 6px auto 0; overflow: hidden; border-radius: 12px; background: #0b1b2c;
        touch-action: none; cursor: grab; user-select: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .9); }
.crop.is-drag { cursor: grabbing; }
.crop img { position: absolute; left: 0; top: 0; max-width: none; pointer-events: none; -webkit-user-drag: none; }
.crop::after { content: ""; position: absolute; inset: 0; pointer-events: none;   /* üçdə bir xətləri */
               background: linear-gradient(to right, transparent 33.2%, rgba(255,255,255,.35) 33.3%, transparent 33.5%, transparent 66.5%, rgba(255,255,255,.35) 66.6%, transparent 66.8%),
                           linear-gradient(to bottom, transparent 33.2%, rgba(255,255,255,.35) 33.3%, transparent 33.5%, transparent 66.5%, rgba(255,255,255,.35) 66.6%, transparent 66.8%); }
.crop__bar { display: flex; align-items: center; gap: 12px; margin-top: 14px; color: var(--muted); font-weight: 600; }
.crop__zoom { flex: 1; accent-color: var(--blue); }
.crop__info { display: block; margin-top: 8px; color: var(--muted); font-size: 12.5px; }

/* ── Font seçici ── */
.font-picker { padding: 2px; border: 1px solid var(--line); border-radius: 12px; background: #fafcfe; }
.font-picker__search { width: 100%; height: 42px; border: 1.5px solid var(--line); border-radius: 10px; padding: 0 12px; outline: none; }
.font-picker__search:focus { border-color: var(--blue); }
.font-picker__cats { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; font-weight: 500; }
.chip.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.font-picker__count { display: block; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.font-picker__list { max-height: 360px; overflow-y: auto; border-radius: 10px; background: #fff; border: 1px solid var(--line); margin-bottom: 8px; }
.font-row { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: left; }
.font-row:hover { background: var(--blue-soft); }
.font-row.is-on { background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }
.font-row__name { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.font-row__name em { font-style: normal; font-weight: 500; margin-left: 8px; opacity: .7; }
.font-row__sample { font-size: 21px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* ── Mətn sahəsinin font/ölçü zolağı ── */
.tx-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.tx-font { display: inline-flex; align-items: center; gap: 8px; height: 34px; max-width: 100%; padding: 0 12px 0 6px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; font-size: 13px; color: var(--ink); }
.tx-font:hover { border-color: var(--blue); }
.tx-font__aa { width: 26px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-size: 15px; }
.tx-font__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-font i { font-style: normal; color: var(--muted); font-size: 10px; }
.tx-size { display: inline-flex; align-items: center; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: #fff; overflow: hidden; }
.tx-size button { width: 32px; height: 100%; border: 0; background: none; cursor: pointer; font-size: 17px; color: var(--blue); }
.tx-size button:hover { background: var(--blue-soft); }
.tx-size__val { min-width: 48px; text-align: center; font-size: 13px; color: var(--ink); }
.tx-reset { height: 34px; padding: 0 10px; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; }
.tx-reset:hover { color: var(--red); }
.modal .font-picker { border: 0; background: none; padding: 0; }
.tx-group { display: inline-flex; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: #fff; overflow: hidden; }
.tx-btn { width: 34px; height: 100%; border: 0; background: none; cursor: pointer; font-size: 15px; color: var(--ink); font-family: Georgia, serif; }
.tx-btn + .tx-btn { border-left: 1px solid var(--line); }
.tx-btn:hover { background: var(--blue-soft); }
.tx-btn.is-on { background: var(--blue); color: #fff; }
.tx-case { height: 34px; padding: 0 28px 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 13px; color: var(--ink); cursor: pointer;
           appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
           background-position: right 13px center, right 9px center; background-size: 4px 4px; background-repeat: no-repeat; }
.tx-case:hover { border-color: var(--blue); }
.tx-case.is-on { border-color: var(--blue); color: var(--blue); font-weight: 600; }
