/* ============================================================
   Global reset — removes default browser spacing and sizing
============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  background-color: #f0f2f5;
}

h1 {
  font-size: 30px;
  margin-bottom: 4px;
  text-align: center;
}

h2 {
  font-size: 18px;
  color: #000000;
  margin-bottom: 24px;
  text-align: center;
}

/* ============================================================
   Login page — centered card layout and form styles
============================================================ */
body.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #760176;
}

#login-container {
  background-color: white;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
  margin: auto;
}

.login-label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: #333;
}

.login-input {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.login-input:focus {
  outline: none;
  border-color: #4a90e2;
}

.login-button {
  width: 100%;
  padding: 10px;
  background-color: #4a90e2;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
}

.login-button:hover {
  background-color: #357abd;
}

/* hidden until JS writes an error message to it */
#error-msg {
  color: red;
  font-size: 14px;
  margin-top: 12px;
  min-height: 20px;
}

/* ============================================================
   Dashboard header — top navigation bar
============================================================ */
#dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #760176;
  padding: 16px 24px;
}

#dashboard-header h1 {
  color: white;
  font-size: 24px;
}

#dashboard-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

#header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#header-logo {
  height: 60px;
  width: auto;
  border-radius: 4px;
}

#header-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

#logged-in-name {
  color: white;
  font-size: 14px;
}

.logout-button {
  padding: 8px 16px;
  background-color: white;
  color: #760176;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.logout-button:hover {
  background-color: #f0f0f0;
}

/* ============================================================
   Dashboard content — main page layout and year groups
============================================================ */
#dashboard-content {
  padding: 24px;
  max-width: 1000px;
  margin: 0 auto;
}

.year-section {
  margin-bottom: 24px;
}

.year-heading {
  background-color: #760176;
  color: white;
  padding: 10px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  margin-bottom: 8px;
}

.year-heading:hover {
  background-color: #5a015a;
}

.year-jobs {
  border: 1px solid #ddd;
  border-radius: 4px;
  overflow: hidden;
}

.year-jobs.hidden {
  display: none;
}

/* ============================================================
   Job tabs — status filter tabs on the dashboard and job detail
============================================================ */
#job-tabs,
#inventory-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 16px;
  border-bottom: 2px solid #ddd;
}

.tab-btn {
  padding: 10px 20px;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  cursor: pointer;
  color: #666;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: #760176;
}

.tab-btn.active-tab {
  color: #760176;
  border-bottom: 2px solid #760176;
  font-weight: bold;
}

/* ============================================================
   Job rows — clickable rows in the dashboard jobs list
============================================================ */
.job-row {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  align-items: center;
}

.job-row:hover {
  background-color: #f9f0f9;
}

.job-id {
  font-weight: bold;
  min-width: 160px;
  color: #760176;
}

.job-name {
  flex: 1;
}

.job-status {
  text-transform: capitalize;
  color: #666;
  min-width: 100px;
}

.job-items {
  color: #666;
  min-width: 160px;
}

.job-modified {
  color: #999;
  font-size: 12px;
  min-width: 160px;
}

/* ============================================================
   Job info card
============================================================ */
#job-details {
  margin: 0;
  padding: 0;
}

#job-info {
  background-color: white;
  padding: 16px 24px;
  border-radius: 8px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #760176;
  border-top: 1px solid #eee;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

#job-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

#job-info-header .dashboard-btn {
  margin-bottom: 0;
}

#job-title {
  font-size: 20px;
  color: #760176;
  font-weight: bold;
  margin: 0;
  padding: 0;
}

.job-info-grid {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-top: 0;
  padding-top: 0;
}

.job-info-fields {
  flex: 1;
}

.job-info-row {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 6px 0 6px 0;
}

.job-info-row-border {
  border-top: 1px solid #f0f0f0;
}

.job-info-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}

.job-info-cell strong {
  font-size: 10px;
  text-transform: uppercase;
  color: #aaa;
  letter-spacing: 0.5px;
}

.job-info-cell span,
.job-info-cell div {
  font-size: 14px;
  color: #222;
  font-weight: 500;
}

.job-info-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 160px;
  padding-top: 10px;
}

.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  text-transform: capitalize;
  width: fit-content;
}

/* ============================================================
   Collapsible job sections
============================================================ */
#job-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.job-section {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.job-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  cursor: pointer;
  background-color: white;
  border-bottom: 1px solid transparent;
  transition: background-color 0.2s;
}

.job-section-header:hover {
  background-color: #f9f0f9;
}

.job-section-header.open {
  border-bottom: 1px solid #eee;
}

.section-title {
  font-size: 15px;
  font-weight: bold;
  color: #760176;
}

.section-toggle {
  font-size: 12px;
  color: #999;
  transition: transform 0.2s;
}

.section-toggle.open {
  transform: rotate(180deg);
}

.job-section-body {
  padding: 20px;
  display: none;
}

.job-section-body.open {
  display: block;
}

#inventory-section {
  background-color: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

#inventory-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

#inventory-header h3 {
  font-size: 18px;
}

/* ============================================================
   Job schedule section
============================================================ */
.schedule-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid #eee;
  border-radius: 4px;
  overflow: hidden;
}

