/*
 * ============================================================
 * TeraMonitor
 * Devices NOC UI V3
 * Entrega 1
 * Variables, Grid, Card y Header
 * ============================================================
 */

:root {
  --tm-bg: #f6f7f9;
  --tm-surface: #ffffff;
  --tm-surface-soft: #f8fafc;

  --tm-border: #e5e7eb;
  --tm-border-soft: #eef1f4;

  --tm-text: #111827;
  --tm-text-secondary: #6b7280;
  --tm-text-muted: #9ca3af;

  --tm-primary: #0d6efd;

  --tm-success: #198754;
  --tm-success-soft: #d1e7dd;

  --tm-good: #20c997;
  --tm-good-soft: #d2f4ea;

  --tm-warning: #f59e0b;
  --tm-warning-soft: #fff3cd;

  --tm-danger: #dc3545;
  --tm-danger-soft: #f8d7da;

  --tm-offline: #6c757d;
  --tm-offline-soft: #e9ecef;

  --tm-radius-sm: 8px;
  --tm-radius: 14px;
  --tm-radius-lg: 18px;

  --tm-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);

  --tm-shadow-hover: 0 14px 34px rgba(15, 23, 42, 0.14);

  --tm-transition: 180ms ease;
}

/*
 * ============================================================
 * Base
 * ============================================================
 */

body {
  background: var(--tm-bg);
  color: var(--tm-text);
}

#cardsView {
  width: 100%;
}

/*
 * ============================================================
 * Device Grid
 * ============================================================
 */

.tm-device-grid {
  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(min(100%, 410px), 470px));

  justify-content: center;
  align-items: start;

  gap: 20px;
  width: 100%;
}

/*
 * ============================================================
 * Device Card
 * ============================================================
 */

.tm-device-card {
  position: relative;

  width: 100%;
  min-width: 0;

  background: var(--tm-surface);

  border: 1px solid var(--tm-border);
  border-left: 5px solid transparent;

  border-radius: var(--tm-radius-lg);

  box-shadow: var(--tm-shadow);

  overflow: hidden;

  transition:
    transform var(--tm-transition),
    box-shadow var(--tm-transition),
    border-color var(--tm-transition),
    opacity var(--tm-transition);
}

.tm-device-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--tm-shadow-hover);
}

.tm-device-card.excellent {
  border-left-color: var(--tm-success);
}

.tm-device-card.good {
  border-left-color: var(--tm-good);
}

.tm-device-card.warning {
  border-left-color: var(--tm-warning);
}

.tm-device-card.critical {
  border-left-color: var(--tm-danger);
}

.tm-device-card.offline {
  border-left-color: var(--tm-offline);
  opacity: 0.84;
}

.tm-device-card.offline:hover {
  opacity: 1;
}

/*
 * ============================================================
 * Card Header
 * ============================================================
 */

.tm-card-header {
  padding: 20px 20px 18px;

  background: linear-gradient(
    180deg,
    var(--tm-surface) 0%,
    var(--tm-surface-soft) 100%
  );

  border-bottom: 1px solid var(--tm-border-soft);
}

.tm-device-title {
  display: flex;
  align-items: center;

  gap: 10px;

  min-width: 0;
}

.tm-device-name {
  min-width: 0;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: var(--tm-text);

  font-size: 1.08rem;
  font-weight: 700;
  line-height: 1.25;
}

.tm-device-host {
  margin-top: 7px;
  margin-left: 22px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  color: var(--tm-text-secondary);

  font-size: 0.9rem;
}

.tm-device-location {
  display: flex;
  align-items: center;

  gap: 5px;

  margin-top: 4px;
  margin-left: 22px;

  overflow: hidden;

  color: var(--tm-text-muted);

  font-size: 0.86rem;
}

.tm-device-location i {
  flex: 0 0 auto;
}

.tm-device-location:not(i) {
  text-overflow: ellipsis;
  white-space: nowrap;
}

/*
 * ============================================================
 * Status Dot
 * ============================================================
 */

.tm-status-dot {
  display: inline-block;

  flex: 0 0 auto;

  width: 11px;
  height: 11px;

  border-radius: 50%;

  background: var(--tm-offline);

  box-shadow: 0 0 0 3px rgba(108, 117, 125, 0.14);
}

.tm-status-dot.online {
  background: var(--tm-success);

  box-shadow: 0 0 0 3px rgba(25, 135, 84, 0.14);
}

.tm-status-dot.warning {
  background: var(--tm-warning);

  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.tm-status-dot.offline {
  background: var(--tm-danger);

  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.14);
}

/*
 * ============================================================
 * Empty State
 * ============================================================
 */

