/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f4f6f9;
  color: #333;
  min-height: 100vh;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s;
}

input[type="number"],
input[type="text"],
input[type="password"] {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

input:focus {
  border-color: #2563eb;
}


/* ===== Login page ===== */
#login-view {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
  padding: 40px 36px;
  width: 360px;
  max-width: 95vw;
  text-align: center;
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 24px;
  color: #1e293b;
}

.login-card .field {
  margin-bottom: 16px;
  text-align: left;
}

.login-card label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #475569;
}

.login-card input {
  width: 100%;
}

.login-card .btn-login {
  width: 100%;
  margin-top: 8px;
  padding: 10px;
  background: #2563eb;
  color: #fff;
  font-size: 16px;
}

.login-card .btn-login:hover {
  background: #1d4ed8;
}

.login-help {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 20px;
  line-height: 1.5;
}

.login-error {
  color: #dc2626;
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

/* ===== Home page ===== */
.home-header {
  background: #1e293b;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.home-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.home-header .header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-header .btn-refresh,
.home-header .btn-logout {
  background: #334155;
  color: #e2e8f0;
  font-size: 13px;
  padding: 6px 14px;
}

.home-header .btn-refresh:hover,
.home-header .btn-logout:hover {
  background: #475569;
}

.home-header .tv-link {
  color: #93c5fd;
  font-size: 13px;
}

.home-header .admin-link {
  color: #93c5fd;
  font-size: 13px;
}

.home-body {
  padding: 20px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

/* ===== Search ===== */
.search-container {
  margin-bottom: 16px;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

.search-input:focus {
  border-color: #2563eb;
  outline: none;
}

#search-results {
  margin-top: 8px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 24px 0 8px;
  color: #1e293b;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 4px;
}

.section-title:first-child {
  margin-top: 0;
}

/* ===== Item cards ===== */
.item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.item-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 4px solid #cbd5e1;
}

.item-card.winning {
  border-left-color: #16a34a;
}

.item-card.outbid {
  border-left-color: #dc2626;
}

.item-card-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.item-card-number {
  font-weight: 700;
  font-size: 14px;
  color: #64748b;
  flex-shrink: 0;
}

.item-card-title {
  font-weight: 600;
  font-size: 15px;
  color: #1e293b;
}

.item-card-details {
  margin: 4px 0 8px;
  font-size: 13px;
  color: #475569;
}

.item-card-details summary {
  cursor: pointer;
  color: #2563eb;
  font-size: 12px;
  user-select: none;
}

.item-card-details summary:hover {
  text-decoration: underline;
}

.item-card-donor {
  margin-top: 4px;
  font-style: italic;
}

.item-card-desc {
  margin-top: 4px;
  white-space: pre-wrap;
}

.item-card-bid-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.item-card-bid-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.item-card-bid-amount {
  font-weight: 700;
  color: #1e293b;
}

.item-card-bidder {
  color: #64748b;
}

.item-card-bidder.winning {
  color: #16a34a;
  font-weight: 600;
}

.item-card-bidder.outbid {
  color: #dc2626;
  font-weight: 600;
}

.item-card-no-bids {
  color: #94a3b8;
  font-style: italic;
  font-size: 13px;
}

.item-card-bid-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bid-input {
  width: 4em;
  text-align: right;
}

.btn-bid {
  /* background: #16a34a; */
  /* color: #fff; */
  padding: 5px 12px;
  font-size: 13px;
}

.btn-bid-arrow {
  background: #e2e8f0;
  color: #475569;
  padding: 4px 8px;
  font-size: 10px;
  line-height: 1;
  border-radius: 2px;
  display: block;
}

.btn-bid-arrow:hover {
  background: #cbd5e1;
}

.bid-arrows {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.winning {
  color: #16a34a;
}

.outbid {
  color: #dc2626;
}

.empty-msg {
  color: #94a3b8;
  font-style: italic;
  padding: 12px 0;
}

#tv-view {
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100vh;
  padding: 12px 16px;
  overflow: hidden;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.admin-totals-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-top: 8px;
}

.admin-totals-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 2px solid #e2e8f0;
}

.admin-totals-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
}

.admin-totals-table tr:nth-child(even) td {
  background: #f8fafc;
}

.tv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.tv-header h1 {
  font-size: 20px;
  color: #fff;
}

.tv-header .tv-back {
  color: #93c5fd;
  font-size: 13px;
}

.tv-columns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 0 8px;
}

.tv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tv-table th {
  text-align: left;
  padding: 4px 6px;
  color: #94a3b8;
  font-size: 10px;
  text-transform: uppercase;
  border-bottom: 1px solid #334155;
}

.item-number-col {
  width: 4em;
}

.bid-amount-col {
  width: 5em;
}

.winner-name-col {
  width: 12em;
}

.place-bid-col {
  width: 11em;
}


.tv-table td {
  padding: 2px 6px;
  border-bottom: 1px solid #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
  font-size: 12pt;
}

.tv-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.03);
}

/* ===== Loading overlay ===== */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  font-size: 16px;
  font-weight: 600;
  color: #475569;
}

.loading-overlay.hidden {
  display: none;
}

#link-back-home {
  display: none;
}

/* ===== Responsive ===== */
@media (max-width: 700px) {
  .home-body {
    padding: 12px;
  }

  .tv-columns {
    grid-template-columns: 1fr;
  }
}