/* ====== Cruz Group Auto — Custom Styles ====== */

/* Form inputs */
.form-input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  background-color: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.form-input:focus {
  border-color: #fcc600;
  box-shadow: 0 0 0 3px rgba(252, 198, 0, 0.25);
}
.form-input::placeholder {
  color: #94a3b8;
}

/* Filter chips */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 500;
  background-color: #fff;
  color: #475569;
  border: 1px solid #e2e8f0;
  transition: all 0.15s;
  white-space: nowrap;
  cursor: pointer;
}
.filter-chip:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}
.filter-chip.active {
  background-color: #0a0a0a;
  color: #fcc600;
  border-color: #0a0a0a;
  box-shadow: 0 0 0 2px rgba(252, 198, 0, 0.35);
}
.chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.125rem;
  padding: 0 0.375rem;
  background-color: rgba(15, 23, 42, 0.08);
  color: inherit;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  line-height: 1;
}
.filter-chip.active .chip-count {
  background-color: rgba(252, 198, 0, 0.2);
  color: #fcc600;
}
.filter-chip[data-filter="archived"] {
  color: #64748b;
}
.filter-chip[data-filter="archived"].active {
  background-color: #334155;
  color: #fff;
  border-color: #334155;
  box-shadow: none;
}
.filter-chip[data-filter="archived"].active .chip-count {
  background-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Vehicle tile card */
.vehicle-tile {
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.tile-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  flex: 1;
}
.vehicle-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  border-color: #fcd34d;
}
.vehicle-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #fcc600, #fbbf24);
  opacity: 0;
  transition: opacity 0.15s;
}
.vehicle-tile:hover::before {
  opacity: 1;
}

