/* Sponsor advertisement system — India Association of Phoenix colours */
:root {
  --orange: #f7931e;
  --orange-dark: #c86a00;
  --ink: #222;
  --muted: #666;
  --line: #e3ded6;
  --bg: #faf7f2;
  --card: #fff;
  --blue: #2b4c9b;
  --green: #1f8a4c;
  --red: #b42318;
  --amber: #a15c00;
  --radius: 10px;
  font-size: 17px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; line-height: 1.5; }
a { color: var(--blue); }
h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .25rem; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1400px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 60vh; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin: .35rem 0 0; }

/* Header & footer */
.topbar { background: #fff; border-bottom: 4px solid var(--orange); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand img { display: block; width: min(420px, 100%); height: auto; }
.area-admin .brand img { width: min(300px, 100%); }
.admin-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-nav a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 600; }
.admin-nav a:hover { background: var(--bg); }
.admin-nav a.on { background: var(--orange); color: #fff; }
.foot { color: var(--muted); font-size: .85rem; padding: 24px 0; border-top: 1px solid var(--line); }

/* Cards, layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.card.flush { padding: 0; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.empty { text-align: center; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 20px; align-items: start; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.hero { margin-bottom: 20px; }
.hero h1 { font-size: 2rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.crumbs { margin: 0 0 8px; }

/* Forms */
label { display: block; font-weight: 600; margin: 16px 0 6px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input[type=file], textarea, select {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #c9c2b6; border-radius: 8px; background: #fff; color: var(--ink);
}
input[type=file] { padding: 8px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(247, 147, 30, .45); outline-offset: 1px; }
[aria-invalid=true] { border-color: var(--red) !important; }
fieldset { border: 0; padding: 0; margin: 16px 0 0; }
legend { font-weight: 600; padding: 0; margin-bottom: 6px; }
label.choice { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; margin: 4px 16px 4px 0; cursor: pointer; }
label.choice input { width: 18px; height: 18px; accent-color: var(--orange-dark); }
.size-choice { display: flex !important; align-items: flex-start !important; margin: 8px 0 !important; }
.size-choice input { margin-top: 3px; }
.req { color: var(--red); }
.field-error { color: var(--red); font-size: .9rem; margin: 6px 0 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Buttons */
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 9px 18px; border-radius: 8px; border: 1px solid #c9c2b6; background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { background: #f3efe8; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--orange); border-color: var(--orange); color: #1a1a1a; }
.btn-primary:hover { background: #ea8410; }
.btn-approve { background: var(--green); border-color: var(--green); color: #fff; }
.btn-approve:hover { background: #18723e; }
.btn-reject { background: #fff; border-color: var(--red); color: var(--red); }
.btn-reject:hover { background: #fdecea; }
.btn-lg { padding: 12px 24px; font-size: 1.05rem; margin-top: 24px; }
.btn-small { padding: 5px 12px; font-size: .9rem; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* Alerts & badges */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: #e9f7ef; border-color: #b7e2c6; color: #14532d; }
.alert-error { background: #fdecea; border-color: #f5c2bd; color: #7a1a12; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.badge-pending { background: #fff3db; color: var(--amber); }
.badge-approved { background: #e3f4ea; color: var(--green); }
.badge-rejected { background: #fdecea; color: var(--red); }
.ref-tag { font-size: .78rem; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.dpi { font-size: .8rem; font-weight: 700; margin-left: 6px; }
.dpi.ok { color: var(--green); } .dpi.warn { color: var(--amber); } .dpi.bad { color: var(--red); }

/* Public upload page */
.sizes { width: 100%; border-collapse: collapse; font-size: .9rem; }
.sizes th, .sizes td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.size-demo { display: flex; gap: 12px; margin: 16px 0 4px; }
.size-demo .pg { width: 60px; aspect-ratio: 8.5 / 11; border: 2px solid var(--ink); border-radius: 2px; padding: 4px; display: grid; gap: 3px; }
.size-demo .pg span { background: #fde3c2; display: grid; place-items: center; font-size: .7rem; font-weight: 700; }
.size-demo .split-h { grid-template-rows: 1fr 1fr; }
.size-demo .split-q { grid-template: 1fr 1fr / 1fr 1fr; }
.confirm { text-align: center; max-width: 640px; margin: 24px auto; }
.confirm .tick { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--green); color: #fff; font-size: 36px; line-height: 64px; }
.confirm .ref { font-size: 1.15rem; background: var(--bg); border-radius: 8px; padding: 10px; }

/* Admin list */
.search { display: flex; gap: 8px; }
.search input { min-width: 260px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 16px; border-radius: 8px; text-decoration: none; color: var(--ink); background: #fff; border: 1px solid var(--line); font-weight: 600; }
.tabs a.on { border-color: var(--orange); box-shadow: inset 0 -3px 0 var(--orange); }
.tabs .count { color: var(--muted); font-weight: 500; }
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .92rem; }
.list th { background: #f6f2eb; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.thumb-cell img, .thumb-cell canvas { width: 80px; height: 100px; object-fit: contain; background: #f3f3f3; border: 1px solid var(--line); display: block; }

/* Review page */
.review { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: 20px; align-items: start; }
.preview-box img { max-width: 100%; max-height: 80vh; display: block; margin: 0 auto; background: repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0 / 20px 20px; }
.preview-box iframe { width: 100%; height: 80vh; border: 1px solid var(--line); }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.notes { background: var(--bg); padding: 10px 12px; border-radius: 8px; margin: 0; }
.card.danger { border-color: #f5c2bd; }

/* Book layout */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; position: sticky; top: 0; z-index: 5; }
.toolbar .spacer { flex: 1; }
.toolbar label.choice { margin: 0 6px 0 0; }
.save-state { font-size: .85rem; color: var(--green); }
.save-state.unsaved { color: var(--amber); font-weight: 600; }
.progress[hidden] { display: none; }
.progress { display: flex; align-items: center; gap: 12px; margin: -8px 0 16px; font-size: .9rem; }
.progress .bar { flex: 0 0 240px; height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress .bar span { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.book { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.order-panel { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.order-list { list-style: none; margin: 12px 0 0; padding: 0; }
.order-item { display: grid; grid-template-columns: 44px 1fr auto 20px; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-left: 5px solid #ccc; border-radius: 8px; margin-bottom: 6px; background: #fff; cursor: grab; }
.order-item.size-full { border-left-color: var(--blue); }
.order-item.size-half { border-left-color: var(--orange); }
.order-item.size-quarter { border-left-color: var(--green); }
.order-item .mini { width: 44px; height: 56px; object-fit: contain; background: #f3f3f3; }
.order-item .info { min-width: 0; display: flex; flex-direction: column; }
.order-item .info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9rem; }
.order-item select { width: auto; padding: 4px 6px; font-size: .85rem; }
.order-item .grip { color: #aaa; font-size: 1.2rem; }
.drag-ghost { opacity: .4; background: #fde3c2; }
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; }
.page-fig { margin: 0; }
.page-fig figcaption { text-align: center; font-size: .8rem; color: var(--muted); margin-top: 4px; }
.page { position: relative; aspect-ratio: 8.5 / 11; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 6px 16px rgba(0,0,0,.06); }
.slot { position: absolute; display: flex; align-items: center; justify-content: center; }
.slot img { max-width: 100%; max-height: 100%; object-fit: contain; }
.slot img.broken { width: 100%; height: 100%; background: #fdecea; }
.slot.empty { border: 1px dashed #d7d0c4; color: #c0b8aa; font-size: .7rem; }
.guides .slot:not(.empty) { outline: 1px solid #9aa4b8; }
.slot-tag { position: absolute; top: 2px; left: 2px; font-size: .6rem; background: rgba(0,0,0,.6); color: #fff; padding: 0 4px; border-radius: 3px; font-family: ui-monospace, Menlo, monospace; }
.page-num { position: absolute; bottom: 1.2%; left: 0; right: 0; text-align: center; font-size: .6rem; color: #888; }
.page.cover { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 10%; text-align: center; }
.page.cover img { width: 90%; margin-bottom: 18%; }
.page.cover h3 { margin: 0; font-size: 1rem; }
.page.cover p { margin: 4px 0 0; font-size: .7rem; color: var(--muted); }

@media (max-width: 900px) {
  .grid-2, .review, .book { grid-template-columns: 1fr; }
  .order-panel { position: static; max-height: none; }
  .search input { min-width: 0; }
  .search { width: 100%; }
}
@media (max-width: 560px) {
  .row-2 { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  .hero h1 { font-size: 1.6rem; }
  .toolbar { position: static; }
}
