/* ========================================================= */
/* ===================== DESIGN TOKENS ====================== */
/* ========================================================= */

:root {
  --scale: 1.15;

  /* COLORS */
  --bg: #F3F3E8;
  --text: #0C326A;
  --text-muted: rgba(37, 42, 54, 0.65);
  --border: rgba(37, 42, 54, 0.15);
  --border-light: rgba(37, 42, 54, 0.08);

  --primary: #0C326A;
  --primary-dark: #1b1f29;
  --surface: #ffffff;

  --badge-bg: rgba(243, 243, 232, 0.95);

  /* OPTIONAL ACCENT */
  --accent: #CBA35C;

  /* SHADOWS */
  --shadow-sm: 0 2px 6px rgba(0,0,0,0.08);
  --shadow-md: 0 6px 18px rgba(0,0,0,0.12);
  --shadow-lg: 0 12px 28px rgba(0,0,0,0.18);

  /* RADIUS */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* SPACING */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 20px;

  /* TRANSITIONS */
  --transition: 0.2s ease;
}

/* GLOBAL SMOOTHNESS */
* {
  transition:
    transform var(--transition),
    box-shadow var(--transition),
    background var(--transition),
    color var(--transition),
    border var(--transition);
}

/* ========================================================= */
/* ========================= BASE =========================== */
/* ========================================================= */

body {
  font-family: "Manrope", "Inter", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 20px;

  font-weight: 600;
  letter-spacing: 0.2px;
}

h1 {
  font-weight: 800;
  letter-spacing: -0.5px;
}

h2 {
  font-weight: 700;
  letter-spacing: -0.3px;
}

/* ========================================================= */
/* ======================== HEADER ========================== */
/* ========================================================= */

.header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header h1 {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
}

/* BUTTON FIXED RIGHT */
.request-btn {
  position: absolute;
  right: 0;

  background: #252A36;
  color: var(--bg);

  border: none;
  border-radius: var(--radius-md);

  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;

  cursor: pointer;
  transition: var(--transition);

  width: auto;
}

.request-btn:hover {
  background: var(--primary-dark);
}

/* ========================================================= */
/* ======================== SEARCH ========================== */
/* ========================================================= */

#search {
  padding: 10px;
  width: 100%;
  margin-bottom: var(--space-lg);

  border-radius: var(--radius-md);
  outline: none;

  background: var(--surface);
  color: var(--text);

  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

#search::placeholder {
  color: rgba(37, 42, 54, 0.5);
}

/* ========================================================= */
/* ========================= GRID =========================== */
/* ========================================================= */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: var(--space-lg);
}

/* ========================================================= */
/* ======================= BOOK CARD ======================== */
/* ========================================================= */

.book {
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;

  display: flex;
  flex-direction: column;
  position: relative;

  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.book:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: var(--shadow-md);
  border-color: var(--border);
}

/* COVER */
.book img {
  width: 100%;
  height: 220px;

  object-fit: cover;
  object-position: center;

  background: #e6e6dc;
}

.book img.loaded {
  opacity: 1;
}

/* INFO */
.info {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.info h3 {
  font-size: 13px;
  margin-bottom: 6px;
  line-height: 1.2;

  font-weight: 700;
  color: var(--text);

  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.author {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;

  font-weight: 400;
}

/* BUTTONS */
.buttons {
  margin-top: auto;
}

button {
  width: 100%;
  padding: 6px;

  border: none;
  border-radius: var(--radius-sm);

  font-weight: 700;
  letter-spacing: 0.3px;

  background: var(--primary);
  color: var(--bg);

  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

button:active,
.tab:active {
  transform: scale(0.95);
}

/* ========================================================= */
/* ========================= BADGE ========================== */
/* ========================================================= */

.badge {
  position: absolute;
  top: 8px;
  left: 8px;

  background: var(--badge-bg);
  color: var(--text);

  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;

  border-radius: var(--radius-sm);

  border: 1px solid var(--border);

  z-index: 3;
  pointer-events: none;
}

/* ========================================================= */
/* ========================== TABS ========================== */
/* ========================================================= */

.tabs {
  display: flex;
  gap: 12px;

  width: 100%;
  margin: 0 auto 20px;
  padding: 0 10px 6px;

  overflow-x: auto;
  flex-wrap: nowrap;
}

/* SCROLLBAR */
.tabs::-webkit-scrollbar {
  height: 4px;
}
.tabs::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
}

/* TAB */
.tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);

  border-radius: var(--radius-pill);

  cursor: pointer;

  font-size: 13px;
  text-align: center;

  padding: 10px 16px;

  white-space: nowrap;

  display: flex;
  align-items: center;
  justify-content: center;

  font-weight: 600;

  box-shadow: var(--shadow-sm);
}

/* HOVER */
.tab:hover {
  background: #e9e9de;
  color: var(--text);

  transform: translateY(-2px);
}

/* ACTIVE */
.tab.active {
  background: var(--primary);
  color: var(--bg);

  font-weight: 700;
  box-shadow: var(--shadow-md);
}

/* ========================================================= */
/* ======================== EMPTY =========================== */
/* ========================================================= */

.empty {
  text-align: center;
  padding: 40px;
  opacity: 0.6;
}

/* ========================================================= */
/* ======================== CREDITS ========================= */
/* ========================================================= */

.credits {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);

  display: inline-flex;
  align-items: center;
  gap: 6px;

  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.35px;
  text-transform: uppercase;

  color: rgba(37, 42, 54, 0.6);
  background: rgba(243, 243, 232, 0.75);

  padding: 6px 12px;
  border-radius: var(--radius-pill);

  backdrop-filter: blur(6px);

  z-index: 100;
}

.credits a {
  color: var(--text);
  text-decoration: none;
  font-weight: 1000;
}

.credits:hover {
  background: rgba(243, 243, 232, 0.9);
  transform: translateX(-50%) translateY(-2px);
}

.credits:hover a {
  text-decoration: underline;
}