/* Status badge styles */
.status-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  white-space: nowrap;
  max-width: calc(100% - 2.5rem);
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background-color: currentColor;
}
.status-intake        { background-color: #dbeafe; color: #1d4ed8; }
.status-in-progress   { background-color: #fef3c7; color: #b45309; }
.status-waiting-parts { background-color: #fee2e2; color: #b91c1c; }
.status-ready         { background-color: #d1fae5; color: #047857; }
.status-balance-due   { background-color: #dc2626; color: #ffffff; }
.status-completed     { background-color: #e2e8f0; color: #475569; }

/* Sticky-note style accent on tile (subtle nod to your reference image) */
.tile-vehicle-name {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  color: #0f172a;
  letter-spacing: -0.01em;
}
@media (min-width: 640px) {
  .tile-vehicle-name { font-size: 1.0625rem; }
}
.tile-customer {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
}
.tile-notes {
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile-meta {
  font-size: 0.6875rem;
  color: #94a3b8;
  margin-top: auto;
  padding-top: 0.25rem;
}

/* Balance-due amount shown on the tile */
.tile-balance {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  margin-top: 0.125rem;
}
.tile-balance-amount {
  font-size: 1.0625rem;
  font-weight: 800;
  color: #b91c1c;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.tile-balance-label {
  font-size: 0.6875rem;
  color: #b91c1c;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  opacity: 0.7;
}
@media (min-width: 640px) {
  .tile-balance-amount { font-size: 1.125rem; }
}

/* Smooth modal entrance */
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
#form-modal:not(.hidden) > div > div,
#detail-modal:not(.hidden) > div > div {
  animation: modalIn 0.18s ease-out;
}

/* Hide ugly number input spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

/* ===== PIN input boxes — state styles only (size/colors come from Tailwind classes inline) ===== */
.pin-digit {
  -moz-appearance: textfield;
  caret-color: transparent;
}
.pin-digit::-webkit-outer-spin-button,
.pin-digit::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pin-digit.filled {
  background-color: #fff !important;
  border-color: #fcc600 !important;
  box-shadow: 0 0 0 3px rgba(252, 198, 0, 0.18);
}
.pin-digit.error {
  border-color: #ef4444 !important;
  background-color: #fef2f2 !important;
  color: #b91c1c !important;
}
.pin-digit.success {
  border-color: #10b981 !important;
  background-color: #d1fae5 !important;
  color: #047857 !important;
  transform: scale(1.02);
}

@keyframes successPulse {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  50%  { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
#pin-container.success .pin-digit {
  animation: successPulse 0.5s ease;
}

/* Shake animation on wrong PIN */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
#pin-container.shake {
  animation: shake 0.4s ease;
}

/* ===== Tile edit button ===== */
.tile-edit-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  background-color: rgba(255, 255, 255, 0.95);
  color: #334155;
  border: 1px solid #e2e8f0;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.15s, border-color 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.tile-edit-btn:hover {
  background-color: #fcc600;
  color: #0a0a0a;
  border-color: #fcc600;
  transform: scale(1.06);
}
.tile-edit-btn:active {
  transform: scale(0.95);
}
.tile-edit-btn svg {
  width: 1rem;
  height: 1rem;
}

/* ===== Photo preview / tile photo ===== */
.tile-photo {
  display: block;
  width: 100%;
  height: 9rem;
  object-fit: cover;
  background-color: #f1f5f9;
}
@media (min-width: 640px) {
  .tile-photo { height: 10rem; }
}

/* ===== Tile photo wrap with photo count ===== */
.tile-photo-wrap {
  position: relative;
  width: 100%;
}
.tile-photo-count {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  background-color: rgba(10, 10, 10, 0.8);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 9999px;
  backdrop-filter: blur(4px);
}

/* ===== Clickable status badge on tile ===== */
.tile-status-btn {
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.1s, box-shadow 0.1s;
}
.tile-status-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* ===== Status menu (popover) ===== */
.status-menu {
  position: absolute;
  z-index: 60;
  min-width: 12rem;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.18), 0 4px 8px -4px rgba(0, 0, 0, 0.08);
  padding: 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  animation: menuIn 0.12s ease-out;
}
@keyframes menuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.status-menu-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border: none;
  background: none;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #334155;
  border-radius: 0.5rem;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
}
.status-menu-item:hover {
  background-color: #f1f5f9;
}
.status-menu-item.is-current {
  color: #0a0a0a;
  font-weight: 600;
  background-color: #fffbeb;
}
.status-dot {
  display: inline-block;
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 9999px;
  flex-shrink: 0;
}
.status-dot.status-intake        { background-color: #2563eb; }
.status-dot.status-in-progress   { background-color: #d97706; }
.status-dot.status-waiting-parts { background-color: #dc2626; }
.status-dot.status-ready         { background-color: #059669; }
.status-dot.status-balance-due   { background-color: #dc2626; }
.status-dot.status-completed     { background-color: #64748b; }

/* ===== Photo thumbnails (form) ===== */
.photo-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #f1f5f9;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
}
.photo-thumb:hover { transform: scale(1.02); }
.photo-thumb.is-primary {
  border-color: #fcc600;
  cursor: default;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-thumb-tag {
  position: absolute;
  top: 0.25rem;
  left: 0.25rem;
  background-color: #fcc600;
  color: #0a0a0a;
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}
.photo-thumb-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background-color: rgba(10, 10, 10, 0.7);
  color: #fff;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background-color 0.15s;
}
.photo-thumb-remove:hover {
  background-color: #dc2626;
}

/* Detail-modal gallery thumbnails */
.gallery-thumb {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
  cursor: zoom-in;
  width: 100%;
}
.gallery-thumb:hover {
  transform: scale(1.03);
  border-color: #fcc600;
}
.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ===== Service log: form entries ===== */
.log-entry-row {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
}
.log-entry-meta {
  font-size: 0.6875rem;
  color: #94a3b8;
  font-weight: 600;
  flex-shrink: 0;
  white-space: nowrap;
  padding-top: 0.0625rem;
}
.log-entry-text {
  flex: 1;
  color: #334155;
  word-break: break-word;
}
.log-entry-remove {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.125rem;
  border-radius: 0.25rem;
  flex-shrink: 0;
  transition: background-color 0.15s, color 0.15s;
}
.log-entry-remove:hover {
  color: #dc2626;
  background-color: #fee2e2;
}

/* ===== Service log: detail-modal timeline ===== */
.log-timeline {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  position: relative;
  padding-left: 0.75rem;
}
.log-timeline::before {
  content: '';
  position: absolute;
  left: 0.3125rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background-color: #e2e8f0;
}
.log-tl-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  position: relative;
}
.log-tl-dot {
  position: absolute;
  left: -0.6875rem;
  top: 0.375rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 9999px;
  background-color: #fcc600;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #e2e8f0;
  flex-shrink: 0;
}
.log-tl-content {
  flex: 1;
  padding-left: 0.5rem;
}
.log-tl-date {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.125rem;
}
.log-tl-text {
  font-size: 0.875rem;
  color: #334155;
  line-height: 1.5;
}

/* ===== View toggle ===== */
.view-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  background: transparent;
  color: #64748b;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.view-toggle:hover { color: #334155; }
.view-toggle.active {
  background-color: #fff;
  color: #0a0a0a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ===== Customer cards (Customers view) ===== */
.customer-card {
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.875rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.customer-card:hover {
  border-color: #fcd34d;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.08);
}
.customer-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.customer-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background-color: #0a0a0a;
  color: #fcc600;
  font-weight: 700;
  font-size: 0.9375rem;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.customer-name {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.customer-meta {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0.125rem 0 0;
}
.customer-contact {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8125rem;
  color: #475569;
}
.customer-contact-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  padding: 0.125rem 0;
}
.customer-contact-row[href]:hover {
  color: #0a0a0a;
}
.customer-vehicles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-top: 1px solid #e2e8f0;
  padding-top: 0.625rem;
}
.customer-vehicle-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  background: none;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  color: #334155;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all 0.15s;
  width: 100%;
}
.customer-vehicle-row:hover {
  background-color: #f8fafc;
  border-color: #e2e8f0;
}
.customer-vehicle-name {
  font-weight: 600;
  color: #0f172a;
  flex: 1;
}
.customer-vehicle-status {
  font-size: 0.6875rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Archived tile — desaturated and softened */
.vehicle-tile.archived {
  opacity: 0.7;
  background-color: #fafafa;
}
.vehicle-tile.archived .tile-photo {
  filter: grayscale(0.6);
}
.vehicle-tile.archived:hover {
  opacity: 1;
}

/* ===== Payments / Balance Summary ===== */
.payment-add-row {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  padding: 0.625rem;
}
.payment-add-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}
.payment-add-grid > .form-input.hidden {
  display: none;
}
.payment-add-grid > input[id$="-pay-detail"]:not(.hidden) {
  grid-column: 1 / -1;
}

.payment-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  flex-wrap: wrap;
}
.payment-amount {
  font-weight: 700;
  color: #0f172a;
}
.payment-method {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  background-color: #f1f5f9;
  color: #475569;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.payment-date {
  font-size: 0.6875rem;
  color: #94a3b8;
  font-weight: 600;
}
.payment-note {
  flex: 1;
  font-size: 0.75rem;
  color: #64748b;
  font-style: italic;
}
.payment-remove,
.payment-edit {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 0.25rem;
  flex-shrink: 0;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.payment-edit { margin-left: auto; }
.payment-remove { margin-left: 0; }
.payment-edit:hover {
  color: #fcc600;
  background-color: #fffbeb;
}
.payment-remove:hover {
  color: #dc2626;
  background-color: #fee2e2;
}

/* Log entry edit button (mirrors payment-edit) */
.log-entry-edit {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 0.125rem;
  border-radius: 0.25rem;
  flex-shrink: 0;
  transition: all 0.15s;
}
.log-entry-edit:hover {
  color: #fcc600;
  background-color: #fffbeb;
}

/* Editing-mode highlight for the bottom Add Payment / Add Log button */
button.editing-mode {
  background-color: #fcc600 !important;
  color: #0a0a0a !important;
  box-shadow: 0 0 0 3px rgba(252, 198, 0, 0.25);
}
.payment-row-readonly { padding: 0.4375rem 0.625rem; }

/* Balance summary block */
.balance-summary {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  padding: 0.625rem 0.875rem;
}
.financial-summary {
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  padding: 0.75rem 1rem;
}
.bs-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8125rem;
  padding: 0.1875rem 0;
  color: #475569;
}
.bs-row > span:last-child {
  font-weight: 600;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}
.bs-balance {
  margin-top: 0.5rem;
  padding-top: 0.625rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.9375rem;
  font-weight: 700;
  align-items: center;
}
.bs-balance > span:first-child {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8125rem;
  font-weight: 700;
}
.bs-balance > span:last-child { font-size: 1.5rem; letter-spacing: -0.02em; }
.bs-balance.is-due > span { color: #b91c1c; }
.bs-balance.is-paid > span { color: #059669; }
.bs-balance.is-credit > span { color: #2563eb; }

