/* style-dark.css - bookStackOne visual theme (dark app shell) */
:root {
  --bg: #18191b;
  --panel: #222428;
  --muted: #9aa0a6;
  --accent: #9f7219;
  --accent-2: #1e90ff;
  --card: #1f2327;
  --text: #e6eef3;
  --pre: #bb9e46;
  --soft: #2a2d31;
  --danger: #e63946;
  --radius: 8px;
  --gap: 14px;
  --tabbedGrey: #46484b;
}

* {
  box-sizing: border-box;
  font-family: Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

body,
html {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  display: grid;
  grid-template-columns: 170px 1fr;
  grid-template-rows: 64px 1fr;
  gap: 0;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  grid-row: 1 / span 2;
  grid-column: 1;
  background: linear-gradient(180deg, var(--panel), #1a1b1d);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
}

.logo {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo img {
  width: 130px;
}

.brand-text {
  font-weight: 700;
  color: var(--text);
}

.side-nav {
  display: flex;
  flex-direction: column;
  padding-top: 8px;
  gap: 6px;
}

.side-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 10px;
  border-radius: 6px;
  display: block;
}

/* Make interactive sidebar links (e.g., About) use accent colors */
.side-nav a.side-link { color: var(--accent-2); }
.side-nav a.side-link:hover { color: var(--accent); text-decoration: underline; }

/* About link (when logged in, no extra class present) */
.side-nav a#openAboutLink { color: var(--accent-2); }
.side-nav a#openAboutLink:hover { color: var(--accent); text-decoration: underline; }

.side-nav a.active {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.logout-link {
  margin-top: auto;
  color: #ffb4b4;
}

/* Topbar */
.topbar {
  grid-column: 2;
  background: transparent;
  display: flex;
  flex-direction: column; /* stack rows vertically */
  align-items: stretch;   /* make children full-width */
  justify-content: flex-start;
  height: auto;           /* allow bottom bar to sit below */
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

/* Row + bottom bar to show broadcast/admin messages */
.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-bottom {
  width: 100%;
  padding: 6px 20px 10px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar-bottom > div,
.topbar-bottom p,
.topbar-bottom span,
.topbar-bottom em,
.topbar-bottom strong {
  text-align: left !important;
}

.topbar .app-title {
  margin: 0;
  font-size: 18px;
}

/* Workspace */
.workspace {
  grid-column: 2;
  grid-row: 2;
  padding: 24px;
  overflow: auto;
}

.panel {
  background: linear-gradient(180deg, var(--card), #171819);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 18px;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
}

/* Centered, half-width collections panel on dashboard */
.collections-panel {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 900px) {
  .collections-panel {
     max-width: 680px;
  }
}

.add-book-row {
    display: flex;
    gap: var(--gap); /* 14px gap between panels, matching your root variable */
    margin-bottom: var(--gap); /* Space below the row */
}

.add-book-row .panel {
    flex: 1 1 0; /* Base flex; overridden by specific rules below */
    min-width: 0; /* Prevent flex items from overflowing */
}

/* Make the first panel (Add Book) take two-thirds, second (Bulk) one-third */
.add-book-row .panel:first-child {
    flex: 2 1 0;
}
.add-book-row .panel:last-child {
    flex: 1 1 0;
}

.panel h2 {
  margin-top: 0;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding-bottom: 10px;
}

/* Account Panel */
.account-panel {
  max-width: 680px; /* Narrow for focus, like admin panel */
  margin: 20px auto; /* Centered with spacing */
  padding: 24px; /* More padding for prominence */
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 12px; /* Matches admin-table margin-top */
}

.account-info p {
  margin: 0;
  display: flex;
  align-items: center; /* Align label and value */
  gap: 12px; /* Space between label and value */
  padding: 8px 0; /* Vertical padding for rows */
  border-bottom: 1px solid rgba(255, 255, 255, 0.02); /* Matches admin-table */
  color: var(--text); /* Ensure normal text color */
}

.account-info .label {
  font-weight: 700;
  color: var(--text);
  width: 200px; /* Fixed width for alignment */
  font-size: 14px; /* Matches admin-table td */
}

.account-info .value {
  font-size: 14px; /* Matches admin-table td */
  color: var(--text);
  flex: 1; /* Take remaining space */
}

.account-info .value.invalid {
  color: #ff7b7b; /* Matches .invalid-isni */
}

/* Valid ISNI shown in green */
.account-info .value.valid {
  color: #6dde6d; /* soft green */
}

/* Style for ORCID/invalid labels */
.account-info .value::after {
  margin-left: 8px;
  font-size: 13px; /* Smaller for labels */
  font-weight: 500;
  color: var(--muted); /* Muted for ORCID subset */
}

.account-info .value.invalid::after {
  color: #ff7b7b; /* Red for invalid label */
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.admin-table th,
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  text-align: left;
  color: var(--text);
  font-size: 14px;
}

.admin-table th {
  font-size: 16px;
}

a.invalid-isni,
.invalid-isni,
a.invalid-isni:link,
a.invalid-isni:visited {
  color: #ff7b7b; /* Red for invalid ISNI */
}

a.invalid-isni:hover {
  color: #ff9595;
}

a.valid-isni,
.valid-isni,
a.valid-isni:link,
a.valid-isni:visited {
  color: #6dde6d !important; /* Green for valid ISNI */
}

a.valid-isni:hover {
  color: #8ff08f;
}

.isni-valid-check {
  color: #6dde6d;
  margin-left: 6px;
  font-weight: bold;
  font-size: 0.9em;
  vertical-align: middle;
}

.collection-grid, .catalog-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.collection-card, .catalog-card {
  display: block;
  width: 160px;
  padding: 12px;
  background: var(--soft);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.025);
}

.collection-name, .catalog-name {
  font-weight: 700;
}

.collection-meta, .catalog-meta {
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.panel-footer {
  margin-top: 18px;
}

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="file"],
textarea {
  width: 100%;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  background: #0f1112;
  color: var(--text);
  margin-bottom: 8px;
}

button {
  background: var(--accent);
  color: #fff;
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

/* Tab buttons default background */
.tab-btn {
  background: var(--tabbedGrey) !important;
}

/* Active tab stands out */
.tab-btn.tab-active {
  background: var(--accent) !important;
}

.submit-btn:disabled {
  background: #cfd7de; /* light grey */
  color: #8c959f;
  cursor: not-allowed;
}

button:disabled,
button[disabled],
.btn:disabled,
.btn[disabled],
.btn-ghost:disabled,
.btn-ghost[disabled] {
  background: #cfd7de; /* light grey */
  color: #8c959f;
  cursor: not-allowed;
  opacity: 0.9;
}

button:disabled:hover,
.btn:disabled:hover,
.btn-ghost:disabled:hover {
  background: #cfd7de;
}

button.btn-ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.03);
  color: var(--text);
}

button.btn-delete {
  background: var(--danger);
  color: #fff;
}

button.btn-delete:hover {
  background: #c5303b;
}

.muted {
  color: var(--muted);
}

.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  padding: 20px;
  border: 1px solid var(--muted);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  width: 700px;
  color: var(--text);
  border-radius: var(--radius);
}

/* Terms popup container: limit height and enable vertical scrolling */
#termsPopup {
  max-height: 70vh;
  overflow-y: auto;
}

.popup.show {
  display: block;
}

.popup form {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.popup label {
  font-weight: bold;
  color: var(--text);
}

.popup input {
  padding: 8px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: var(--soft);
  color: var(--text);
}

/* Ensure selects in popups match dark input styling */
.popup select {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--muted);
  border-radius: var(--radius);
  background: #0f1112;
  color: var(--text);
}

.popup select option {
  background: #111;
  color: #fff;
}

.popup button {
  padding: 8px;
  border: none;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--text);
  cursor: pointer;
  margin-top: var(--gap);
}

.popup button[type="button"] {
  background: var(--muted);
}

.popup button:hover {
  background: var(--accent-2);
}

.popup button[type="button"]:hover {
  background: #777;
}

/* Terms content styling */
.terms-popup { max-width: 680px; margin: 0 auto; padding: 20px; line-height: 1.55; }
.terms-popup h2 { margin-bottom: 18px; text-align: center; font-size: 1.55em; }
.terms-list { margin: 28px 0; }
.terms-list li { margin: 10px 0; padding: 8px 0; }
.terms-list strong { color: var(--accent-2); }

.worldcat-link {
  color: var(--accent-2);
  text-decoration: none;
  font-weight: 500;
}

.worldcat-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* General anchor styles (dark theme) */
a {
  color: var(--accent-2);
  text-decoration: none;
}
a:hover {
  color: var(--accent);
  text-decoration: underline;
}
a:visited {
  color: var(--accent-2);
}

.collection-table, .catalog-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.collection-table th,
.collection-table td {
  padding: .5rem .5rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.collection-table th {
  font-weight: bold;
}

.collection-table td a.view-books {
  display: inline-block;
  padding: 0.1rem 1rem;
  background-color: #4a90e2;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  transition: background-color 0.3s;
}

.collection-table td a.view-books:hover {
  background-color: #357abd;
}

.collection-table form {
  display: inline;
  margin: 0;
}

.collection-table input[type="text"] {
  padding: 0.25rem;
  margin-right: 0.5rem;
}

.jsonpopup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--panel);
  padding: 20px;
  border: 1px solid var(--muted);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  width: 600px;
  color: var(--text);
  border-radius: var(--radius);
}

