/* ===========================
   GLOBAL THEME VARIABLES
=========================== */
:root {
  --app-bg: #0f0f11;
  --app-bg-soft: #18181c;
  --app-card-bg: #1c1c22;
  --app-border: #2a2a30;
  --app-text: #f2f2f5;
  --app-text-muted: #cfd3e0;  /* brighter muted text */

  --app-maroon: #7b1e2b;
  --app-maroon-soft: #a32c3d;

  --app-primary: var(--app-maroon);
  --app-primary-hover: var(--app-maroon-soft);

  --radius: 0.7rem;
}

/* ===========================
   PAGE BACKGROUND
=========================== */
body {
  background: radial-gradient(circle at top, #262633 0%, #0b0b10 45%, #050507 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--app-text);
}

/* ===========================
   CARDS
=========================== */
.card {
  background-color: var(--app-card-bg) !important;
  color: var(--app-text);
  border: 1px solid var(--app-border) !important;
  border-radius: var(--radius);
}

.list-group-item {
  background-color: var(--app-card-bg) !important;
  color: var(--app-text) !important;
  border-color: var(--app-border) !important;
}

.list-group-item:hover {
  background-color: var(--app-bg-soft) !important;
}

.card-header {
  background-color: var(--app-bg-soft) !important;
  border-bottom: 1px solid var(--app-border) !important;
  color: var(--app-text);
}

.card-body {
  color: var(--app-text);
}

.card-footer {
  color: var(--app-text-muted);
}

/* ===========================
   TABLES
=========================== */
.table {
  color: var(--app-text);
}

.table-striped > tbody > tr:nth-of-type(odd) {
  background-color: rgba(255, 255, 255, 0.03);
}

.table-hover tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.table-dark th {
  background-color: #111118 !important;
  border-color: var(--app-border);
}

/* ===========================
   NAVBAR
=========================== */
.navbar-dark {
  background-color: #111118 !important;
  border-bottom: 1px solid var(--app-border);
}

.navbar {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.navbar-brand {
  font-weight: 600;
  font-size: 1.2rem;
  margin-right: 1.5rem;
}

.navbar .btn {
  margin-left: 0.25rem;
  margin-right: 0.25rem;
}

.navbar .container-fluid {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ===========================
   BUTTONS
=========================== */
.btn-primary,
.btn-maroon {
  background: linear-gradient(135deg, var(--app-primary), var(--app-maroon-soft));
  border: none !important;
  color: #fff !important;
  font-weight: 600;
}

.btn-primary:hover,
.btn-maroon:hover {
  background: linear-gradient(135deg, var(--app-maroon-soft), var(--app-primary));
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-danger {
  border-radius: var(--radius);
}

.btn-check:checked + .btn.btn-outline-secondary {
  background: linear-gradient(135deg, var(--app-primary), var(--app-maroon-soft)) !important;
  border-color: transparent !important;
  color: #fff !important;
}

/* ===========================
   FORM CONTROLS
=========================== */
.form-control,
.form-select {
  background-color: #111118 !important;
  border-color: #2c2c35 !important;
  color: var(--app-text) !important;
}

.form-control::placeholder {
  color: #8b8fa0 !important;
}

.form-control:focus {
  border-color: var(--app-maroon-soft) !important;
  box-shadow: 0 0 0 0.15rem rgba(123, 30, 43, 0.5) !important;
}

/* ===========================
   LOGIN PAGE
=========================== */
.login-wrapper {
  min-height: 100vh;
}

.login-card {
  background-color: var(--app-card-bg);
  border: 1px solid var(--app-border);
  border-radius: 1rem;
  padding: 2rem;
}

/* keep brand-mark in case you reuse it somewhere */
.brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 30% 20%,
    #ffffff 0,
    #f4f4f4 20%,
    var(--app-maroon-soft) 20%,
    var(--app-maroon) 70%,
    #1a0c0f 100%
  );
  box-shadow: 0 0 0 3px rgba(123, 30, 43, 0.35);
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-headline {
  text-align: center;
}

.login-subtitle {
  text-align: center;
  font-size: 0.85rem;
  color: var(--app-text-muted) !important;
}

.login-footer {
  font-size: 0.75rem;
  color: var(--app-text-muted);
}

/* ===========================
   LINKS
=========================== */
a {
  color: var(--app-maroon-soft);
}

a:hover {
  color: var(--app-maroon);
}

/* ===========================
   TEXT TONES / MUTED FIXES
=========================== */

/* Any .text-muted anywhere should be readable */
.text-muted {
  color: var(--app-text-muted) !important;
}

/* Helper hints under inputs */
.form-text {
  color: var(--app-text-muted) !important;
}

/* Small text inside card footers */
.card-footer small {
  color: var(--app-text-muted) !important;
}
/* ===========================
   EQUIPMENT LIST TABLE (index)
=========================== */

.table-eq {
  background-color: #111118;
}

.table-eq thead th {
  background-color: #14141c !important;
  border-color: var(--app-border);
}

.table-eq tbody tr {
  background-color: #15151f;
}

.table-eq tbody tr:nth-of-type(odd) {
  background-color: #191923;
}

.table-eq tbody tr:hover {
  background-color: #222233;
}

/* ===========================
   PAGINATION (MAROON)
=========================== */

.pagination .page-link {
  background-color: transparent;
  border-color: #2a2a30;
  color: var(--app-text);
}

.pagination .page-link:hover {
  border-color: var(--app-maroon-soft);
  color: var(--app-maroon-soft);
  background-color: rgba(163, 44, 61, 0.08);
}

.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, var(--app-maroon), var(--app-maroon-soft));
  border-color: transparent;
  color: #fff;
}

.pagination .page-item.disabled .page-link {
  color: var(--app-text-muted);
  background-color: transparent;
  border-color: #2a2a30;
}
/* ===========================
   EQUIPMENT LIST TABLE (index)
=========================== */

.table-eq {
  background-color: #111118 !important;   /* override Bootstrap white */
  color: var(--app-text) !important;
}

.table-eq th,
.table-eq td {
  background-color: transparent !important;
  border-color: var(--app-border) !important;
  color: var(--app-text) !important;
}

.table-eq thead th {
  background-color: #14141c !important;
}

.table-eq tbody tr {
  background-color: #15151f !important;
}

.table-eq tbody tr:nth-of-type(odd) {
  background-color: #191923 !important;
}

.table-eq tbody tr:hover {
  background-color: #222233 !important;
}
/* ===========================
   Index card thumbnails
=========================== */

.eq-thumb-wrap {
  width: 130px;
  height: 130px;
  flex: 0 0 130px;
  border-radius: 0.6rem;
  overflow: hidden;
  background-color: #111118;
}

.eq-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.eq-card-meta {
  min-width: 0;
}
/* ===========================
   Dealer Purchase Order UI
=========================== */

.po-toggle-btn {
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  white-space: nowrap;
}

.po-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: 320px;
  max-width: 100%;
  background-color: var(--app-card-bg);
  border-left: 1px solid var(--app-border);
  box-shadow: -12px 0 30px rgba(0,0,0,0.7);
  transform: translateX(100%);
  transition: transform 0.25s ease-out;
  z-index: 1040;
  display: flex;
  flex-direction: column;
}

