
:root {
  --pdf-card-radius: 26px;
  --pdf-viewer-radius: 28px;
  --pdf-shadow: 0 18px 48px rgba(21, 28, 55, 0.12);
  --pdf-shadow-strong: 0 24px 80px rgba(15, 23, 42, 0.18);
  --pdf-border: rgba(15, 23, 42, 0.08);
  --pdf-muted: rgba(35, 39, 58, 0.62);
  --pdf-surface-soft: rgba(255, 255, 255, 0.75);
  --pdf-brand: #DF3B3A;
}

html[data-theme="dark"] {
  --pdf-border: rgba(255, 255, 255, 0.08);
  --pdf-muted: rgba(241, 245, 249, 0.68);
  --pdf-surface-soft: rgba(15, 23, 42, 0.72);
}

body {
  background:
    radial-gradient(circle at 20% 10%, rgba(223, 59, 58, 0.08), transparent 30%),
    radial-gradient(circle at 80% 18%, rgba(124, 58, 237, 0.08), transparent 24%),
    var(--background);
}

.pdf-nav-username {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
}

.pdf-hero {
  position: relative;
  overflow: hidden;
  padding: 156px 0 72px;
}

.pdf-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pdf-hero-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.5;
}

.pdf-hero-orb-a {
  width: 260px;
  height: 260px;
  left: -80px;
  top: 18%;
  background: rgba(223, 59, 58, 0.18);
}

.pdf-hero-orb-b {
  width: 220px;
  height: 220px;
  right: -60px;
  top: 8%;
  background: rgba(124, 58, 237, 0.18);
}

.pdf-hero-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(15, 23, 42, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, 0.03) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 85%);
}

html[data-theme="dark"] .pdf-hero-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
}

.pdf-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 860px;
}

.pdf-hero-tag {
  justify-content: center;
  width: fit-content;
  margin-bottom: 22px;
}

.pdf-hero-title {
  margin: 0 0 18px;
  font-size: clamp(2.5rem, 6vw, 4.7rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
  font-weight: 900;
  color: var(--text);
}

.pdf-hero-desc {
  max-width: 760px;
  font-size: 1.08rem;
  line-height: 1.8;
  color: var(--text-muted);
  margin: 0;
}

.pdf-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.pdf-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--pdf-border);
  background: var(--pdf-surface-soft);
  backdrop-filter: blur(12px);
  box-shadow: var(--pdf-shadow);
  font-weight: 700;
  color: var(--text);
}

.pdf-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.pdf-filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pdf-filter-btn {
  border: 1px solid var(--pdf-border);
  background: var(--card-bg);
  color: var(--text);
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}

.pdf-filter-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--pdf-shadow);
}

.pdf-filter-btn.is-active {
  background: linear-gradient(135deg, rgba(223, 59, 58, 0.95), rgba(124, 58, 237, 0.95));
  border-color: transparent;
  color: #fff;
}

.pdf-search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: min(100%, 340px);
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--pdf-border);
  background: var(--card-bg);
  min-height: 52px;
  color: var(--text-muted);
  box-shadow: var(--pdf-shadow);
}

.pdf-search-box input {
  border: none;
  outline: none;
  width: 100%;
  background: transparent;
  color: var(--text);
  font: inherit;
}

.pdf-list-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.pdf-list-title {
  margin-bottom: 8px;
}

.pdf-list-subtitle {
  max-width: 720px;
  margin: 0;
}

.pdf-list-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-weight: 700;
}

.pdf-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.pdf-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border-radius: var(--pdf-card-radius);
  border: 1px solid var(--pdf-border);
  background: var(--card-bg);
  overflow: hidden;
  box-shadow: var(--pdf-shadow);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.pdf-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--pdf-shadow-strong);
  border-color: rgba(223, 59, 58, 0.18);
}

.pdf-card-cover {
  position: relative;
  min-height: 220px;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(236, 241, 248, 0.96));
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.pdf-card-cover.is-loaded {
  min-height: 0;
}

html[data-theme="dark"] .pdf-card-cover {
  background:
    linear-gradient(180deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.98));
}

.pdf-card-cover canvas {
  width: 100%;
  height: auto;
  display: block;
}

.pdf-card-cover .pdf-card-placeholder {
  width: 100%;
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.pdf-card-badge {
  position: absolute;
  left: 18px;
  top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--pdf-brand);
  font-size: 0.83rem;
  font-weight: 800;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
}

html[data-theme="dark"] .pdf-card-badge {
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
}

.pdf-card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  flex: 1;
}

.pdf-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.pdf-card-title {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.35;
  font-weight: 900;
  color: var(--text);
}

.pdf-card-desc {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.72;
  font-size: 0.96rem;
}

.pdf-card-actions {
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.pdf-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--pdf-border);
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.pdf-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--pdf-shadow);
}

.pdf-btn-primary {
  background: linear-gradient(135deg, rgba(223, 59, 58, 0.96), rgba(124, 58, 237, 0.96));
  color: #fff;
  border-color: transparent;
}

.pdf-empty {
  grid-column: 1 / -1;
  padding: 56px 22px;
  text-align: center;
  border: 1px dashed var(--pdf-border);
  border-radius: var(--pdf-card-radius);
  color: var(--text-muted);
  font-weight: 700;
}