.jsonpopup.show {
    display: block;
}

.jsonpopup h3 {
    margin-top: 0;
}

.jsonpopup pre {
    background: #332f2f;
    padding: 10px;
    border-radius: 4px;
      color: var(--pre);
    overflow-x: auto;
}

.form-actions button {
    margin-right: 10px; /* Adds spacing between buttons */
}

/* Styling for the book cover image in the edit popup */
.book-cover-image {
    max-width: 200px; /* Adjusted for medium size (typically 200x300 pixels) */
    max-height: 300px; /* Matches medium cover aspect ratio */
    margin-bottom: 15px; /* Increased for better spacing */
    border: 1px solid #ddd; /* Subtle border for definition */
    border-radius: 4px; /* Slight rounding for a modern look */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Soft shadow for depth */
    object-fit: cover; /* Ensures the image scales properly within bounds */
    display: block; /* Ensures margin and alignment work as expected */
    margin-left: auto;
    margin-right: auto; /* Centers the image horizontally */
}

/* Responsive adjustments for smaller screens */
@media (max-width: 600px) {
    .book-cover-image {
        max-width: 150px; /* Reduce size on smaller screens */
        max-height: 225px; /* Maintain aspect ratio */
    }
}

/* Ensure the popup content adjusts around the image */
.popup.show #editPopup {
    padding: 20px; /* Add padding to the popup */
    max-width: 800px; /* Limit popup width */
    margin: 0 auto; /* Center the popup */
    text-align: center; /* Center-align text and image */
}