.po-drawer.open {
  transform: translateX(0);
}

/* Push page content aside when drawer is open */
body {
  transition: padding-right 0.25s ease-out;
  overflow-x: hidden;
}

body.po-drawer-open {
  padding-right: 320px;
}

.po-drawer-header {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--app-border);
  background-color: var(--app-bg-soft);
}

.po-drawer-body {
  padding: 0.75rem 1rem;
  overflow-y: auto;
  flex: 1 1 auto;
}

.po-drawer-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--app-border);
  background-color: var(--app-bg-soft);
}

.po-item {
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(255,255,255,0.08);
}

.po-item:last-child {
  border-bottom: none;
}

.po-drawer-total {
  border-top: 2px solid var(--app-border);
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  padding-bottom: 0.25rem;
}

/* Mobile-only "Added to PO" toast */
.po-mobile-toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.5rem);
  background: #2a7a4b;
  color: #fff;
  padding: 0.55rem 1.1rem;
  border-radius: 2rem;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}
.po-mobile-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===========================
   MODALS — DARK THEME
   Override Bootstrap 5.3 CSS vars so every modal inherits the dark palette.
=========================== */

.modal {
  --bs-modal-color:                var(--app-text);
  --bs-modal-bg:                   var(--app-card-bg);
  --bs-modal-border-color:         var(--app-border);
  --bs-modal-header-bg:            var(--app-bg-soft);
  --bs-modal-header-border-color:  var(--app-border);
  --bs-modal-footer-bg:            var(--app-bg-soft);
  --bs-modal-footer-border-color:  var(--app-border);
  --bs-modal-title-line-height:    1.5;
}

/* Belt-and-braces fallback for any element Bootstrap misses */
.modal-content {
  background-color: var(--app-card-bg) !important;
  color: var(--app-text) !important;
  border-color: var(--app-border) !important;
}
.modal-header { background-color: var(--app-bg-soft) !important; border-bottom-color: var(--app-border) !important; }
.modal-footer { background-color: var(--app-bg-soft) !important; border-top-color:    var(--app-border) !important; }
.modal-body   { background-color: var(--app-card-bg) !important; }

.modal-backdrop { --bs-backdrop-opacity: 0.75; }

/* ===========================
   REJECTION / APPROVAL NOTES THREAD
=========================== */

.notes-thread,
.notes-thread-sm {
  background-color: #111118;
  border: 1px solid var(--app-border) !important;
  border-radius: 0.375rem;
  padding: 0.75rem;
  overflow-y: auto;
}

.notes-thread-sm {
  padding: 0.5rem;
  font-size: 0.82rem;
}

.note-bubble {
  margin-bottom: 0.6rem;
}

.note-body {
  border-radius: 0.25rem;
  padding: 0.4rem 0.6rem;
  font-size: 0.875rem;
  color: var(--app-text);
}

.note-bubble.mine .note-body {
  background: rgba(13, 110, 253, 0.15);
  border-left: 3px solid #4d8eee;
}

.note-bubble.theirs .note-body {
  background: rgba(163, 44, 61, 0.2);
  border-left: 3px solid var(--app-maroon-soft);
}

.note-meta {
  font-size: 0.75rem;
  color: var(--app-text-muted) !important;
  margin-bottom: 0.15rem;
}
