/* ============================================================
   PulseFleet — Heat Treatment Module Styles
   ============================================================ */

/* ── Mode Toggle ──────────────────────────────────────── */
.mode-toggle {
  display: flex;
  background: var(--bg-secondary, rgba(255,255,255,0.06));
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.mode-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary, #a1a1aa);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.mode-btn.active {
  background: #0a6b5c;
  color: #fff;
  box-shadow: 0 2px 8px rgba(10,107,92,0.3);
}
.mode-btn svg {
  width: 16px;
  height: 16px;
}
.mode-btn:hover:not(.active) {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary, #fafafa);
}

/* ── HT Views Container ──────────────────────────────── */
#ht-views {
  padding: 20px;
  max-width: 100%;
  overflow-x: hidden;
}

/* ── KPI Row ─────────────────────────────────────────── */
.ht-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.ht-kpi-row .kpi-card {
  background: var(--bg-secondary, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}
.ht-kpi-row .kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary, #fafafa);
  line-height: 1;
  margin-bottom: 4px;
}
.ht-kpi-row .kpi-label {
  font-size: 0.75rem;
  color: var(--text-secondary, #a1a1aa);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ht-owned { color: #2CB397; }
.ht-rented { color: #f59e0b; }
.kpi-warning { border-color: rgba(239,68,68,0.3); background: rgba(239,68,68,0.06); }
.kpi-warning .kpi-value { color: #ef4444; }

/* ── Tab Bar ─────────────────────────────────────────── */
.ht-tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-secondary, rgba(255,255,255,0.04));
  border-radius: 10px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.ht-tab-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary, #a1a1aa);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.ht-tab-btn.active {
  background: rgba(44,179,151,0.15);
  color: #2CB397;
}
.ht-tab-btn:hover:not(.active) {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary, #fafafa);
}

/* ── Tables ──────────────────────────────────────────── */
.ht-table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border, rgba(255,255,255,0.08));
}
.ht-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}
.ht-table th {
  background: var(--bg-secondary, rgba(255,255,255,0.04));
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary, #a1a1aa);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
  white-space: nowrap;
}
.ht-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.05));
  color: var(--text-primary, #fafafa);
  vertical-align: middle;
}
.ht-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}
.ht-table tbody tr:last-child td {
  border-bottom: none;
}
.ht-serial {
  font-weight: 600;
  color: #2CB397;
}
.ht-mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
}
.ht-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.ht-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary, #a1a1aa);
  cursor: pointer;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.ht-action-btn:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text-primary, #fafafa);
}
.ht-delete-btn:hover {
  background: rgba(239,68,68,0.15);
  color: #ef4444;
}
.ht-row-damaged {
  background: rgba(239,68,68,0.06);
}
.ht-row-damaged:hover {
  background: rgba(239,68,68,0.1);
}

