/* ePustak Modern Dark/Light Theme */
:root {
  --bg-main: #0a0a0c;
  --bg-card: #131317;
  --border: #22222a;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body.light-theme {
  --bg-main: #f9fafb;
  --bg-card: #ffffff;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --text-main: #111827;
  --text-muted: #6b7280;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Nav */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-main);
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--text-main); font-weight: bold; font-size: 1.25rem; }
.brand .logo-badge { background: var(--accent); color: #fff; padding: 0.25rem 0.6rem; border-radius: 6px; font-size: 0.9rem; }
.nav-links { display: flex; gap: 1.5rem; align-items: center; }
.nav-links a { text-decoration: none; color: var(--text-muted); font-size: 0.9rem; transition: color 0.2s; }
.nav-links a:hover { color: var(--text-main); }
.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.85rem;
  display: inline-block;
  transition: background 0.2s;
}
.btn:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: var(--bg-card); }

/* Main Container */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; flex: 1; width: 100%; }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1.5rem; }
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, border-color 0.2s;
}
.card:hover { transform: translateY(-4px); border-color: var(--accent); }
.card-img-wrapper { position: relative; aspect-ratio: 2/3; width: 100%; background: #000; overflow: hidden; }
.card-img { width: 100%; height: 100%; object-fit: cover; }
.card-content { padding: 1rem; flex: 1; display: flex; flex-direction: column; justify-content: space-between; }
.card-title { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.25rem; }
.card-author { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.75rem; }

/* Progress Bar */
.progress-container { width: 100%; background: var(--border); height: 6px; border-radius: 3px; overflow: hidden; margin-top: 0.5rem; }
.progress-fill { height: 100%; background: var(--accent); }

/* Reader Shell */
.reader-body { overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
.reader-header {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  background: var(--bg-main);
  user-select: none;
}
.viewer-frame { flex: 1; position: relative; overflow: hidden; display: flex; justify-content: center; align-items: center; }
#pdf-canvas { max-width: 100%; max-height: calc(100vh - 100px); box-shadow: 0 10px 25px rgba(0,0,0,0.5); }
#epub-area { width: 100%; height: 100%; }

/* Footer */
footer { text-align: center; padding: 2rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; }