.schedule-row {
  display: flex;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.schedule-row:last-child {
  border-bottom: none;
}

.schedule-label {
  font-size: 12px;
  text-transform: uppercase;
  color: #999;
  width: 160px;
  flex-shrink: 0;
}

.schedule-value {
  color: #333;
}

/* ============================================================
   Attachments section
============================================================ */
.attachment-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.attachment-row:last-child {
  border-bottom: none;
}

.attachment-name {
  flex: 1;
  color: #333;
  font-weight: bold;
}

.attachment-date {
  color: #999;
  font-size: 12px;
  min-width: 140px;
}

.attachment-actions {
  display: flex;
  gap: 8px;
}

/* ============================================================
   Inventory — item list, status badges, and column styles
============================================================ */
#inventory-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.summary-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: bold;
}

.active-badge {
  background-color: #e8f5e9;
  color: #2e7d32;
}

.sold-badge {
  background-color: #e3f2fd;
  color: #1565c0;
}

.donated-badge {
  background-color: #fff3e0;
  color: #e65100;
}

.removed-badge {
  background-color: #fce4ec;
  color: #c62828;
}

.item-header {
  background-color: #f5f5f5;
  font-weight: bold;
  font-size: 12px;
  text-transform: uppercase;
  color: #666;
  border-bottom: 2px solid #ddd;
}

.item-header .item-status {
  text-align: center;
}

.item-header .item-quantity {
  text-align: center;
}

.item-row {
  display: flex;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  align-items: center;
  font-size: 14px;
  min-height: 52px;
}

.item-id {
  font-weight: bold;
  color: #760176;
  width: 160px;
}

.item-name {
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.item-description {
  color: #999;
  font-size: 12px;
  font-weight: normal;
  white-space: normal;
}

.item-category {
  color: #666;
  width: 120px;
}

.item-quantity {
  color: #666;
  width: 60px;
  text-align: center;
}

.item-condition {
  color: #666;
  width: 80px;
}

.item-status {
  width: 80px;
  text-align: center;
  text-transform: capitalize;
  font-weight: bold;
}

.item-status.active {
  color: green;
}

.item-status.removed {
  color: red;
}

.item-dealer {
  min-width: 100px;
  color: #666;
}

.item-price {
  min-width: 90px;
  color: #666;
}

.item-commission {
  min-width: 100px;
  color: #666;
}

.item-notes {
  flex: 1;
  color: #666;
}

.remove-placeholder {
  width: 80px;
}

.no-items-msg {
  color: #999;
  font-size: 14px;
  padding: 16px;
}

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

#search-input {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-sizing: border-box;
}

#search-input:focus {
  outline: none;
  border-color: #760176;
}

#search-results {
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-bottom: 16px;
  display: none;
}

.search-result-row {
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  gap: 16px;
  align-items: center;
}

.search-result-row:hover {
  background-color: #f9f0f9;
}

.search-result-row:last-child {
  border-bottom: none;
}

.search-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: bold;
}

.search-tag.job-tag {
  background-color: #e8e0f0;
  color: #760176;
}

.search-tag.item-tag {
  background-color: #e3f2fd;
  color: #1565c0;
}

.search-result-id {
  font-weight: bold;
  color: #760176;
  min-width: 140px;
}

.search-result-detail {
  color: #666;
  flex: 1;
}

/* ============================================================
   Metrics page
============================================================ */
#reports-title {
  font-size: 22px;
  color: #760176;
  margin-bottom: 16px;
}

#year-filter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

#year-filter .form-label {
  margin-bottom: 0;
}

#job-metrics {
  background-color: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

#job-metrics h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #333;
}

#job-metrics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* ============================================================
   Metrics tabs
============================================================ */
#metrics-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  border-bottom: 2px solid #ddd;
}

#sales-metrics {
  background-color: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

#sales-metrics h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #333;
}

#sales-metrics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

#dealer-metrics {
  background-color: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

#dealer-metrics h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #333;
}

.dealer-table {
  width: 100%;
  border-collapse: collapse;
}

.dealer-table th {
  background-color: #f5f5f5;
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  text-transform: uppercase;
  color: #666;
  border-bottom: 2px solid #ddd;
}

.dealer-table td {
  padding: 10px 16px;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

.dealer-table tr:last-child td {
  border-bottom: none;
}

.dealer-total-row td {
  font-weight: bold;
  background-color: #f9f0f9;
  border-top: 2px solid #ddd;
}

.metric-card {
  border-radius: 8px;
  padding: 20px 24px;
  text-align: center;
  border: 1px solid #ddd;
  box-sizing: border-box;
}

.metric-total {
  width: 100%;
  background-color: #f9f0f9;
  border-color: #760176;
}

.metric-total .metric-value {
  font-size: 48px;
  font-weight: bold;
  color: #760176;
}

.metric-total .metric-label {
  font-size: 14px;
  text-transform: uppercase;
  color: #760176;
  margin-top: 4px;
}

.metric-status-card {
  flex: 1;
  min-width: 140px;
}

.metric-value {
  font-size: 36px;
  font-weight: bold;
}

.metric-label {
  font-size: 12px;
  text-transform: uppercase;
  margin-top: 4px;
}

.metric-pct {
  font-size: 13px;
  margin-top: 6px;
  font-weight: bold;
  opacity: 0.8;
}

#item-metrics {
  background-color: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

#item-metrics h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #333;
}

