/* ==========================================================================
   JDM HUNTER - COMPONENTS STYLESHEET
   Cards, Photo Gallery, Valuation Meters, Landed Cost, Modals, Toasts
   ========================================================================== */

/* Vehicle Listing Card */
.car-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
  position: relative;
}

.car-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

/* Card Media / Photo Preview */
.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000;
  overflow: hidden;
  cursor: pointer;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.car-card:hover .card-img {
  transform: scale(1.04);
}

/* Photo Badges & Counter */
.media-badges-top {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.badge-25yr {
  background: rgba(16, 185, 129, 0.9);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow-sm);
}

.badge-source {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

.photo-count-pill {
  position: absolute;
  bottom: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  backdrop-filter: blur(4px);
}

/* Card Watchlist Star Button */
.watch-star-btn {
  position: absolute;
  bottom: 0.75rem;
  left: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
  backdrop-filter: blur(4px);
  z-index: 5;
}

.watch-star-btn:hover {
  color: var(--accent-gold);
  transform: scale(1.15);
}

.watch-star-btn.watched {
  color: var(--accent-gold);
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--accent-gold);
}

/* Card Content Body */
.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title-row {
  margin-bottom: 0.6rem;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.25;
}

.card-chassis {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cyan);
  font-weight: 600;
  margin-top: 0.15rem;
}

/* Specs Strip */
.card-specs-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.spec-chip {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

.spec-chip.spec-highlight {
  color: var(--accent-gold);
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.08);
}

.spec-chip.spec-manual {
  color: var(--accent-blue-light);
  border-color: rgba(37, 99, 235, 0.3);
}

/* Price Row & Landed Estimate */
.card-price-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.price-main-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.price-usd {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.price-yen {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.landed-cost-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border-subtle);
}

.landed-cost-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-emerald);
}

/* Deal / Market Value Meter */
.card-deal-meter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.75rem;
}

.deal-tag {
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.deal-great { background: rgba(16, 185, 129, 0.2); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.4); }
.deal-good { background: rgba(59, 130, 246, 0.2); color: var(--accent-blue-light); border: 1px solid rgba(59, 130, 246, 0.4); }
.deal-fair { background: rgba(148, 163, 184, 0.15); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.deal-premium { background: rgba(245, 158, 11, 0.15); color: var(--accent-gold); border: 1px solid rgba(245, 158, 11, 0.4); }
.deal-high { background: rgba(225, 29, 72, 0.15); color: var(--accent-red); border: 1px solid rgba(225, 29, 72, 0.4); }

.price-drop-indicator {
  color: var(--accent-emerald);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* Card Dealer & Action Buttons */
.card-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.dealer-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dealer-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.card-action-btns {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.btn-details {
  background: var(--accent-blue);
  color: #fff;
  border: none;
  padding: 0.55rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background var(--transition-fast);
}

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

.btn-source-link {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.btn-source-link:hover {
  color: #fff;
  border-color: var(--text-secondary);
  text-decoration: none;
}

/* Table View Styling */
.cars-table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.cars-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.cars-table th {
  background: var(--bg-card);
  padding: 0.85rem 1rem;
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-strong);
  white-space: nowrap;
}

.cars-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.cars-table tr:hover td {
  background: var(--bg-card-hover);
}

.table-thumb {
  width: 64px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

/* ==========================================================================
   MODALS (Car Detail, Landed Cost Calculator, Alerts Manager)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 1050px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform var(--transition-smooth);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 10;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
}

.modal-close-btn:hover {
  background: var(--bg-card-hover);
  color: #fff;
}

.modal-body {
  padding: 1.5rem;
}

/* Tab Navigation in Modal */
.modal-nav-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  gap: 0.5rem;
}

.modal-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-tab-btn:hover {
  color: #fff;
}

.modal-tab-btn.active {
  color: var(--accent-blue-light);
  border-bottom-color: var(--accent-blue);
}

/* Detail Modal Gallery Carousel */
.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.gallery-main-view {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: zoom-in;
}

.gallery-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.85) 0%, transparent 100%);
  padding: 1rem;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.gallery-filmstrip {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.strip-thumb {
  width: 100px;
  height: 65px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.7;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.strip-thumb:hover {
  opacity: 1;
}

.strip-thumb.active {
  border-color: var(--accent-blue);
  opacity: 1;
}

/* Translation Side-by-Side Box */
.translation-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.translation-col-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.trans-notes-text {
  font-size: 0.85rem;
  line-height: 1.6;
  white-space: pre-line;
}

.trans-notes-text.ja {
  color: var(--text-secondary);
  font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
}

.trans-notes-text.en {
  color: var(--text-primary);
}

/* Auction Inspection Sheet Viewer */
.inspection-viewer {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.inspection-points-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.inspect-point-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.inspect-code-badge {
  background: var(--accent-red);
  color: #fff;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

/* Landed Cost Breakdown Card inside Modal */
.landed-cost-calculator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.calc-inputs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.cost-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.cost-breakdown-table tr {
  border-bottom: 1px solid var(--border-subtle);
}

.cost-breakdown-table td {
  padding: 0.6rem 0;
}

.cost-breakdown-table td.val-col {
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
}

.cost-total-row {
  border-top: 2px solid var(--border-strong);
  font-size: 1.1rem;
  font-weight: 800;
}

.cost-total-row td {
  padding-top: 1rem;
  color: var(--accent-emerald);
}

/* Toast Notifications Container */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
  pointer-events: none;
}

.jdm-toast {
  background: #181d29;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  pointer-events: auto;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.jdm-toast:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
}

.toast-indicator {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--accent-red);
}

.toast-thumb {
  width: 58px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.toast-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toast-body {
  flex: 1;
}

.toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}

.toast-tag {
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent-gold);
  text-transform: uppercase;
}

.toast-time {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.toast-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.toast-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

.toast-price {
  color: var(--accent-emerald);
  font-family: var(--font-mono);
  font-weight: 700;
}

.toast-loc {
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
}

/* Lightbox Fullscreen Overlay */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.lightbox-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-img-wrapper {
  max-width: 90vw;
  max-height: 80vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 40px rgba(0,0,0,0.9);
}

.lightbox-controls {
  position: absolute;
  bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lightbox-nav-btn {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.lightbox-nav-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lightbox-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Compare Drawer */
.compare-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-top: 2px solid var(--accent-blue);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  transform: translateY(100%);
  transition: transform var(--transition-smooth);
  padding: 1rem 1.5rem;
}

.compare-drawer.active {
  transform: translateY(0);
}

.compare-inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.compare-items-row {
  display: flex;
  gap: 1rem;
}

.compare-item-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
}

.compare-item-thumb {
  width: 40px;
  height: 30px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* Animations */
@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.animate-slide-in {
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-fade-out {
  animation: fadeOut 0.35s ease forwards;
}

/* ==========================================================================
   MOBILE RESPONSIVE OVERRIDES
   ========================================================================== */
@media (max-width: 768px) {
  .modal-dialog {
    max-height: 95vh;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-title {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  /* Scroll the tab strip horizontally instead of wrapping/squishing five
     tabs into a too-narrow column */
  .modal-nav-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }

  .modal-tab-btn {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .translation-container {
    grid-template-columns: 1fr;
  }

  .card-action-btns {
    grid-template-columns: 1fr;
  }

  .lightbox-img-wrapper {
    max-width: 92vw;
  }
}