.tm-device-grid > .text-center {
  grid-column: 1 / -1;

  width: 100%;
  padding: 56px 20px;

  background: var(--tm-surface);

  border: 1px dashed var(--tm-border);
  border-radius: var(--tm-radius-lg);
}

/*
 * ============================================================
 * Responsive - Base
 * ============================================================
 */

@media (max-width: 575.98px) {
  .tm-device-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .tm-card-header {
    padding: 17px 16px 15px;
  }

  .tm-device-name {
    font-size: 1rem;
  }

  .tm-device-host,
  .tm-device-location {
    margin-left: 21px;
  }
}
/*
 * ============================================================
 * Card Sections
 * ============================================================
 */

.tm-card-section {
  padding: 18px 20px;

  border-bottom: 1px solid var(--tm-border-soft);
}

.tm-card-section:last-of-type {
  border-bottom: none;
}

.tm-section-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 14px;

  font-size: 0.74rem;

  font-weight: 700;

  text-transform: uppercase;

  letter-spacing: 0.08em;

  color: var(--tm-text-muted);
}

.tm-section-header i {
  margin-right: 6px;
}

/*
==========================================================
Health Gauge
==========================================================
*/

.tm-health {
  display: flex;

  justify-content: center;

  padding: 8px 0;
}

.tm-health-ring {
  width: 118px;

  height: 118px;

  border-radius: 50%;

  padding: 8px;

  display: flex;

  justify-content: center;

  align-items: center;
}

.tm-health-inner {
  width: 100%;

  height: 100%;

  border-radius: 50%;

  background: white;

  display: flex;

  flex-direction: column;

  justify-content: center;

  align-items: center;
}

.tm-health-score {
  font-size: 2rem;

  font-weight: 700;

  line-height: 1;
}

.tm-health-label {
  margin-top: 6px;

  font-size: 0.78rem;

  color: #64748b;

  text-transform: uppercase;

  letter-spacing: 0.05em;
}

/*
 * ============================================================
 * LTE
 * ============================================================
 */

.tm-radio {
  display: flex;

  flex-direction: column;

  gap: 10px;
}

.tm-radio-bars {
  font-size: 1rem;

  letter-spacing: 1px;

  font-weight: 700;

  color: var(--tm-success);
}

/*
 * ============================================================
 * Rows
 * ============================================================
 */

.tm-row {
  display: flex;

  justify-content: space-between;

  align-items: center;

  gap: 14px;

  font-size: 0.9rem;
}

.tm-row span {
  color: var(--tm-text-secondary);
}

.tm-row strong {
  color: var(--tm-text);

  font-weight: 600;

  text-align: right;

  word-break: break-word;
}

/*
 * ============================================================
 * Metrics
 * ============================================================
 */

.tm-metric {
  margin-bottom: 16px;
}

.tm-metric:last-child {
  margin-bottom: 0;
}

.tm-metric-header {
  display: flex;

  justify-content: space-between;

  align-items: center;

  margin-bottom: 8px;

  font-size: 0.9rem;
}

.tm-metric-header span {
  color: var(--tm-text-secondary);
}

.tm-metric-header strong {
  font-weight: 700;
}

/*
 * ============================================================
 * Progress
 * ============================================================
 */

.tm-progress {
  position: relative;

  width: 100%;

  height: 8px;

  background: #edf2f7;

  border-radius: 999px;

  overflow: hidden;
}

.tm-progress-fill {
  position: absolute;

  left: 0;

  top: 0;

  bottom: 0;

  border-radius: 999px;

  transition: width 0.35s ease;
}

