/* ── Reset & base ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --clr-bg:      #f4f6f8;
  --clr-surface: #ffffff;
  --clr-primary: #0078d4;
  --clr-text:    #1a1a1a;
  --clr-muted:   #6b7280;
  --radius:      10px;
  --shadow:      0 1px 4px rgba(0,0,0,.08);
}

html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Header ─────────────────────────────────────────────────────── */
header {
  background: var(--clr-primary);
  color: #fff;
  padding: 1rem 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}
#logo { height: 48px; width: auto; }
header h1 { font-size: 1.25rem; font-weight: 600; }

/* ── Main ───────────────────────────────────────────────────────── */
main {
  flex: 1;
  padding: 1rem;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* ── Loading / error ────────────────────────────────────────────── */
#loading, #error { text-align: center; padding: 2rem 0; color: var(--clr-muted); }
#error { color: #b91c1c; }
.hidden { display: none !important; }

/* ── PDF list ───────────────────────────────────────────────────── */
#pdf-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.pdf-card {
  background: var(--clr-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow .15s, transform .15s;
}
.pdf-card:hover  { box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.pdf-card:active { transform: scale(.98); }

.pdf-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  background: #e8f0fe;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--clr-primary);
}

.pdf-info { flex: 1; min-width: 0; }
.pdf-name {
  font-weight: 600;
  font-size: .95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdf-meta {
  font-size: .8rem;
  color: var(--clr-muted);
  margin-top: .15rem;
}

.pdf-card .btn-download {
  flex-shrink: 0;
  padding: .5rem .75rem;
  font-size: .85rem;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.btn-download {
  background: var(--clr-primary);
  color: #fff;
  padding: .45rem .9rem;
}
.btn-download:hover { background: #005fa3; }

.btn-close {
  background: transparent;
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  padding: .25rem .5rem;
}
.btn-close:hover { background: rgba(255,255,255,.15); border-radius: 6px; }

/* ── Viewer overlay ─────────────────────────────────────────────── */
#viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--clr-bg);
  display: flex;
  flex-direction: column;
}

#viewer-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #1a1a1a;
  color: #fff;
  padding: .65rem 1rem;
}
#viewer-title {
  flex: 1;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#viewer-actions { display: flex; gap: .5rem; align-items: center; }

#viewer-frame {
  flex: 1;
  border: none;
  width: 100%;
}

/* ── Desktop tweaks ─────────────────────────────────────────────── */
@media (min-width: 600px) {
  main { padding: 1.5rem; }
  header h1 { font-size: 1.5rem; }
  .pdf-card { padding: 1rem 1.5rem; }
}
