/* ==========================================
   LOVABLE DASHBOARD LAYOUT
   ========================================== */

.dashboard-container {
  padding: 40px;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Header styling */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 24px;
}

.dash-header-title h2 {
  font-size: 2.25rem; /* 36px */
  letter-spacing: -0.9px;
  line-height: 1.1;
  margin-bottom: 6px;
}

.dash-header-title p {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.dash-actions {
  display: flex;
  gap: 12px;
}

/* Stats Metrics Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.stat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--border-color);
  background: var(--bg-app);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 2.25rem; /* 36px */
  font-weight: 600;
  letter-spacing: -0.9px;
  color: var(--charcoal);
  line-height: 1.1;
}

.stat-change {
  font-size: 0.75rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.stat-change.up {
  color: var(--color-pass);
}

.stat-change.down {
  color: var(--color-warn);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: var(--charcoal);
  border: 1px solid var(--border-color);
}

/* Main Dashboard Sections Split */
.dashboard-sections {
  display: grid;
  grid-template-columns: 1.4fr 0.6fr;
  gap: 32px;
}

/* Tables and filters */
.dashboard-table-card {
  padding: 0;
  overflow: hidden;
}

.card-header {
  padding: 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.card-header h3 {
  font-size: 1.25rem;
  font-weight: 500;
}

.table-filters {
  display: flex;
  gap: 4px;
}

.filter-tab {
  padding: 6px 12px;
  border-radius: var(--radius-btn);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.filter-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.filter-tab.active {
  color: var(--text-primary);
  background: var(--bg-app);
  border-color: var(--border-interactive);
}

/* Table Design */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: var(--bg-tint);
  padding: 14px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
}

td {
  padding: 16px 20px;
  font-size: 0.92rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-body);
}

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

tr:hover td {
  background: var(--bg-tint);
}

/* Custom form inputs inside tables */
.tech-assign-select {
  padding: 4px 8px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border-color);
  background: var(--bg-app);
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-primary);
}

.tech-assign-select:focus {
  border-color: var(--border-interactive);
}

/* SVG Chart details */
.chart-container {
  height: 180px;
  margin-top: 16px;
  position: relative;
  width: 100%;
}

.chart-svg {
  overflow: visible;
}

/* Point hover glow effects */
.chart-point:hover {
  r: 6;
  fill: var(--charcoal) !important;
}

/* Side Info Columns */
.side-cards-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Warning & Alerts panel lists */
.alerts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-compact);
  background: rgba(220, 38, 38, 0.03);
  border: 1px solid rgba(220, 38, 38, 0.15);
}

.alert-item.warning {
  background: rgba(217, 119, 6, 0.03);
  border: 1px solid rgba(217, 119, 6, 0.15);
}

.alert-item-icon {
  margin-top: 2px;
  font-size: 0.95rem;
}

.alert-item-icon i {
  color: var(--color-fail);
}

.alert-item.warning .alert-item-icon i {
  color: var(--color-warn);
}

.alert-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alert-title {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-primary);
}

.alert-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* Techs Monitor list item */
.tech-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tech-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.tech-item:last-child {
  border-bottom: none;
}

.tech-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tech-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
}

.tech-info {
  display: flex;
  flex-direction: column;
}

.tech-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.tech-status-txt {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Report details layouts */
.inspection-report-viewer {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.insp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.insp-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insp-meta h4 {
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}

.insp-meta-row {
  display: flex;
  gap: 16px;
  font-size: 0.88rem;
  color: var(--text-body);
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.score-circle {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-pill);
  border: 3px solid var(--color-pass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--color-pass);
}

.score-circle.warning {
  border-color: var(--color-warn);
  color: var(--color-warn);
}

.score-circle.danger {
  border-color: var(--color-fail);
  color: var(--color-fail);
}

.score-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.report-notes {
  background: var(--bg-hover);
  padding: 16px;
  border-radius: var(--radius-compact);
  font-size: 0.9rem;
  border-left: 3px solid var(--charcoal);
  color: var(--text-body);
  line-height: 1.4;
}

.report-checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.report-checklist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-compact);
  background: var(--bg-app);
  border: 1px solid var(--border-color);
}

.report-checklist-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrapper i {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.search-wrapper .input-control {
  padding-left: 36px;
  width: 240px;
}

@media (max-width: 1024px) {
  .dashboard-sections {
    grid-template-columns: 1fr;
  }
  
  .dashboard-container {
    padding: 24px;
  }
}

/* ==========================================
   MODAL OVERLAY
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.modal-overlay.open {
  display: flex;
  animation: modalFadeIn 0.18s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-content {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-container);
  padding: 0;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s ease;
}

.modal-close-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 0;
}

.input-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.input-control {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-btn);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: border-color 0.12s ease;
  margin-bottom: 0;
}

.input-control:focus {
  border-color: var(--border-interactive);
  outline: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  margin-top: 8px;
}

/* Badge styles */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-pass   { background: rgba(16, 185, 129, 0.1); color: var(--color-pass); }
.badge-fail   { background: rgba(220, 38, 38, 0.1);  color: var(--color-fail); }
.badge-warn   { background: rgba(217, 119, 6, 0.1);  color: var(--color-warn); }
.badge-info   { background: rgba(37, 99, 235, 0.1);  color: var(--color-info); }

/* Utility */
.d-none { display: none !important; }

/* Legacy tab-content (kept for compatibility) */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Page fade-in animation */
.lm-page-content {
  animation: pageIn 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Mechanic shift cards */
.tech-shift-card {
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 20px;
  transition: border-color 0.12s ease;
}

.tech-shift-card:hover {
  border-color: var(--border-interactive);
}

/* Responsive for mobile */
@media (max-width: 768px) {
  .lm-page-content {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