#item-metrics-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* ============================================================
   Modal — overlay, content box, form fields, and actions
============================================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-box {
  background-color: white;
  padding: 32px;
  border-radius: 8px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-box h2 {
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  align-items: center;
}

.modal-actions .dashboard-btn {
  width: 100px;
  padding: 10px 0;
  text-align: center;
  box-sizing: border-box;
  margin-bottom: 0;
}

.modal-actions .cancel-btn {
  width: 100px;
  padding: 10px 0;
  text-align: center;
  box-sizing: border-box;
  margin-bottom: 0;
}

.modal-box .form-label {
  display: block;
  font-size: 14px;
  margin-bottom: 6px;
  color: #333;
  margin-top: 12px;
}

.modal-box .form-input {
  display: block;
  width: 100%;
  padding: 10px;
  margin-bottom: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
}

.modal-box .form-input:focus {
  outline: none;
  border-color: #760176;
}

/* ============================================================
   Buttons — shared button styles used across pages
============================================================ */
.dashboard-btn {
  padding: 10px 20px;
  background-color: #760176;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 24px;
}

.dashboard-btn:hover {
  background-color: #5a015a;
}

.cancel-btn {
  padding: 10px 20px;
  background-color: #eee;
  color: #333;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.cancel-btn:hover {
  background-color: #ddd;
}

.back-btn {
  display: inline-block;
  margin-bottom: 20px;
  padding: 8px 16px;
  background-color: #eee;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.back-btn:hover {
  background-color: #ddd;
}

.edit-btn {
  padding: 6px 16px;
  background-color: #760176;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  width: 160px;
  text-align: center;
}

.edit-btn:hover {
  background-color: #5a015a;
}

.edit-input {
  font-size: 13px;
  padding: 6px 8px;
  margin-top: 4px;
  width: 160px;
}

.promote-btn {
  padding: 6px 16px;
  background-color: #760176;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  width: 160px;
  text-align: center;
}

.promote-btn:hover {
  background-color: #5a015a;
}

.reject-btn {
  padding: 6px 16px;
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  width: 160px;
  text-align: center;
}

.reject-btn:hover {
  background-color: #c0392b;
}

.rejected-reason {
  font-size: 12px;
  color: #5a015a;
  margin-top: 4px;
  text-align: left;
}

.remove-btn {
  width: 80px;
  padding: 6px 0;
  background-color: #e74c3c;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
}

.remove-btn:hover {
  background-color: #c0392b;
}

.donate-btn {
  padding: 10px 20px;
  background-color: #760176;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  width: 140px;
  text-align: center;
}

.donate-btn:hover {
  background-color: #5a015a;
}

#inventory-buttons .dashboard-btn {
  width: 140px;
  text-align: center;
  margin-bottom: 0;
}

/* ============================================================
   Payment check
============================================================ */
.payment-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 14px;
}

.payment-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* ============================================================
   Unpaid indicators
============================================================ */
.unpaid-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.unpaid-tag {
  display: inline-block;
  padding: 2px 8px;
  background-color: #fce4ec;
  color: #c62828;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  width: fit-content;
}

.unpaid-warning {
  display: inline-block;
  padding: 2px 8px;
  background-color: #c62828;
  color: white;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  margin-left: 6px;
}

/* ============================================================
   Unpaid metrics section
============================================================ */
#unpaid-metrics {
  background-color: white;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
  border-left: 4px solid #c62828;
}

#unpaid-metrics h3 {
  font-size: 16px;
  margin-bottom: 16px;
  color: #c62828;
}

.unpaid-job-row {
  display: flex;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
  font-size: 14px;
  align-items: center;
  cursor: pointer;
}

.unpaid-job-row:hover {
  background-color: #fce4ec;
}

.unpaid-job-row:last-child {
  border-bottom: none;
}

.unpaid-job-id {
  font-weight: bold;
  color: #760176;
  min-width: 140px;
}

.unpaid-job-name {
  flex: 1;
}

.unpaid-job-tags {
  display: flex;
  gap: 8px;
}

/* ============================================================
   Recently modified section
============================================================ */
#recently-modified {
  background-color: white;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #760176;
}

#recently-modified-title {
  font-size: 14px;
  text-transform: uppercase;
  color: #760176;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.recent-job-row {
  display: flex;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  cursor: pointer;
  font-size: 13px;
  align-items: center;
}

.recent-job-row:last-child {
  border-bottom: none;
}

.recent-job-row:hover {
  background-color: #f9f0f9;
}

.recent-job-id {
  font-weight: bold;
  color: #760176;
  min-width: 120px;
}

.recent-job-name {
  flex: 1;
}

.recent-job-status {
  color: #666;
  min-width: 100px;
}

.recent-job-time {
  color: #999;
  font-size: 12px;
  min-width: 140px;
}