/* ── Badges ──────────────────────────────────────────── */
.ht-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ht-badge-owned { background: rgba(44,179,151,0.15); color: #2CB397; }
.ht-badge-rented { background: rgba(245,158,11,0.15); color: #f59e0b; }
.ht-badge-active { background: rgba(34,197,94,0.15); color: #22c55e; }
.ht-badge-oos { background: rgba(239,68,68,0.15); color: #ef4444; }
.ht-badge-maint { background: rgba(59,130,246,0.15); color: #3b82f6; }
.ht-badge-good { background: rgba(34,197,94,0.15); color: #22c55e; }
.ht-badge-fair { background: rgba(234,179,8,0.15); color: #eab308; }
.ht-badge-poor { background: rgba(249,115,22,0.15); color: #f97316; }
.ht-badge-damaged { background: rgba(239,68,68,0.15); color: #ef4444; }
.ht-badge-ice { background: rgba(59,130,246,0.15); color: #3b82f6; box-shadow: 0 0 8px rgba(59,130,246,0.2); }
.ht-badge-noice { background: transparent; color: var(--text-muted, #52525b); }
.ht-badge-qw { background: rgba(168,85,247,0.15); color: #a855f7; }
.ht-badge-radio-remote { background: rgba(14,165,233,0.15); color: #0ea5e9; }
.ht-badge-radio-master { background: rgba(249,115,22,0.15); color: #f97316; }

/* ── Empty State ─────────────────────────────────────── */
.ht-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary, #a1a1aa);
  font-size: 0.875rem;
}

/* ── Modal ───────────────────────────────────────────── */
#ht-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}
.ht-modal {
  background: var(--bg-primary, #09090b);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 16px;
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0,0,0,0.4);
}
.ht-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
}
.ht-modal-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary, #fafafa);
}
.ht-modal-close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary, #a1a1aa);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ht-modal-close:hover {
  background: rgba(255,255,255,0.08);
}
.ht-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.ht-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border, rgba(255,255,255,0.08));
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Form Fields ─────────────────────────────────────── */
.ht-form-group {
  margin-bottom: 14px;
}
.ht-form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary, #a1a1aa);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ht-form-group input[type="text"],
.ht-form-group input[type="number"],
.ht-form-group select,
.ht-form-group textarea {
  width: 100%;
  padding: 8px 12px;
  background: var(--bg-secondary, rgba(255,255,255,0.06));
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 8px;
  color: var(--text-primary, #fafafa);
  font-size: 0.8125rem;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.ht-form-group input:focus,
.ht-form-group select:focus,
.ht-form-group textarea:focus {
  border-color: #2CB397;
}
.ht-form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.ht-form-check {
  display: flex;
  align-items: center;
}
.ht-form-check label {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  font-size: 0.8125rem;
  color: var(--text-primary, #fafafa);
  cursor: pointer;
}
.ht-form-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #2CB397;
}
.ht-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

/* ── Buttons ─────────────────────────────────────────── */
.ht-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.ht-btn-primary {
  background: #0a6b5c;
  color: #fff;
}
.ht-btn-primary:hover {
  background: #2CB397;
}
.ht-btn-secondary {
  background: var(--bg-secondary, rgba(255,255,255,0.06));
  color: var(--text-secondary, #a1a1aa);
}
.ht-btn-secondary:hover {
  background: rgba(255,255,255,0.1);
}
.ht-btn-danger {
  background: #dc2626;
  color: #fff;
}
.ht-btn-danger:hover {
  background: #ef4444;
}

/* ── Add Button (HT) ────────────────────────────────── */
.ht-add-btn {
  /* Inherits fleet-add-btn styles */
}

/* ── HT Notification Bell ───────────────────────────── */
.ht-notif-bell {
  position: relative;
}
.ht-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ── Damage Report FAB ───────────────────────────────── */
.ht-damage-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #dc2626;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(220,38,38,0.3);
  z-index: 100;
  transition: all 0.15s;
}
.ht-damage-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(220,38,38,0.4);
}

/* ── Pad Select Grid (damage report) ─────────────────── */
.ht-pad-select-grid {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-secondary, rgba(255,255,255,0.04));
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 8px;
  padding: 8px;
}
.ht-pad-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--text-primary, #fafafa);
  cursor: pointer;
}
.ht-pad-check:hover {
  background: rgba(255,255,255,0.06);
}
.ht-pad-check input[type="checkbox"] {
  accent-color: #ef4444;
}

/* ── Photo Grid ──────────────────────────────────────── */
.ht-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.ht-photo-thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border, rgba(255,255,255,0.1));
}
.ht-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Notification Bell ───────────────────────────────── */
.notification-bell {
  position: relative;
}
.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.ht-notification-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-primary, #09090b);
  border: 1px solid var(--border, rgba(255,255,255,0.1));
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.4);
  z-index: 1000;
}
.ht-notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.05));
  cursor: pointer;
  transition: background 0.15s;
}
.ht-notif-item:hover {
  background: rgba(255,255,255,0.04);
}
.ht-notif-item:last-child {
  border-bottom: none;
}
.ht-notif-unread {
  background: rgba(44,179,151,0.06);
  border-left: 3px solid #2CB397;
}
.ht-notif-msg {
  font-size: 0.8125rem;
  color: var(--text-primary, #fafafa);
  line-height: 1.4;
}
.ht-notif-time {
  font-size: 0.6875rem;
  color: var(--text-muted, #52525b);
  margin-top: 4px;
}
.ht-notif-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-secondary, #a1a1aa);
  font-size: 0.8125rem;
}

/* ── Light Theme ─────────────────────────────────────── */
[data-theme="light"] .mode-btn.active {
  background: #0a6b5c;
  color: #fff;
}
[data-theme="light"] .ht-table td {
  color: #09090b;
}
[data-theme="light"] .ht-serial {
  color: #0a6b5c;
}
[data-theme="light"] .ht-modal {
  background: #fff;
}
[data-theme="light"] .ht-form-group input,
[data-theme="light"] .ht-form-group select,
[data-theme="light"] .ht-form-group textarea {
  background: #f4f4f5;
  border-color: #e4e4e7;
  color: #09090b;
}

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .mode-toggle { width: 100%; }
  .mode-btn { flex: 1; justify-content: center; font-size: 0.75rem; padding: 6px 8px; }
  .ht-tab-bar { gap: 2px; padding: 2px; }
  .ht-tab-btn { padding: 6px 10px; font-size: 0.75rem; }
  #ht-views { padding: 12px; }
  .ht-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .ht-modal { max-width: 100%; margin: 10px; border-radius: 12px; }
  .ht-form-row { grid-template-columns: 1fr; }
  .ht-damage-fab { bottom: 80px; right: 16px; }
}
