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

body {
  font-family: "Segoe UI", sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  padding: 24px;
  color: #1e293b;
}

.app {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* HEADER */
.app-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1e293b;
}

/* STATS */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  text-align: center;
}

.stat-card.total {
  border-top: 3px solid #4f46e5;
}
.stat-card.available {
  border-top: 3px solid #10b981;
}
.stat-card.borrowed {
  border-top: 3px solid #f59e0b;
}

.stat-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e293b;
}

/* FORM CARD */
.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.form-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: #1e293b;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: #475569;
}

input,
select {
  padding: 10px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  color: #1e293b;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

input:focus,
select:focus {
  border-color: #4f46e5;
}

.error-msg {
  font-size: 0.85rem;
  color: #ef4444;
  margin-bottom: 12px;
}

.btn-add {
  width: 100%;
  padding: 12px;
  background: #4f46e5;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add:hover {
  background: #4338ca;
}

/* SEARCH BAR */
.search-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

/* LIST CARD */
.list-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.book-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid #f1f5f9;
  gap: 12px;
}

.book-item:last-child {
  border-bottom: none;
}

.book-left {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
}

.book-emoji {
  font-size: 1.5rem;
  line-height: 1;
}

.book-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
}

.book-author {
  font-size: 0.85rem;
  color: #64748b;
  margin-top: 2px;
}

.book-meta {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 4px;
}

.book-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.stock-badge {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 99px;
}

.stock-badge.available {
  background: #d1fae5;
  color: #065f46;
}

.stock-badge.empty {
  background: #fee2e2;
  color: #991b1b;
}

.book-actions {
  display: flex;
  gap: 6px;
}

.btn-borrow {
  padding: 6px 12px;
  background: #10b981;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-borrow:hover {
  background: #059669;
}
.btn-borrow:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.btn-return {
  padding: 6px 12px;
  background: #f59e0b;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-return:hover {
  background: #d97706;
}
.btn-return:disabled {
  background: #d1d5db;
  cursor: not-allowed;
}

.btn-delete {
  padding: 6px 12px;
  background: #ef4444;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

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

.empty-msg {
  text-align: center;
  color: #94a3b8;
  padding: 32px 0;
  font-size: 0.9rem;
}

.hidden {
  display: none;
}