.pdf-viewer-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 22, 0.72);
  backdrop-filter: blur(10px);
  padding: 18px;
  z-index: 20000;
  display: none;
}

.pdf-viewer-modal.is-open {
  display: block;
}

.pdf-viewer-shell {
  width: min(100%, 1540px);
  height: min(100%, calc(100vh - 36px));
  margin: 0 auto;
  background: var(--card-bg);
  border: 1px solid var(--pdf-border);
  border-radius: var(--pdf-viewer-radius);
  box-shadow: var(--pdf-shadow-strong);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pdf-viewer-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--pdf-border);
}

.pdf-viewer-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--pdf-brand);
  background: rgba(223, 59, 58, 0.08);
}

html[data-theme="dark"] .pdf-viewer-kicker {
  color: #fff;
  background: rgba(223, 59, 58, 0.18);
}

.pdf-viewer-title {
  margin: 8px 0 0;
  font-size: 1.22rem;
  line-height: 1.35;
  font-weight: 900;
  color: var(--text);
}

.pdf-viewer-topbar-right {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-icon-btn,
.pdf-tool-btn {
  border: 1px solid var(--pdf-border);
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}

.pdf-icon-btn:hover,
.pdf-tool-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--pdf-shadow);
}

.pdf-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.pdf-close-btn {
  color: #fff;
  background: linear-gradient(135deg, rgba(223, 59, 58, 0.96), rgba(124, 58, 237, 0.96));
  border-color: transparent;
}

.pdf-viewer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--pdf-border);
  flex-wrap: wrap;
}

.pdf-toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pdf-tool-btn {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pdf-page-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--pdf-border);
  background: var(--card-bg);
}

.pdf-page-field input {
  width: 72px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.pdf-zoom-label {
  min-width: 64px;
  text-align: center;
  font-weight: 800;
  color: var(--text);
}

.pdf-viewer-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 0;
  flex: 1;
}

.pdf-thumbnails {
  border-right: 1px solid var(--pdf-border);
  overflow: auto;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.02), transparent 60%);
}

html[data-theme="dark"] .pdf-thumbnails {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 60%);
}

.pdf-thumb {
  width: 100%;
  border: 1px solid var(--pdf-border);
  background: var(--card-bg);
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 14px;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.pdf-thumb:hover {
  transform: translateY(-2px);
  box-shadow: var(--pdf-shadow);
}

.pdf-thumb.is-active {
  border-color: rgba(223, 59, 58, 0.36);
  box-shadow: 0 0 0 2px rgba(223, 59, 58, 0.12);
}

.pdf-thumb canvas {
  width: 100%;
  display: block;
  border-radius: 12px;
  background: #fff;
}

.pdf-thumb-label {
  display: block;
  margin-top: 10px;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text);
}

.pdf-canvas-stage {
  position: relative;
  min-height: 0;
  overflow: auto;
  background:
    radial-gradient(circle at top, rgba(223, 59, 58, 0.06), transparent 28%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.03), transparent 42%);
}

html[data-theme="dark"] .pdf-canvas-stage {
  background:
    radial-gradient(circle at top, rgba(223, 59, 58, 0.09), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 42%);
}

.pdf-canvas-inner {
  min-height: 100%;
  padding: 26px;
  display: grid;
  place-items: start center;
}

.pdf-canvas-inner canvas {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.16);
}

.pdf-loading {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  text-align: center;
  color: var(--text);
  font-weight: 800;
}

html[data-theme="dark"] .pdf-loading {
  background: rgba(15, 23, 42, 0.68);
}

.pdf-loading.is-visible {
  display: grid;
}

.pdf-spinner {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 4px solid rgba(223, 59, 58, 0.16);
  border-top-color: var(--pdf-brand);
  animation: pdfSpin 0.9s linear infinite;
}

@keyframes pdfSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1200px) {
  .pdf-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pdf-viewer-body {
    grid-template-columns: 180px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .pdf-hero {
    padding: 132px 0 54px;
  }

  .pdf-card-grid {
    grid-template-columns: 1fr;
  }

  .pdf-viewer-modal {
    padding: 0;
  }

  .pdf-viewer-shell {
    width: 100%;
    height: 100%;
    border-radius: 0;
  }

  .pdf-viewer-body {
    grid-template-columns: 1fr;
    grid-template-rows: 168px minmax(0, 1fr);
  }

  .pdf-thumbnails {
    border-right: none;
    border-bottom: 1px solid var(--pdf-border);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(120px, 140px);
    overflow-x: auto;
    overflow-y: hidden;
    align-items: start;
  }

  .pdf-thumb {
    margin-bottom: 0;
    margin-right: 10px;
  }

  .pdf-viewer-topbar,
  .pdf-viewer-toolbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .pdf-canvas-inner {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .pdf-toolbar,
  .pdf-list-header {
    align-items: stretch;
  }

  .pdf-search-box {
    min-width: 100%;
  }

  .pdf-viewer-toolbar {
    gap: 10px;
  }

  .pdf-toolbar-group {
    width: 100%;
  }

  .pdf-tool-btn,
  .pdf-page-field {
    flex: 1;
    justify-content: center;
  }

  .pdf-page-field input {
    width: 56px;
  }
}


@media (max-width: 900px) {
  .pdf-card-cover {
    min-height: 190px;
  }

  .pdf-card-cover .pdf-card-placeholder {
    min-height: 190px;
  }
}
