:root {
  --bg: #f5f0e8;
  --bg2: #ede7d9;
  --accent: #b5451b;
  --accent-light: rgba(181, 69, 27, 0.1);
  --text: #1a1208;
  --text-sub: #6b5e44;
  --free: #1a7a4a;
  --free-bg: #d4f0e2;
  --surface: #ffffff;
  --border: #d9d0be;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.13);
  --radius: 12px;
  --t: 0.22s ease;
}
body.dark-mode {
  --bg: #0f0e0d;
  --bg2: #181614;
  --accent: #ff6b35;
  --accent-light: rgba(255, 107, 53, 0.12);
  --text: #f0ebe0;
  --text-sub: #9a8f7a;
  --surface: #1c1a18;
  --border: #2e2b27;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --free-bg: #0f2219;
  --free: #4ade80;
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition:
    background-color var(--t),
    color var(--t);
}

/* header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 100px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
}

.nav-btn:hover, .nav-btn.active {
  background: var(--accent);
  color: white; /* text color */
  border-color: var(--accent);
}

.header-badge {
  background: var(--accent);
  color: white;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 100px;
  min-width: 20px;
  text-align: center;
}
.nav-btn.active .header-badge,
.nav-btn:hover .header-badge {
    background: rgba(255,255,255,0.3);
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}

.hero {
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg2) 100%);
  border-bottom: 1px solid var(--border);
  padding: 56px 24px 44px;
  text-align: center;
}

.hero-inner {
  max-width: 700px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  background: var(--free-bg);
  color: var(--free);
  border: 1px solid currentColor;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 14px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.hero-title {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 12px;
}

.hero-title span {
  font-style: italic;
  color: var(--accent);
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-sub);
  margin-bottom: 28px;
  font-weight: 300;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 100px;
  padding: 6px 6px 6px 20px;
  gap: 12px;
  box-shadow: var(--shadow);
  transition:
    border-color var(--t),
    box-shadow var(--t);
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(181, 69, 27, 0.1);
}

.search-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: "DM Sans", sans-serif;
  font-size: 1rem;
  color: var(--text);
  min-width: 0;
}

.search-bar input::placeholder {
  color: var(--text-sub);
}

.books-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 28px;
  grid-template-rows: repeat(auto-fill, minmax(450px, 1fr));
}

.book-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--surface);
  height: 100%;
  overflow: hidden;
  transition: all 0.3s ease;
}

.book-card:hover{
  transform: translateY(-10px);
}

.book-image {
  width: 100%;
  height: 70%;
}

.book-title {
  font-weight: bold;
  margin-left: 5px;
  margin-bottom: 5px;
  overflow: hidden;
}
.book-author {
  margin-left: 5px;
}

.books-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
  position: relative;
}

.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.hero-stats span {
  font-size: 0.9rem;
  color: var(--text-sub);
  font-weight: 500;
}

#loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  width: 100%;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--border);
  border-bottom-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  animation: rotation 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes rotation {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

#loading p {
  color: var(--text-sub);
  font-size: 0.9rem;
}

.controls-bar {
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    position: sticky;
    top: 64px;
    z-index: 90;
    transition: background var(--t);
}

.controls-inner {
    max-width: 1240px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}


.results-info {
    font-size: 0.85rem;
    color: var(--text-sub);
    font-weight: 500;
    white-space: nowrap;
}

.controls-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

 
.control-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    padding: 6px 14px;
    transition: border-color var(--t);
}

.control-wrap:focus-within {
    border-color: var(--accent);
}


.control-wrap label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-sub);
    white-space: nowrap;
}

.control-wrap select {
    border: none;
    outline: none;
    background: transparent;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.83rem;
    color: var(--text);
    cursor: pointer;
    appearance: none;
    padding-right: 4px;
    font-weight: 500;
}

footer{
  display: flex;
  gap: 1rem;
  justify-content: center;
  padding: 2rem;

}
.pagebtn{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  width: 5rem;
  /* text-align: center; */
  font-size: 1rem;
  /* font-weight: 700; */
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var( --text);


}
.pagebtn:hover{
  border-color: var(--accent);
  cursor: pointer;
}
