/* Catppuccin Mocha Dark Theme */

/* Catppuccin Mocha Palette */
:root {
  --base: #1e1e2e;
  --mantle: #181825;
  --crust: #11111b;
  --text: #cdd6f4;
  --subtext: #a6adc8;
  --overlay: #6c7086;
  --surface: #313244;
  --blue: #89b4fa;
  --lavender: #b4befe;
  --pink: #f5c2e7;
  --mauve: #cba6f7;
  --red: #f38ba8;
  --peach: #fab387;
  --yellow: #f9e2af;
  --green: #a6e3a1;
  --teal: #94e2d5;
  --cyan: #89dce7;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 18px;
  line-height: 1.5;
  font-weight: 300;
  color: var(--text);
  font-family: "Nunito Sans", sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--base);
  font-family: "Nunito Sans", sans-serif;
  color: var(--text);
}

a {
  text-decoration: none;
  color: inherit;
}

p {
  margin: 0 0 1rem 0;
  color: var(--subtext);
}

.container {
  max-width: 1500px;
  margin: 24px auto 0;
  padding: 0 24px;
}

/* ===== Header ===== */
.site-header {
  background-color: var(--mantle);
  border-bottom: 1px solid var(--surface);
  padding: 32px 0;
  text-align: center;
}

.site-header h1 {
  font-family: "Poppins", sans-serif;
  font-weight: 900;
  font-size: 2.5rem;
  letter-spacing: 0.1ch;
  color: var(--text);
  margin: 0;
}

.site-header p {
  font-size: 1.1rem;
  color: var(--subtext);
  margin-top: 8px;
}

.heading {
  width: 100%;
  margin: 2rem auto 1rem;
  font-weight: 900;
  font-size: 1.618rem;
  text-transform: uppercase;
  letter-spacing: 0.1ch;
  line-height: 1;
  padding-bottom: 0.5em;
  position: relative;
  font-family: "Poppins", sans-serif;
  color: var(--text);
}

.heading:after {
  display: block;
  content: '';
  position: absolute;
  width: 60px;
  height: 4px;
  background: linear-gradient(135deg, var(--blue), var(--lavender));
  bottom: 0;
  left: 0;
}

/* ===== Footer ===== */
.site-footer {
  background-color: var(--mantle);
  padding: 48px 0;
  text-align: center;
  border-top: 1px solid var(--surface);
  margin-top: 80px;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: center;
  align-items: center;
  margin-bottom: 24px;
}

.site-footer .footer-link {
  color: var(--subtext);
  font-size: 1rem;
  padding: 8px 16px;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.site-footer .footer-link:hover {
  background-color: var(--blue);
  color: var(--base);
}

/* ===== Book Grid ===== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 220px));
  grid-auto-rows: 440px;
  gap: 16px;
  justify-content: center;
  align-content: start;
  margin: 24px auto 48px;
  max-width: 1500px;
  padding: 0 24px;
}

@media screen and (max-width: 800px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 12px;
  }
}

@media screen and (max-width: 500px) {
  .book-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Book Card ===== */
.book-card {
  background-color: var(--mantle);
  border: 1px solid var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  transition: box-shadow 0.3s ease, transform 0.3s ease;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(-4px);
}

.book-card-img {
  width: 180px;
  height: 270px;
  object-fit: cover;
  object-position: center top;
  display: block;
  margin: 16px auto 16px;
  border-radius: 4px;
}

.book-card-placeholder {
  width: 180px;
  height: 270px;
  background-color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--overlay);
  margin: 16px auto 16px;
  border-radius: 4px;
}

.book-card-placeholder i {
  font-size: 3rem;
}

.book-card-body {
  padding: 0 16px 16px;
  min-height: 100px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.book-card-title {
  font-family: "Poppins", sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 8px;
  color: var(--text);
}

.book-card-author {
  font-size: 0.9rem;
  color: var(--subtext);
  margin: 4px 0;
}

.book-card-meta {
  font-size: 0.85rem;
  color: var(--subtext);
  margin: 4px 0;
  display: flex;
  gap: 12px;
  align-items: center;
}

.book-card-meta .status-read {
  color: var(--green);
  font-weight: 600;
}

.book-card-meta .status-toread {
  color: var(--yellow);
  font-weight: 600;
}

.book-card-meta .status-reading {
  color: var(--blue);
  font-weight: 600;
}

.book-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  cursor: pointer;
  font-weight: bold;
  text-align: center;
  text-decoration: none;
  border: none;
  padding: 0.5em 1.2em;
  border-radius: 100px;
  font: inherit;
  transition: 300ms ease;
  font-family: "Poppins", sans-serif;
  font-size: 0.95rem;
}