.tm-progress-fill.good {
  background: linear-gradient(90deg, #22c55e, #16a34a);
}

.tm-progress-fill.warning {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.tm-progress-fill.critical {
  background: linear-gradient(90deg, #ef4444, #dc2626);
}
/*
 * ============================================================
 * Network
 * ============================================================
 */

.tm-network {
  display: flex;

  flex-direction: column;

  gap: 10px;
}

.tm-network .tm-row strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  font-size: 0.88rem;
}

/*
 * ============================================================
 * Alerts
 * ============================================================
 */

.tm-alert {
  display: flex;

  justify-content: center;

  align-items: center;

  padding: 12px;

  border-radius: 10px;

  font-size: 0.92rem;

  font-weight: 600;
}

.tm-alert-good {
  background: #ecfdf5;

  color: #166534;

  border: 1px solid #bbf7d0;
}

.tm-alert-warning {
  background: #fffbeb;

  color: #92400e;

  border: 1px solid #fde68a;
}

.tm-alert-critical {
  background: #fef2f2;

  color: #991b1b;

  border: 1px solid #fecaca;
}

/*
 * ============================================================
 * Footer
 * ============================================================
 */

.tm-card-footer {
  display: flex;

  justify-content: center;

  align-items: center;

  padding: 18px 20px;

  background: #fafafa;

  border-top: 1px solid var(--tm-border-soft);
}

.tm-card-footer .btn {
  border-radius: 10px;

  font-weight: 600;

  padding: 9px 16px;
}

/*
 * ============================================================
 * Hover Animation
 * ============================================================
 */

.tm-device-card {
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

.tm-device-card:hover {
  transform: translateY(-4px);

  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

/*
 * ============================================================
 * Card Sections Animation
 * ============================================================
 */

.tm-card-section {
  transition: background 0.15s ease;
}

.tm-device-card:hover .tm-card-section {
  background: #fcfcfd;
}

/*
 * ============================================================
 * Icons
 * ============================================================
 */

.tm-section-header i {
  width: 18px;

  text-align: center;

  color: #64748b;
}

/*
 * ============================================================
 * Badges
 * ============================================================
 */

.tm-badge {
  display: inline-flex;

  align-items: center;

  gap: 6px;

  padding: 4px 10px;

  border-radius: 999px;

  font-size: 0.78rem;

  font-weight: 600;
}

.tm-badge.online {
  background: #dcfce7;

  color: #166534;
}

.tm-badge.warning {
  background: #fef3c7;

  color: #92400e;
}

.tm-badge.offline {
  background: #fee2e2;

  color: #991b1b;
}

/*
 * ============================================================
 * Small Animations
 * ============================================================
 */

.tm-health-value {
  transition: transform 0.25s ease;
}

.tm-device-card:hover .tm-health-value {
  transform: scale(1.04);
}

.tm-progress-fill {
  transition: width 0.4s ease;
}

.tm-radio-bars {
  transition: letter-spacing 0.2s ease;
}

.tm-device-card:hover .tm-radio-bars {
  letter-spacing: 2px;
}

/*
 * ============================================================
 * Better Typography
 * ============================================================
 */

.tm-device-name {
  letter-spacing: 0.01em;
}

.tm-section-header {
  user-select: none;
}

.tm-row {
  min-height: 26px;
}
.tm-health-ring.excellent {
  background: conic-gradient(#16a34a 0deg, #16a34a 360deg);
}

.tm-health-ring.good {
  background: conic-gradient(#22c55e 0deg, #22c55e 360deg);
}

.tm-health-ring.warning {
  background: conic-gradient(#f59e0b 0deg, #f59e0b 360deg);
}

.tm-health-ring.critical {
  background: conic-gradient(#dc2626 0deg, #dc2626 360deg);
}

/*
==========================================================
TABLE V3
==========================================================
*/

#tableView table{

    font-size:.92rem;

}

#tableView td{

    vertical-align:middle;

}

.tm-device-cell{

    min-width:220px;

}

.tm-device-cell .tm-device-name{

    font-weight:600;

}

.tm-device-cell .tm-device-host{

    font-size:.82rem;

    color:#6b7280;

}

#tableView code{

    font-size:.82rem;

}
/*
==========================================================
TABLE COMPONENTS
==========================================================
*/

.tm-signal{

    font-size:1rem;

    letter-spacing:1px;

    color:#16a34a;

    white-space:nowrap;

}

.tm-mini-progress{

    width:60px;

    height:5px;

    background:#edf2f7;

    border-radius:999px;

    overflow:hidden;

    margin-bottom:3px;

}

.tm-mini-bar{

    height:100%;

    border-radius:999px;

}

.tm-mini-bar.good{

    background:#16a34a;

}

.tm-mini-bar.warning{

    background:#f59e0b;

}

.tm-mini-bar.critical{

    background:#dc2626;

}

.tm-mini-value{

    font-size:.78rem;

    color:#6b7280;

}

.tm-health-badge{

    display:inline-flex;

    justify-content:center;

    align-items:center;

    width:36px;

    height:36px;

    border-radius:50%;

    font-weight:700;

}

.tm-health-badge.excellent{

    background:#dcfce7;

    color:#166534;

}

.tm-health-badge.good{

    background:#d1fae5;

    color:#047857;

}

.tm-health-badge.warning{

    background:#fef3c7;

    color:#92400e;

}

.tm-health-badge.critical{

    background:#fee2e2;

    color:#991b1b;

}

#tableView tbody tr{

    transition:background .15s ease;

}

#tableView tbody tr:hover{

    background:#fafafa;

}
.tm-sort{

    cursor:pointer;

    user-select:none;

    white-space:nowrap;

}

.tm-sort:hover{

    background:#f8f9fa;

}

.tm-sort-icon{

    color:#6b7280;

    font-size:.75rem;

}
