/* print.css — print view, print media query & tabs */

/* ============================================================
   PRINT VIEW
   ============================================================ */
.print-toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.print-option-group {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--gray-border);
  border-radius: 7px;
  overflow: hidden;
}
.print-option-group button {
  background: #fff;
  border: none;
  border-right: 1px solid var(--gray-border);
  padding: 0.42rem 0.9rem;
  font-size: 0.83rem;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--gray-mid);
  transition: background 0.12s;
}
.print-option-group button:last-child { border-right: none; }
.print-option-group button.active { background: var(--green-dark); color: #fff; }

.btn-print {
  background: var(--green-dark);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-body);
}
.btn-print:hover { background: var(--green-mid); }

.btn-export-xls {
  background: #1d6f42;
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 0.45rem 1.1rem;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-body);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.4rem;
}
.btn-export-xls:hover { background: #155231; }

/* Missing Report button — only shown for admins */
.pt-missing-btn {
  display: none;
  background: #fff;
  border: none;
  border-right: 1px solid var(--gray-border);
  padding: 0.42rem 0.9rem;
  font-size: 0.83rem;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--gray-mid);
  transition: background 0.12s;
}
.pt-missing-btn.active { background: var(--green-dark); color: #fff; }
body.is-admin .pt-missing-btn { display: block; }

/* Missing Report filter panel */
.missing-filters-wrap {
  background: #f8faf8;
  border: 1.5px solid var(--gray-border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.missing-filters-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--green-dark);
}
.missing-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
}
.missing-checks label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.missing-link-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  font-size: 0.85rem;
}
.missing-link-label {
  font-weight: 600;
  color: var(--green-dark);
  margin-right: 0.25rem;
}
.missing-link-row label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.missing-link-specific-wrap { display: flex; align-items: center; gap: 0.4rem; }
#mc-link-type {
  font-family: var(--font-body);
  font-size: 0.83rem;
  padding: 0.3rem 0.6rem;
  border: 1.5px solid var(--gray-border);
  border-radius: 6px;
  background: #fff;
}

/* Missing report output */
.missing-report-count {
  font-weight: 600;
  color: var(--coral-dark, #c0392b);
  margin-bottom: 0.65rem;
  font-size: 0.9rem;
}
.missing-tag {
  display: inline-block;
  background: #fde8e8;
  color: #c0392b;
  border-radius: 4px;
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  margin: 0.1rem 0.2rem 0.1rem 0;
  white-space: nowrap;
}

/* Print layout */
#print-content {
  background: #fff;
  padding: 1rem;
  border-radius: 8px;
  border: 1.5px solid var(--gray-border);
}

/* List print style */
.print-list-section { margin-bottom: 1.5rem; }
.print-list-section h3 {
  font-family: var(--font-serif);
  color: var(--green-dark);
  font-size: 1rem;
  border-bottom: 2px solid var(--green-light);
  padding-bottom: 4px;
  margin-bottom: 0.5rem;
}
.print-list-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.print-list-table th {
  background: var(--green-light);
  color: var(--green-dark);
  padding: 0.35rem 0.6rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
}
.print-list-table td {
  padding: 0.32rem 0.6rem;
  border-bottom: 1px solid var(--gray-light);
  vertical-align: top;
}
.print-sing-tick { color: var(--teal-mid); font-weight: 600; }

/* Card print style */
.print-cards { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.print-card {
  width: calc(33.333% - 0.44rem);
  border: 1.5px solid var(--gray-border);
  border-radius: 8px;
  overflow: hidden;
  page-break-inside: avoid;
  font-size: 0.75rem;
}
.print-card-img {
  width: 100%; aspect-ratio: 3/4;
  object-fit: cover;
  background: var(--green-light);
}
.print-card-body { padding: 0.5rem; }
.print-card-title { font-family: var(--font-serif); font-size: 0.82rem; font-weight: 600; margin-bottom: 2px; }
.print-card-meta  { color: var(--gray-mid); line-height: 1.5; }

/* ============================================================
   RESPONSIVE / MOBILE
   ============================================================ */
@media (max-width: 680px) {
  .nav-desktop { display: none; }
  .hamburger   { display: flex; align-items: center; justify-content: center; }

  .book-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.65rem;
  }
  .form-grid { grid-template-columns: 1fr; }
  .singable-panel .form-grid { grid-template-columns: 1fr; }
  .detail-inner { flex-direction: column; }
  .detail-cover-wrap { width: 100%; }
  .detail-cover-wrap img,
  .detail-cover-ph { width: 100%; max-width: 180px; aspect-ratio: 3/4; }

  .modal {
    max-height: 95vh;
    padding: 1.1rem;
    border-radius: 12px 12px 0 0;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    top: auto;
    margin: 0;
    max-width: 100%;
    width: 100%;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal-overlay.open { display: flex; }

  .toolbar-row { flex-wrap: wrap; }
  .toolbar-row input[type="text"] { min-width: 0; }
  .curr-book-list { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .print-card { width: calc(50% - 0.33rem); }
  .import-actions { flex-direction: column; align-items: stretch; }
}

@media (max-width: 380px) {
  .book-grid { grid-template-columns: 1fr 1fr; }
  .print-card { width: 100%; }
}

/* ============================================================
   PRINT MEDIA
   ============================================================ */
@media print {
  header, .toolbar, .year-tabs, nav,
  .detail-actions, .btn-print, .print-toolbar,
  .nav-drawer, .hamburger { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  main { padding: 0; max-width: 100%; }
  .print-card { width: calc(33% - 4px); }
  a { text-decoration: none; color: inherit; }
}


/* ============================================================
   TABS (detail modal + form modal)
   ============================================================ */
.tab-nav {
  display: flex;
  border-bottom: 2px solid var(--gray-border);
  margin: 0 0 1.25rem 0;
  flex-wrap: wrap;
  gap: 0;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 0.5rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--gray-mid);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  border-radius: 0;
}
.tab-btn:hover { color: var(--green-dark); }
.tab-btn.active {
  color: var(--green-dark);
  border-bottom-color: var(--green-mid);
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

#f-subject-notes { min-height: 90px; }
