/* Flipbook — ortaq dizayn sistemi.
   Motiv: oxucunun qatladığı vərəq küncü (dog-ear). Düymələr, şəkil çərçivələri,
   siyahı nişanları və böyük hero vərəqi eyni formadan kəsilir. */

:root {
  --bg: #ffffff;
  --surface: #eef5f1;
  --surface-2: #e2eee8;
  --ink: #0c1f17;
  --muted: #3b4c44;
  --accent: #19a56f;
  --accent-ink: #04130c;
  --accent-deep: #0f7a51;
  --field-1: #0e2a1f;  --field-1-ink: #ffffff;  --field-1-muted: #b9d3c6;
  --field-2: #d6efe2;  --field-2-ink: #0c1f17;
  --danger: #b3261e;

  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-mid: clamp(1.625rem, 1.2rem + 1.3vw, 2.25rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-display: clamp(3.5rem, 6.4vw, 6.25rem);

  --margin: clamp(16px, 2.6vw, 32px);
  --max: 1320px;
  --ear: 14px;                       /* düymə küncünün ölçüsü */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--step-body)/1.45 "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  letter-spacing: -0.005em; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-weight: 500; letter-spacing: -0.05em; line-height: 0.95; margin: 0; }
p { margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Motiv ---------- */
.ear { clip-path: polygon(0 0, calc(100% - var(--ear)) 0, 100% var(--ear), 100% 100%, 0 100%); }
.ear-img { --ear: 18%; clip-path: polygon(0 0, calc(100% - var(--ear)) 0, 100% calc(var(--ear) * 0.75), 100% 100%, 0 100%); }

/* ---------- Düymələr ---------- */
.btn {
  --ear: 14px;
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  font-family: inherit; font-weight: 500; font-size: var(--step-body); line-height: 1; letter-spacing: -0.01em;
  padding: 16px 28px 16px 24px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
  clip-path: polygon(0 0, calc(100% - var(--ear)) 0, 100% var(--ear), 100% 100%, 0 100%);
  transition: transform .16s var(--ease-out), background-color .16s ease;
}
.btn:hover { background: #22b77d; }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn.small { padding: 10px 18px 10px 16px; font-size: var(--step-small); --ear: 10px; }
.btn.ghost { background: var(--surface); color: var(--ink); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--ink); }

/* ---------- Naviqasiya ---------- */
.top {
  max-width: var(--max); margin: 0 auto; padding: 22px var(--margin);
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  position: relative; z-index: 5;
}
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; font-size: var(--step-lead); letter-spacing: -0.04em; text-decoration: none; }
.logo i { --ear: 9px; width: 22px; height: 28px; background: var(--accent); display: block; clip-path: polygon(0 0, calc(100% - var(--ear)) 0, 100% var(--ear), 100% 100%, 0 100%); }
.nav-links { display: flex; align-items: center; gap: clamp(14px, 2vw, 28px); font-size: var(--step-small); flex-wrap: wrap; }
.nav-links a:not(.btn) { text-decoration: none; color: var(--ink); position: relative; padding: 4px 0; }
.nav-links a:not(.btn)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease-out); }
.nav-links a:not(.btn):hover::after, .nav-links a.on::after { transform: scaleX(1); }
.nav-links form { margin: 0; }
.imp-bar { background: var(--field-1); color: #fff; padding: 10px var(--margin); display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; font-size: var(--step-small); }
.imp-bar form { margin: 0; }

/* ---------- Tətbiq səhifələri ---------- */
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--margin) 80px; }
.alert { margin: 12px 0 0; padding: 14px 18px; background: #fdecea; color: #8a1f12; font-size: var(--step-small); }
.alert.ok { background: var(--field-2); color: var(--ink); }
.muted { color: var(--muted); }

.drop {
  margin-top: 28px; background: var(--surface); padding: 44px 24px; text-align: center; cursor: pointer;
  --ear: 48px; clip-path: polygon(0 0, calc(100% - var(--ear)) 0, 100% var(--ear), 100% 100%, 0 100%);
  transition: background-color .2s ease;
}
.drop.over { background: var(--field-2); }
.drop input[type=file] { display: none; }
.drop svg { color: var(--accent-deep); margin: 0 auto; }
.drop .big { font-size: var(--step-lead); font-weight: 500; letter-spacing: -0.02em; margin: 12px 0 4px; }
.drop .small { color: var(--muted); font-size: var(--step-small); }
.drop .row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.drop input[type=text] { width: 340px; max-width: 100%; background: var(--bg); }
.chosen { margin-top: 12px; font-weight: 500; min-height: 1.3em; }
.progress { height: 8px; background: var(--surface-2); margin-top: 18px; display: none; }
.progress > div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.dash-head { padding: 36px 0 0; display: flex; justify-content: space-between; align-items: end; gap: 20px; flex-wrap: wrap; }
.dash-head h1 { font-size: var(--step-head); }
.dash-head p { margin-top: 10px; }
.shelf-title { margin: 64px 0 22px; font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 40px 24px; }
.card { display: flex; flex-direction: column; gap: 10px; }
.cover {
  --ear: 22%; aspect-ratio: 3 / 4; background: var(--surface); position: relative; display: block; overflow: hidden;
  clip-path: polygon(0 0, calc(100% - var(--ear)) 0, 100% calc(var(--ear) * 0.75), 100% 100%, 0 100%);
  transition: transform .3s var(--ease-out);
}
.cover::after { content: ""; position: absolute; top: 0; right: 0; width: var(--ear); aspect-ratio: 4 / 3; background: var(--surface-2); clip-path: polygon(0 0, 100% 100%, 0 100%); }
.cover canvas, .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (hover: hover) { .card:hover .cover { transform: translateY(-4px); } }
.card h3 { font-size: var(--step-body); letter-spacing: -0.01em; line-height: 1.25; word-break: break-word; }
.card h3 a { text-decoration: none; }
.card .meta { color: var(--muted); font-size: var(--step-small); display: flex; justify-content: space-between; gap: 8px; }
.badge { position: absolute; left: 10px; top: 10px; font-size: 13px; font-weight: 500; padding: 4px 10px; z-index: 1; }
.badge.pub { background: var(--field-2); color: var(--ink); }
.badge.priv { background: var(--ink); color: #fff; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; position: relative; }
.chip {
  font-family: inherit; font-weight: 500; font-size: var(--step-small); line-height: 1; padding: 9px 12px; border: 0;
  background: var(--surface); color: var(--ink); cursor: pointer; list-style: none; text-decoration: none;
  transition: background-color .15s ease, transform .15s var(--ease-out);
}
.chip:hover { background: var(--surface-2); }
.chip:active { transform: scale(0.96); }
summary.chip::-webkit-details-marker { display: none; }
.more .menu {
  position: absolute; left: 0; right: 0; top: 40px; z-index: 10; background: var(--bg); padding: 8px;
  box-shadow: 0 16px 40px rgba(12, 31, 23, .18); /* taste-skill-ignore: açılan menyu, real overlay */ display: flex; flex-direction: column; gap: 2px; min-width: 240px;
  animation: menu-in .18s var(--ease-out);
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.more .menu form { margin: 0; }
.menu-item { display: block; width: 100%; text-align: left; font: inherit; font-size: var(--step-small); padding: 10px 12px; border: 0; background: none; color: var(--ink); cursor: pointer; text-decoration: none; }
.menu-item:hover { background: var(--surface); }
.menu-item.danger { color: var(--danger); }
.rename { display: flex; gap: 6px; padding: 4px 4px 10px; margin-bottom: 4px !important; background: var(--surface); padding: 8px; }
.rename input { flex: 1; padding: 8px 10px; font-size: var(--step-small); background: var(--bg); }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; z-index: 100; transition: opacity .3s; font-size: var(--step-small); }
.empty { color: var(--muted); padding: 10px 0 40px; }

/* Formlar */
.auth { max-width: 460px; margin: 48px auto 40px; display: flex; flex-direction: column; gap: 16px; }
.auth h1 { font-size: var(--step-head); margin-bottom: 8px; }
.auth .alert { margin: 0; }
.auth h3 { font-size: var(--step-lead); letter-spacing: -0.02em; margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 8px; font-size: var(--step-small); font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; font-size: var(--step-body); }
label.check input { width: 20px; height: 20px; accent-color: var(--accent-deep); }
input[type=text], input[type=email], input[type=password], select, textarea {
  font-family: inherit; font-weight: 400; font-size: var(--step-body); line-height: 1.35; padding: 13px 14px; border: 0; background: var(--surface); color: var(--ink); min-width: 0; width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }
.hint { font-weight: 400; color: var(--muted); }

/* Siyasət səhifəsi */
.policy { max-width: 70ch; margin: 48px 0 40px; }
.policy h1 { font-size: var(--step-head); margin-bottom: 32px; }
.policy p { margin-bottom: 18px; line-height: 1.6; }

/* Admin */
.admin-title { margin: 32px 0 0; font-size: var(--step-head); }
.admin-tabs { display: flex; gap: 6px; margin: 24px 0 28px; flex-wrap: wrap; }
.admin-tabs a { padding: 10px 16px; text-decoration: none; color: var(--ink); font-weight: 500; font-size: var(--step-small); background: var(--surface); transition: background-color .15s; }
.admin-tabs a:hover { background: var(--surface-2); }
.admin-tabs a.on { background: var(--ink); color: #fff; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { background: var(--surface); padding: 22px; }
.stat:first-child { background: var(--accent); color: var(--accent-ink); }
.stat b { display: block; font-size: clamp(2rem, 1.5rem + 2vw, 3rem); font-weight: 500; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; margin-bottom: 8px; }
.stat span { font-size: var(--step-small); }
.panel { background: var(--surface); padding: 24px; margin-bottom: 20px; display: flex; flex-direction: column; gap: 14px; }
.panel h2 { font-size: var(--step-lead); letter-spacing: -0.02em; display: flex; gap: 14px; align-items: baseline; }
.panel h2 .sub { font-size: var(--step-small); font-weight: 400; color: var(--muted); }
.panel input, .panel textarea, .panel select { background: var(--bg); }
.panel table { background: transparent; }
.admin-form { display: flex; flex-direction: column; gap: 0; }
.admin-form > .btn { align-self: flex-start; }
.table-wrap { overflow-x: auto; background: var(--surface); margin-bottom: 40px; }
table { width: 100%; border-collapse: collapse; font-size: var(--step-small); }
th, td { padding: 14px 16px; text-align: left; vertical-align: middle; }
tbody tr:nth-child(even) td { background: rgba(255,255,255,.55); }
th { font-weight: 500; color: var(--muted); white-space: nowrap; background: var(--surface-2); }
td.num { font-variant-numeric: tabular-nums; }
td .sub, .sub { color: var(--muted); }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; position: relative; }
.row-actions form { margin: 0; }
.row-actions .chip { background: var(--bg); }
.row-actions .chip:hover { background: var(--surface-2); }
.tag { font-size: 13px; font-weight: 500; padding: 3px 9px; background: var(--bg); white-space: nowrap; }
.tag.admin { background: var(--accent); color: var(--accent-ink); }
.tag.off { background: #fdecea; color: #8a1f12; }
.tag.on { background: var(--field-2); }
.mini-cover { --ear: 12px; width: 44px; height: 58px; background: var(--bg); overflow: hidden; display: block; clip-path: polygon(0 0, calc(100% - var(--ear)) 0, 100% var(--ear), 100% 100%, 0 100%); }
.mini-cover canvas, .mini-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { flex: 1; min-width: 170px; }
.filter { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filter input, .filter select { flex: 1; min-width: 180px; }

/* Sayt sonu (tətbiq səhifələri) */
.app-foot { max-width: var(--max); margin: 0 auto; padding: 28px var(--margin) 40px; display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: var(--step-small); }
.app-foot nav { display: flex; gap: 20px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