.btn-primary {
  color: var(--base);
  background: linear-gradient(135deg, var(--blue), var(--lavender));
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--lavender), var(--blue));
  transform: translateY(-2px);
}

.btn-danger {
  color: var(--base);
  background: linear-gradient(135deg, var(--red), var(--peach));
}

.btn-danger:hover {
  background: linear-gradient(135deg, var(--peach), var(--red));
  transform: translateY(-2px);
}

.btn-secondary {
  color: var(--text);
  background-color: var(--surface);
  border: 1px solid var(--overlay);
}

.btn-secondary:hover {
  background-color: var(--overlay);
  transform: translateY(-2px);
}

.btn-sm {
  padding: 0.3em 0.8em;
  font-size: 0.85rem;
}

/* ===== Forms ===== */
.form-container {
  max-width: 500px;
  margin: 0 auto;
  padding: 40px 24px;
}

.form-container .heading {
  margin-bottom: 24px;
}

.form-container .form-group {
  margin-bottom: 20px;
}

.form-container label {
  display: block;
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text);
}

.form-container input[type="text"],
.form-container input[type="password"],
.form-container input[type="email"],
.form-container textarea,
.form-container select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--surface);
  border-radius: 6px;
  font-size: 1rem;
  font-family: "Nunito Sans", sans-serif;
  color: var(--text);
  background-color: var(--mantle);
  background-image: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-container input:focus,
.form-container textarea:focus,
.form-container select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(137, 180, 250, 0.15);
}

.form-container textarea {
  min-height: 100px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.form-actions .btn {
  flex: 1;
  justify-content: center;
}

/* ===== Book List / Table ===== */
.book-list {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  border-collapse: collapse;
}

.book-list th {
  text-align: left;
  padding: 12px 16px;
  background-color: var(--surface);
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05ch;
  color: var(--text);
  border-bottom: 2px solid var(--surface);
}

.book-list td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--surface);
  font-size: 0.95rem;
  color: var(--text);
}

.book-list tr:hover {
  background-color: var(--mantle);
}

.book-list .book-title {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
}

.book-list .book-cover {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
}

.book-list .book-cover-placeholder {
  width: 50px;
  height: 70px;
  background-color: var(--surface);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--overlay);
}

.book-list .status-read {
  color: var(--green);
}

.book-list .status-toread {
  color: var(--yellow);
}

.book-list .status-reading {
  color: var(--blue);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--subtext);
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* ===== Flash Messages ===== */
.alert {
  padding: 12px 20px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-family: "Nunito Sans", sans-serif;
  font-size: 0.9rem;
}

.alert-success {
  background-color: rgba(166, 227, 161, 0.15);
  color: var(--green);
  border: 1px solid rgba(166, 227, 161, 0.3);
}

.alert-danger {
  background-color: rgba(243, 139, 168, 0.15);
  color: var(--red);
  border: 1px solid rgba(243, 139, 168, 0.3);
}

.alert-info {
  background-color: rgba(137, 180, 250, 0.15);
  color: var(--blue);
  border: 1px solid rgba(137, 180, 250, 0.3);
}

/* ===== Search Results ===== */
.search-result {
  padding: 12px 0;
  border-bottom: 1px solid var(--surface);
}

.search-result:last-child {
  border-bottom: none;
}

.search-result-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.search-result-link:hover {
  color: var(--blue);
}

.search-result-img {
  width: 40px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

.search-result-img-placeholder {
  width: 40px;
  height: 60px;
  background-color: var(--surface);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--overlay);
  font-size: 1.5rem;
  flex-shrink: 0;
}

.search-result-content {
  flex: 1;
}

.search-result-title {
  font-family: "Poppins", sans-serif;
  font-weight: 600;
  color: var(--text);
}

.search-result-author {
  font-size: 0.85rem;
  color: var(--subtext);
}

.search-result-year {
  font-size: 0.8rem;
  color: var(--overlay);
}

/* ===== Auth Links ===== */
.auth-link {
  text-align: center;
  margin-top: 16px;
  font-size: 0.9rem;
}

.auth-link a {
  color: var(--blue);
  font-weight: 600;
}

.auth-link a:hover {
  text-decoration: underline;
}
