/* =========================================================
   PDF Library — Library theme (light + dark)
   ========================================================= */

:root {
  --bg: #f5f7fb;
  --card: rgba(255, 255, 255, 0.82);
  --text: #172033;
  --muted: #697386;
  --primary: #635bff;
  --primary-dark: #5048d9;
  --border: rgba(20, 30, 50, 0.08);
  --shadow: 0 12px 35px rgba(31, 41, 55, 0.08);
  --icon-bg: linear-gradient(135deg, #ef4444, #dc2626);
  --icon-shadow: 0 8px 20px rgba(220, 38, 38, 0.2);
}

html[data-theme="dark"] {
  --bg: #0b1020;
  --card: rgba(20, 27, 45, 0.78);
  --text: #e6eaf2;
  --muted: #9aa6bf;
  --primary: #8b84ff;
  --primary-dark: #6f67ff;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
  --icon-bg: linear-gradient(135deg, #f87171, #dc2626);
  --icon-shadow: 0 8px 20px rgba(220, 38, 38, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(99, 91, 255, 0.14), transparent 30%),
    radial-gradient(circle at 90% 90%, rgba(14, 165, 233, 0.12), transparent 30%),
    var(--bg);
  transition: background 0.25s ease, color 0.25s ease;
}

.container {
  width: min(100% - 32px, 1000px);
  margin: 0 auto;
  padding: 70px 0;
}

.hero {
  text-align: center;
  margin-bottom: 45px;
  position: relative;
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(99, 91, 255, 0.15);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  backdrop-filter: blur(10px);
}

html[data-theme="dark"] .badge {
  background: rgba(20, 27, 45, 0.7);
  border-color: rgba(99, 91, 255, 0.25);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border);
  color: var(--text);
  backdrop-filter: blur(10px);
  transition: background 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); }
html[data-theme="dark"] .theme-toggle { background: rgba(20, 27, 45, 0.7); }
.theme-toggle svg { width: 18px; height: 18px; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

.hero h1 {
  font-size: clamp(34px, 6vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.045em;
  margin-bottom: 15px;
}

.hero h1 span { color: var(--primary); }

.hero p {
  max-width: 600px;
  margin: auto;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
  margin-bottom: 22px;
}

.search-wrap {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
}
.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
#searchInput {
  width: 100%;
  padding: 12px 16px 12px 46px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  font-size: 15px;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
html[data-theme="dark"] #searchInput { background: rgba(20, 27, 45, 0.7); }
#searchInput::placeholder { color: var(--muted); }
#searchInput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 91, 255, 0.15);
}

.stats {
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
  color: var(--muted);
  font-size: 14px;
}

.subject-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.pdf-list {
  display: grid;
  gap: 14px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  backdrop-filter: blur(10px);
  transition: background 0.2s ease, transform 0.2s ease;
}
.back-btn:hover { background: var(--primary); color: #fff; transform: translateY(-1px); }

.folder-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 8px 20px rgba(217, 119, 6, 0.25);
}

.pdf-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.pdf-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99, 91, 255, 0.25);
  box-shadow: 0 18px 45px rgba(31, 41, 55, 0.12);
}

.subject-card { cursor: pointer; }

.pdf-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: var(--icon-bg);
  box-shadow: var(--icon-shadow);
}
.pdf-icon span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.pdf-details {
  min-width: 0;
  flex: 1;
}
.pdf-details h2 {
  font-size: 16px;
  line-height: 1.45;
  font-weight: 700;
  word-break: break-word;
}
.pdf-details p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.open-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 16px;
  border-radius: 12px;
  color: white;
  background: var(--primary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.2s ease, transform 0.2s ease;
}
.open-button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.arrow {
  font-size: 17px;
  line-height: 1;
}

.empty-state {
  padding: 60px 25px;
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: 22px;
  background: var(--card);
  backdrop-filter: blur(18px);
}
.empty-icon {
  font-size: 45px;
  margin-bottom: 15px;
}
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); }

footer {
  padding-top: 35px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 600px) {
  .container { padding: 45px 0; }
  .pdf-card {
    padding: 14px;
    border-radius: 17px;
  }
  .pdf-icon {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    border-radius: 13px;
  }
  .pdf-details h2 { font-size: 14px; }
  .open-button {
    padding: 9px 11px;
    font-size: 13px;
  }
  .open-button span:first-child { display: none; }
  .arrow { font-size: 19px; }
  .hero-top { justify-content: center; }
  .theme-toggle { position: absolute; top: 0; right: 0; }
}