:root {
  --bg-light: #eeeeee;
  --bg-header: #d5dce1;
  --bg-card: #bcb7b5;
  --text-dark: #1e1d1d;
  --text-light: #3d3c40;
  --accent: #3d3c40;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', sans-serif;
}

body {
  background: var(--bg-light);
  color: var(--text-dark);
  padding-bottom: 5rem;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ------------------- ХЕДЕР ------------------- */
header {
  background: var(--bg-header);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 2px solid var(--accent);
}

header h1 {
  font-size: 1.5rem;
  color: var(--text-dark);
}

nav button {
  background: none;
  border: none;
  margin-left: 1rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: color 0.2s ease;
  
  outline: none !important;
  box-shadow: none !important;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

nav button:hover {
  color: var(--accent);
}

/* ------------------- ФІЛЬТРИ ------------------- */
#filters {
  display: flex;
  gap: 1rem;
  padding: 1rem 2rem;
  background-color: var(--bg-header);
  border-bottom: 1px solid #ccc;
}

#filters input,
#filters select {
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: white;
  color: var(--text-dark);
}

/* ------------------- КАТАЛОГ ------------------- */
main#bookList {
  padding: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

main#bookList.books-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
}

main#bookList.profile-view {
  display: flex;
  justify-content: center;
  padding: 2rem;
}

.book-card {
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}
.book-card:hover {
  transform: translateY(-4px);
}

.book-card h3 {
  margin-bottom: 0.25rem;
  color: var(--text-dark);
}

.book-card p {
  margin-bottom: 0.5rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.stars {
  font-size: 1.1rem;
  color: #ccc;
  margin-bottom: 0.5rem;
}
.stars span {
  cursor: pointer;
}
.stars span:hover,
.stars span:hover ~ span {
  color: gold;
}

.book-card button {
  padding: 0.4rem 0.8rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.book-card button:hover {
  background: #2a2a2a;
}

/* ------------------- ПРОФІЛЬ ------------------- */
.profile-panel {
  flex: 1;
  background: var(--bg-card);
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  color: var(--text-dark);
  min-width: 0;
  padding: 2rem 2.5rem;
}

.profile-panel h2 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  text-align: center;
}

.profile-panel ul {
  list-style: none;
  padding: 0;
}

.profile-panel li {
  font-size: 1.1rem;
  margin: 0.6rem 0;
}

/* ------------------- НІЧНИЙ РЕЖИМ ------------------- */
body.dark-mode {
  background-color: #121212;
  color: #f0f0f0;
}

body.dark-mode .status-select {
  background-color: #2d2d2d;
  color: #eee;
  border: 1px solid #666;
}

/* Хедер */
body.dark-mode header {
  background: #2a2a2a;
  border-bottom: 2px solid #444;
}
body.dark-mode header h1,
body.dark-mode nav button {
  color: #eee;
}
body.dark-mode nav button:hover {
  color: gold;
}

/* Фільтри */
body.dark-mode #filters {
  background-color: #2a2a2a;
  border-bottom: 1px solid #444;
}
body.dark-mode #filters input,
body.dark-mode #filters select {
  background-color: #3a3a3a;
  color: #eee;
  border: 1px solid #666;
}

/* Картки */
body.dark-mode .book-card {
  background-color: #1f1f1f;
  border: 1px solid #2c2c2c;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  color: #e0e0e0;
}

body.dark-mode .book-card h3 {
  color: #ffffff;
}
body.dark-mode .book-card p {
  color: #cccccc;
}


body.dark-mode select,
body.dark-mode button {
  background-color: #2d2d2d;
  color: #f0f0f0;
  border: 1px solid #555;
}
body.dark-mode button:hover {
  background-color: #3d3d3d;
}

/* Профіль */
body.dark-mode .profile-panel {
  background-color: #2a2a2a;
  color: #eee;
}
body.dark-mode .profile-panel li {
  color: #ccc;
}

/* ------------------- КНОПКА ТЕМИ ------------------- */
.theme-toggle {
  display: inline-block;
  background: #3d3c40;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
  transition: background 0.2s ease, color 0.2s ease;
  margin-left: 1rem;
}

.theme-toggle:hover {
  background: #555;
}

body.dark-mode .theme-toggle {
  background: #eee;
  color: #1e1d1d;
}

body.dark-mode #currentUserDisplay {
  color: #f0f0f0;
  font-weight: bold;
}

body.dark-mode .stars {
  color: #777;
}
body.dark-mode .stars span:hover,
body.dark-mode .stars span:hover ~ span {
  color: gold;
}

nav button {
  outline: none !important;
  box-shadow: none !important;
  user-select: none;
}

nav button:focus,
nav button:focus-visible,
nav button:active {
  outline: none !important;
  box-shadow: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
}

#currentUserDisplay {
  color: var(--text-dark);
  font-weight: 600;
}

body.dark-mode #currentUserDisplay {
  color: #fff !important;
}

.profile-panel canvas {
  display: block;
  max-width: 100%;
  margin: 0 auto;
}

.profile-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 2rem;
  width: auto;
  margin-left: auto;
  margin-right: auto;
  padding: 2rem;
  max-width: 1000px;
  flex-wrap: nowrap;
}

.top-books {
  margin-top: 2rem;
}

.top-books h3 {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.top-books-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.top-book-card {
  background: #fff;
  padding: 0.8rem;
  font-size: 0.9rem;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-align: center;
}

body.dark-mode .top-book-card {
  background-color: #2a2a2a;
  color: #eee;
}

.top-books-list.horizontal {
  flex-direction: row;
  justify-content: space-between;
  gap: 1rem;
}

.top-book-card {
  flex: 1;
  min-width: 100px;
}

.status-select {
  padding: 6px 10px;
  border: 1px solid #888;
  border-radius: 5px;
  background-color: white;
  color: #333;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  width: 100%;
  outline: none;
  cursor: pointer;
  transition: border 0.2s ease, box-shadow 0.2s ease;
}

.status-select:hover {
  border-color: #666;
}

.status-select:focus {
  border-color: #555;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}

.right-panel {
  flex: 0 0 280px;
  max-width: 280px;
  min-width: 260px;
  background: var(--bg-card);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  font-size: 0.95rem;
}
.right-panel h3 {
  margin-bottom: 0.5rem;
}
.right-panel .recent-read {
  list-style: none;
  padding-left: 0;
}
.right-panel .recent-read li {
  margin-bottom: 6px;
}
.quote {
  font-style: italic;
  color: var(--text-light);
  border-left: 4px solid #888;
  padding-left: 10px;
}

body.dark-mode .right-panel {
  background: #2a2a2a;
  color: #eee;
}
body.dark-mode .quote {
  color: #ccc;
  border-left: 4px solid #555;
}