/* Form grid layout for the edit popup */
.form-grid {
    display: grid;
    gap: 10px; /* Space between rows */
    margin-bottom: 15px; /* Space before buttons */
}

.form-row {
    display: flex;
    gap: 10px; /* Space between columns */
}

.form-row.full-width {
    grid-column: 1 / -1; /* Span full width */
}

.form-group {
    flex: 1; /* Equal width for each column */
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input,
.form-group textarea {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical; /* Allow vertical resizing only */
    min-height: 60px; /* Ensure 3 lines are visible */
}

.popup .form-actions {
    text-align: center;
    margin-top: 10px;
}

.popup .form-actions button {
    padding: 8px 16px;
    margin: 0 5px;
/*    background-color: #4CAF50; */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.form-actions button[type="submit"] {
/*    background-color: #f44336; /* Red for Cancel */ */
}

.form-actions button:hover {
    opacity: 0.9;
}

/* Ensure the popup adjusts to the form */
.popup.show #editPopup {
    padding: 20px;
    max-width: 500px; /* Increased for better form fit */
    margin: 0 auto;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 5px;
    }

    .form-group {
        width: 100%; /* Full width on small screens */
    }

    .popup.show #editPopup {
        max-width: 90%; /* Full width on very small screens */
    }
}

/* style-dark.css- Custom additions */
.admin-table .col-note {
  max-width: 250px;
  white-space: normal;           /* allow wrapping */
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* Zebra striping for book list rows */
.admin-table tbody tr:nth-child(odd) {
  background-color: #18191be3; /* tad lighter */
}
.admin-table tbody tr:nth-child(even) {
  background-color: #18191b;
}
for admin panel user edit and former users table */

/* Styling for the user edit popup */
.popup.show #editUserPopup {
    padding: 20px;
    max-width: 500px; /* Matches .popup.show #editPopup for consistency */
    text-align: center;
}

/* Styling for the Former Users table header */
#formerUserTable {
    margin-top: 24px; /* Space above Former Users table */
}

/* Ensure buttons in admin-table actions are styled consistently */
.admin-table td form button {
    padding: 6px 12px; /* Slightly smaller than main buttons for table actions */
    font-size: 14px; /* Matches table text */
    border-radius: var(--radius); /* Consistent with theme */
}

/* Style for Archive/Unarchive buttons */
.admin-table td form button[name="archive"],
.admin-table td form button[name="unarchive"] {
    background: var(--danger); /* Red to indicate significant action */
}

.admin-table td form button[name="archive"]:hover,
.admin-table td form button[name="unarchive"]:hover {
    background: #c5303b; /* Matches .btn-delete:hover */
}

/* Ensure Edit button matches existing action buttons */
.admin-table td form button[type="submit"]:not([name="archive"]):not([name="unarchive"]) {
    background: var(--accent); /* Matches primary button style */
}

.admin-table td form button[type="submit"]:not([name="archive"]):not([name="unarchive"]):hover {
    background: var(--accent-2); /* Matches .popup button:hover */
}

/* Pager styles */
.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.pager .btn {
  background: var(--soft);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.2s ease;
  min-width: 38px;
  text-align: center;
}

.pager .btn:hover:not(.disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.pager .btn.btn-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.pager .btn.disabled {
  background: var(--soft);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

.pager .muted {
  color: var(--muted);
  font-size: 14px;
  padding: 0 4px;
}

/* Disabled-button hover hint (Login page) */
.btn-wrap { position: relative; display: inline-block; }
.btn-wrap .btn-hint {
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 8px);
  background: #2b2f33;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  font-size: 12px;
  z-index: 1001;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.btn-wrap button:disabled + .btn-hint,
.btn-wrap button[disabled] + .btn-hint { display: none; }
.btn-wrap:hover button:disabled + .btn-hint,
.btn-wrap:hover button[disabled] + .btn-hint { display: block; }

/* Books JSON subpath styling */
.json-subpath {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: 0.2px;
}
.json-subpath .hex {
  color: var(--danger);
  font-weight: 600;
}