/* Book Lending Tracker - main stylesheet */
:root {
  --ink: #1f2937;
  --muted: #718096;
  --paper: #f6f7fb;
  --white: #ffffff;
  --line: #e7eaf0;
  --primary: #5b5bd6;
  --primary-dark: #4545b8;
  --primary-soft: #eeeeff;
  --danger: #c24155;
  --danger-soft: #fff0f2;
  --success: #168568;
  --success-soft: #e8f7f1;
  --shadow: 0 12px 34px rgba(32, 41, 70, 0.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}
button, input, select { font: inherit; }
.container { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }

.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--line);
}
.header-content, .brand, .footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-content { min-height: 76px; }
.brand {
  justify-content: flex-start;
  gap: 12px;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.3px;
}
.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-size: 20px;
}
.header-note, .footer-content { color: var(--muted); font-size: 13px; }

.page-content { padding-top: 46px; padding-bottom: 58px; }
.intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
}
h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 39px);
  line-height: 1.15;
  letter-spacing: -1.4px;
}
.intro-copy { max-width: 580px; margin-bottom: 0; color: var(--muted); }
.intro-icon {
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border-radius: 25px;
  background: #e9e9ff;
  font-size: 38px;
  transform: rotate(4deg);
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 24px;
}
.summary-card, .panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.summary-card { padding: 20px 22px; }
.summary-label, .summary-foot { display: block; color: var(--muted); font-size: 12px; }
.summary-number {
  display: block;
  margin: 5px 0 1px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -1px;
}
.overdue-summary .summary-number { color: var(--danger); }
.returned-summary .summary-number { color: var(--success); }

.content-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(0, 1.8fr);
  gap: 20px;
  align-items: start;
}
.panel { padding: 24px; min-width: 0; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 23px;
}
.section-heading .eyebrow { margin-bottom: 4px; }
h2 { margin-bottom: 0; font-size: 20px; letter-spacing: -0.5px; }
.heading-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 11px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 22px;
}
.field { margin-bottom: 15px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 700;
}
.required { color: var(--danger); }
.field input, .field select, .filter-select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #dfe3eb;
  border-radius: 8px;
  outline: none;
  background: white;
  color: var(--ink);
  font-size: 12px;
}
.field input:focus, .field select:focus, .filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 91, 214, 0.12);
}
.field input::placeholder { color: #a0a8b7; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--danger); }
.error-message {
  display: block;
  min-height: 0;
  margin-top: 4px;
  color: var(--danger);
  font-size: 11px;
}
.error-message:not(:empty) { min-height: 15px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 43px;
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.2s, transform 0.2s;
}
.button-primary { background: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.submit-button { width: 100%; margin-top: 5px; }
.form-hint { margin: 11px 0 0; color: var(--muted); font-size: 10px; }

.loans-heading { margin-bottom: 18px; }
.filter-select { width: auto; min-width: 118px; min-height: 35px; padding: 6px 28px 6px 9px; }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #f8f9fc; }
th {
  padding: 12px 10px;
  color: #798294;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
td {
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  color: #596273;
  font-size: 11px;
  vertical-align: middle;
}
.book-name { display: block; color: var(--ink); font-weight: 700; font-size: 11px; }
.book-author { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.status-active { background: var(--primary-soft); color: var(--primary); }
.status-overdue { background: var(--danger-soft); color: var(--danger); }
.status-returned { background: var(--success-soft); color: var(--success); }
.action-group { display: flex; gap: 6px; }
.action-button {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font-size: 10px;
  white-space: nowrap;
}
.action-button:hover { border-color: var(--primary); color: var(--primary); }
.action-button.delete:hover { border-color: var(--danger); color: var(--danger); }
.empty-row td { padding: 42px 12px; text-align: center; }
.empty-row strong, .empty-row span { display: block; }
.empty-row strong { margin: 8px 0 3px; color: var(--ink); font-size: 12px; }
.empty-row span { color: var(--muted); font-size: 11px; }
.empty-row .empty-icon { font-size: 25px; }
.table-note { margin: 14px 0 0; color: var(--muted); font-size: 10px; }
.site-footer { border-top: 1px solid var(--line); background: white; }
.footer-content { min-height: 60px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
  .form-panel { max-width: none; }
}
@media (max-width: 600px) {
  .container { width: min(100% - 30px, 1240px); }
  .page-content { padding-top: 30px; }
  .header-note { display: none; }
  .intro-icon { width: 58px; height: 58px; border-radius: 18px; font-size: 28px; }
  .summary-grid { grid-template-columns: 1fr; gap: 10px; }
  .summary-card { padding: 14px 17px; }
  .summary-number { font-size: 25px; }
  .panel { padding: 18px 15px; }
  .footer-content { align-items: flex-start; justify-content: center; flex-direction: column; gap: 2px; padding: 13px 0; }
}
