/* ========================================
   BOOKSHELF APP — Clean Modern Theme
   Inspired by note-app UI
   Font: Plus Jakarta Sans
   ======================================== */

@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap");

:root {
  --primary: #19c3e6;
  --primary-dark: #0fa8c9;
  --primary-darker: #0a8aa8;
  --primary-light: #e8f9fd;
  --primary-mid: #b3eef8;
  --white: #ffffff;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --ink: #1a1f2e;
  --ink-soft: #6b7280;
  --ink-lighter: #9ca3af;
  --border: #e5e7eb;
  --border-focus: #19c3e6;
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --yellow: #f59e0b;
  --yellow-light: #fef3c7;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --shadow-primary: 0 4px 16px rgba(25, 195, 230, 0.25);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;
}

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

body {
  font-family: "Plus Jakarta Sans", sans-serif;
  background-color: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ========== HEADER ========== */

header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header h1::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253'/%3E%3C/svg%3E");
  background-size: 18px;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

/* ========== MAIN ========== */

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ========== SECTIONS ========== */

main > section {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: fadeUp 0.3s ease both;
}

main > section:nth-child(2) {
  animation-delay: 0.05s;
}
main > section:nth-child(3) {
  animation-delay: 0.1s;
}
main > section:nth-child(4) {
  animation-delay: 0.15s;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

main > section > h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ========== FORM ========== */

#bookForm > div {
  margin-bottom: 0.875rem;
}

#bookForm label,
#searchBook label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 0.3rem;
  letter-spacing: 0.01em;
}

/* Checkbox row */
#bookForm div:has(#bookFormIsComplete) {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--primary-mid);
  margin-bottom: 1.25rem;
  cursor: pointer;
}

#bookForm div:has(#bookFormIsComplete) label {
  display: inline;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary-darker);
  margin: 0;
  cursor: pointer;
  letter-spacing: 0;
}

#bookFormIsComplete {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  padding: 0.65rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--white);
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25, 195, 230, 0.12);
}

input::placeholder {
  color: var(--ink-lighter);
}

/* ========== FORM ACTIONS ========== */

.form-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

#bookFormSubmit {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.15s,
    box-shadow 0.2s;
  box-shadow: var(--shadow-primary);
  letter-spacing: 0.01em;
}

#bookFormSubmit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(25, 195, 230, 0.35);
}

#bookFormSubmit:active {
  transform: translateY(0);
}

.btn-cancel {
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--border);
  padding: 0.7rem 1.2rem;
  border-radius: var(--radius-sm);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    border-color 0.2s;
}

.btn-cancel:hover {
  background: var(--red-light);
  border-color: var(--red);
}

/* ========== SEARCH ========== */

#searchBook {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

#searchBook label {
  display: none;
}

#searchBookTitle {
  flex: 1;
  background: var(--bg);
  border-color: var(--border);
}

#searchBookTitle:focus {
  background: var(--white);
}

#searchSubmit {
  background: var(--primary);
  color: var(--white);
  border: none;
  padding: 0.65rem 1.3rem;
  border-radius: var(--radius-sm);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.15s;
  white-space: nowrap;
  box-shadow: var(--shadow-primary);
}

#searchSubmit:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* ========== BADGE ========== */

.badge {
  background: var(--primary-light);
  color: var(--primary-darker);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  min-width: 24px;
  text-align: center;
}

.badge-green {
  background: var(--green-light);
  color: var(--green);
}

/* ========== BOOK LIST ========== */

#incompleteBookList,
#completeBookList {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

/* ========== BOOK CARD ========== */

.book-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    border-color 0.2s;
  position: relative;
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-mid);
}

.book-card.book-complete {
  border-left: 3px solid var(--green);
}

.book-card:not(.book-complete) {
  border-left: 3px solid var(--primary);
}

[data-testid="bookItemTitle"] {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  margin-bottom: 0.1rem;
}

[data-testid="bookItemAuthor"] {
  font-size: 0.8rem;
  color: var(--primary-dark);
  font-weight: 500;
}

[data-testid="bookItemYear"] {
  font-size: 0.75rem;
  color: var(--ink-lighter);
  margin-bottom: 0.5rem;
}

/* ========== BOOK ACTIONS ========== */

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.book-actions button {
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.73rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-xs);
  border: none;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
  letter-spacing: 0.01em;
}

.book-actions button:active {
  transform: scale(0.97);
}

.btn-toggle {
  background: var(--green-light);
  color: var(--green);
  flex: 1;
}

.btn-toggle:hover {
  background: #a7f3d0;
}

.book-complete .btn-toggle {
  background: var(--primary-light);
  color: var(--primary-darker);
}

.book-complete .btn-toggle:hover {
  background: var(--primary-mid);
}

.btn-edit {
  background: var(--yellow-light);
  color: var(--yellow);
}

.btn-edit:hover {
  background: #fde68a;
}

.btn-delete {
  background: var(--red-light);
  color: var(--red);
}

.btn-delete:hover {
  background: #fecaca;
}

/* ========== EMPTY STATE ========== */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--ink-lighter);
  font-size: 0.875rem;
  padding: 2.5rem 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.empty-state::before {
  content: "📭";
  font-size: 2rem;
  display: block;
}

/* ========== RESPONSIVE ========== */

@media (max-width: 600px) {
  header {
    padding: 0 1rem;
  }

  main {
    padding: 1.25rem 1rem 3rem;
  }

  main > section {
    padding: 1.35rem 1.1rem;
  }

  #incompleteBookList,
  #completeBookList {
    grid-template-columns: 1fr;
  }

  #searchBook {
    flex-direction: column;
  }

  #searchSubmit {
    width: 100%;
  }
}
