/* ============================================================
   dashboard_mobile.css
   Mobile card view + status legend + responsive switch.
   Loads AFTER the inline <style>, so these rules win ties.
   Desktop (>900px): table shown, cards hidden.
   Mobile  (<=900px): cards shown, table hidden.
   ============================================================ */

/* ---- Status legend ---- */
.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px 14px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 13px;
  color: #374151;
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 11px; height: 11px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.legend-dot.good     { background: #16a34a; }
.legend-dot.due-soon { background: #d97706; }
.legend-dot.past-due { background: #dc2626; }
.legend-dot.pno      { background: #6b7280; }

/* ---- Card container: hidden on desktop by default ---- */
.equipment-cards { display: none; }
.eq-empty {
  text-align: center;
  padding: 28px 16px;
  color: #6b7280;
  background: #fff;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
}

/* ---- Card ---- */
.eq-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-left: 5px solid #9ca3af;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.eq-card.current  { border-left-color: #16a34a; }
.eq-card.due-soon { border-left-color: #d97706; }
.eq-card.expired  { border-left-color: #dc2626; }
.eq-card.pno      { border-left-color: #6b7280; background: #fafafa; }

.eq-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.eq-card-head-main {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}
.eq-card-plate {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  word-break: break-word;
}
.eq-card-type {
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.eq-status {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.eq-status.current  { background: #dcfce7; color: #166534; }
.eq-status.due-soon { background: #fef3c7; color: #92400e; }
.eq-status.expired  { background: #fee2e2; color: #991b1b; }
.eq-status.pno      { background: #f3f4f6; color: #374151; }

.eq-chevron {
  color: #9ca3af;
  font-size: 13px;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.eq-card.expanded .eq-chevron { transform: rotate(180deg); }

.eq-card-sub {
  font-size: 13px;
  color: #6b7280;
  margin: 8px 0 10px;
}

/* ---- Expiration chips ---- */
.eq-card-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.eq-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  border-radius: 9px;
  text-align: center;
  border: 1px solid transparent;
}
.eq-chip-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.02em; opacity: 0.85; }
.eq-chip-date  { font-size: 14px; font-weight: 700; }
.eq-chip.good     { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.eq-chip.due-soon { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.eq-chip.past-due { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.eq-chip.pno      { background: #f9fafb; color: #4b5563; border-color: #e5e7eb; }

/* ---- Expandable section (docs + actions) ---- */
.eq-card-docs { display: none; margin-top: 12px; padding-top: 12px; border-top: 1px solid #f1f5f9; }
.eq-card.expanded .eq-card-docs { display: block; }

.eq-doc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f8fafc;
  flex-wrap: wrap;
}
.eq-doc-row { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
.eq-doc-label { font-size: 13px; font-weight: 600; color: #374151; }
.eq-doc-missing { font-size: 12px; color: #9ca3af; }
.eq-doc-upload { margin: 0; }

/* ---- Buttons ---- */
.eq-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 12px;
  min-height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}
.eq-btn.view    { background: #eff6ff; color: #1d4ed8; }
.eq-btn.upload  { background: #f3f4f6; color: #374151; }
.eq-btn.edit    { background: #3b82f6; color: #fff; }
.eq-btn.renew   { background: #16a34a; color: #fff; }
.eq-btn.delete  { background: #dc2626; color: #fff; }

.eq-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.eq-card-actions .eq-btn { flex: 1 1 auto; justify-content: center; }

/* ============================================================
   RESPONSIVE SWITCH
   ============================================================ */
@media (max-width: 900px) {
  /* Hide the wide table, show cards */
  .table-container { display: none !important; }
  .equipment-cards {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  /* Roomier, stacked header + filters */
  .dashboard-container { padding: 12px !important; }
  .header-top { flex-direction: column; align-items: stretch; gap: 10px; }
  .header-actions { flex-direction: column; align-items: stretch; gap: 10px; width: 100%; }
  .search-container { width: 100%; }
  .search-input { width: 100%; box-sizing: border-box; }

  .filter-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .filter-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }
  .filter-label { white-space: nowrap; }
  .filter-select { flex: 1 1 auto; min-width: 0; }
  .filter-btn, .sort-btn { width: 100%; justify-content: center; }

  /* Add-equipment form: single column so it isn't cramped */
  .form-grid { grid-template-columns: 1fr !important; }
}

/* Small phones: chips stack to 1 column if too tight */
@media (max-width: 380px) {
  .eq-card-chips { grid-template-columns: 1fr; }
}

/* ============================================================
   View tabs (company / type navigation)
   ============================================================ */
.tab-hidden { display: none !important; }

.view-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
}
.view-tab {
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
}
.view-tab:hover { border-color: #9ca3af; }
.view-tab.active { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.all-tab { font-weight: 700; }

.tab-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
}
.tab-group-label {
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 6px;
  white-space: nowrap;
}
.tab-group .view-tab { padding: 5px 11px; font-size: 12px; }

@media (max-width: 900px) {
  .view-tabs { gap: 8px; }
  .tab-group {
    width: 100%;
    flex-wrap: wrap;
    border-radius: 12px;
  }
  .tab-group-label { width: 100%; padding: 2px 4px 4px; }
  .tab-group .view-tab { flex: 1 1 auto; text-align: center; justify-content: center; }
  .all-tab { width: 100%; text-align: center; }
}