@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@600;700&family=Space+Grotesk:wght@400;500;600&display=swap');

:root {
  --bg: #0b0f14;
  --bg-soft: #121826;
  --accent: #e50914;
  --accent-2: #f5b942;
  --text: #f4f6fb;
  --muted: #a6b0c3;
  --card: #1a2336;
  --glass: rgba(20, 28, 44, 0.75);
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Space Grotesk', sans-serif;
  background: radial-gradient(circle at top left, #1c2740 0%, #0b0f14 55%);
  color: var(--text);
  min-height: 100vh;
}

.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px;
}

.login-card {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 32px;
  width: min(420px, 100%);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), #ff6b6b);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 20px;
}

.brand-text h1 {
  font-family: 'Playfair Display', serif;
  margin: 0 0 4px;
}

.brand-text p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 12px;
}

label { font-size: 14px; color: var(--muted); }

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(9, 13, 22, 0.6);
  color: var(--text);
  font-family: inherit;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(229, 9, 20, 0.3); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.hint { font-size: 12px; color: var(--muted); }

.alert {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.alert.error { background: rgba(229, 9, 20, 0.15); border: 1px solid rgba(229, 9, 20, 0.4); }
.alert.success { background: rgba(46, 196, 182, 0.15); border: 1px solid rgba(46, 196, 182, 0.4); }

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: rgba(8, 11, 18, 0.9);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.logo { font-weight: 700; font-size: 18px; }

.dash-nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 16px;
  font-size: 14px;
}

.dash-nav a.active, .dash-nav a:hover { color: var(--text); }

.dash-main { padding: 32px; }

.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 24px;
}

.hero h1 { font-family: 'Playfair Display', serif; margin: 0 0 8px; font-size: 36px; }
.hero p { color: var(--muted); }

.search-box {
  background: var(--glass);
  padding: 16px;
  border-radius: 16px;
  display: grid;
  gap: 10px;
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.book-card {
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  display: grid;
  grid-template-rows: 160px 1fr;
  border: 1px solid rgba(255,255,255,0.06);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }

.thumb {
  background-size: cover;
  background-position: center;
}

.meta {
  padding: 14px;
  display: grid;
  gap: 8px;
}

.meta h3 { margin: 0; font-size: 16px; }
.meta p { margin: 0; color: var(--muted); font-size: 13px; }

.chip {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  font-size: 12px;
}

.empty-state { padding: 40px; text-align: center; color: var(--muted); }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.7);
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal.open { opacity: 1; pointer-events: auto; }

.modal-content {
  background: var(--bg-soft);
  width: 80vw;
  height: 80vh;
  max-width: 1100px;
  max-height: 820px;
  border-radius: 20px;
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-close {
  position: static;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  flex: 0 0 auto;
}

.modal-body {
  display: grid;
  grid-template-rows: 1fr;
  gap: 0;
  height: 100%;
}

.reader-top {
  display: grid;
  gap: 2px;
}

.reader-top h2,
.reader-top p,
.reader-top .book-meta {
  margin: 0;
  line-height: 1.2;
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-shell {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  height: 100%;
}

.book {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #f6f0e8;
  border-radius: 14px;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  color: #2b2b2b;
  box-shadow: inset 0 0 0 6px #e2d6c6;
}

.page {
  padding: 18px;
  font-family: 'Playfair Display', serif;
  font-size: 14px;
  line-height: 1.4;
}

.page-flip {
  position: absolute;
  top: 0;
  right: 0;
  width: 50%;
  height: 100%;
  background: #f2e7d7;
  transform-origin: left center;
  transform: rotateY(0deg);
  opacity: 0;
  pointer-events: none;
  box-shadow: -10px 0 20px rgba(0,0,0,0.15);
}

.page-flip.flip-right {
  animation: flipRight 0.4s ease;
  opacity: 1;
}

.page-flip.flip-left {
  animation: flipLeft 0.4s ease;
  opacity: 1;
  left: 0;
  right: auto;
  transform-origin: right center;
}

@keyframes flipRight {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(-130deg); }
}

@keyframes flipLeft {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(130deg); }
}

.page-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}

.book-details h2 { margin-top: 0; font-family: 'Playfair Display', serif; }
.book-details p { color: var(--muted); }

.book-meta { margin-top: 10px; font-size: 13px; color: var(--muted); }

.admin-panel {
  background: var(--glass);
  padding: 24px;
  border-radius: 18px;
  margin-bottom: 24px;
}

.admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field.full { grid-column: 1 / -1; }

.admin-list {
  background: var(--glass);
  padding: 24px;
  border-radius: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.mini-card {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  background: rgba(255,255,255,0.05);
  padding: 10px;
  border-radius: 12px;
}

.mini-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  background-size: cover;
  background-position: center;
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .admin-form { grid-template-columns: 1fr; }
}
