/* CSS VARIABLES & RESET */
:root {
  --font-family-title: 'Outfit', 'Inter', sans-serif;
  --font-family-body: 'Inter', sans-serif;
  
  --bg-primary: #0b0f19;
  --bg-card: rgba(22, 29, 49, 0.45);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.4);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-bright: #ffffff;
  
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.15);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.15);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.15);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  font-family: var(--font-family-body);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding-bottom: 3rem;
}

/* GRADIENTS BACKDROP BACKGROUND */
.glass-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 10% 20%, rgba(30, 27, 75, 0.6) 0%, rgba(15, 23, 42, 0.9) 90%);
  z-index: -2;
}

.glass-bg::after {
  content: '';
  position: absolute;
  top: -10%;
  right: -10%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  z-index: -1;
  filter: blur(80px);
}

.glass-bg::before {
  content: '';
  position: absolute;
  bottom: -10%;
  left: -10%;
  width: 35vw;
  height: 35vw;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
  z-index: -1;
  filter: blur(60px);
}

/* CONTAINER */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* HEADER STYLE */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-wrapper {
  background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

.logo-icon {
  font-size: 1.8rem;
}

.brand-text h1 {
  font-family: var(--font-family-title);
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, var(--text-bright), #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.2rem;
}

.status-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* BADGES AND STATUS BUTTONS */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 99px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.status-badge.status-ok {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.2);
}

.status-badge.status-ok .pulse {
  background-color: var(--color-success);
}

.status-badge.status-warn {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.status-badge.status-warn .pulse {
  background-color: var(--color-warning);
}

.status-badge.status-fail {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.2);
}

.status-badge.status-fail .pulse {
  background-color: var(--color-danger);
  animation: pulse-danger 1.5s infinite;
}

.status-badge.status-loading {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border-color: rgba(255, 255, 255, 0.05);
}

.status-badge.status-loading .pulse {
  background-color: var(--text-muted);
  animation: pulse-loading 1.2s infinite;
}

.pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-badge.status-ok .pulse {
  animation: pulse-success 2s infinite;
}

@keyframes pulse-success {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-danger {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse-loading {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

/* BUTTONS */
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: var(--text-bright);
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 10px;
  font-family: var(--font-family-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: all 0.2s ease-in-out;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary.loading {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.loading .btn-icon {
  display: inline-block;
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* CARDS COMMON */
.card {
  background-color: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transition: border-color 0.25s ease-in-out, transform 0.25s ease;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

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

.card-header h2, .card-header h3 {
  font-family: var(--font-family-title);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-bright);
}

.card-icon {
  font-size: 1.4rem;
  opacity: 0.8;
}

.badge {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* METRICS GRID & METRIC CARD */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.metric-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.gauge-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem 0;
  flex-grow: 1;
}

/* RADIAL PROGRESS GAUGE */
.radial-progress {
  --size: 110px;
  --thickness: 10px;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: conic-gradient(
    var(--gauge-color, var(--primary-color)) calc(var(--percent) * 1%),
    rgba(255, 255, 255, 0.06) 0
  );
  display: inline-grid;
  place-items: center;
  transition: background 0.3s ease;
}

.radial-progress .inner-circle {
  width: calc(var(--size) - calc(var(--thickness) * 2));
  height: calc(var(--size) - calc(var(--thickness) * 2));
  background-color: #121824;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.radial-progress .value {
  font-family: var(--font-family-title);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
}

.card-footer {
  margin-top: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.net-stats {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.5rem 0;
  flex-grow: 1;
  justify-content: center;
}

.net-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  padding-bottom: 0.4rem;
}

.net-row .direction {
  color: var(--text-muted);
}

.net-row .value {
  color: var(--text-bright);
  font-weight: 600;
}

/* SPLIT LAYOUT */
.split-layout {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (max-width: 900px) {
  .split-layout {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  min-height: 320px;
}

.chart-container {
  width: 100%;
  height: 250px;
  margin-top: 1rem;
}

/* ENDPOINTS STYLING */
.endpoints-card {
  display: flex;
  flex-direction: column;
}

.endpoints-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Scrollbar styling */
.endpoints-list::-webkit-scrollbar, .containers-grid::-webkit-scrollbar {
  width: 6px;
}
.endpoints-list::-webkit-scrollbar-thumb, .containers-grid::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.endpoint-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  transition: background-color 0.2s ease;
}

.endpoint-item:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.endpoint-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-width: 65%;
}

.endpoint-name {
  color: var(--text-bright);
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.endpoint-url {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.endpoint-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.endpoint-latency {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.status-dot.ok { background-color: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.status-dot.fail { background-color: var(--color-danger); box-shadow: 0 0 8px var(--color-danger); }

/* DOCKER CONTAINERS STYLING */
.containers-section {
  width: 100%;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.title-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.title-area h2 {
  font-family: var(--font-family-title);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-bright);
}

.filter-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

#container-search {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-bright);
  font-family: var(--font-family-body);
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  outline: none;
  width: 180px;
  transition: all 0.25s ease;
}

#container-search:focus {
  border-color: var(--border-focus);
  background-color: rgba(255, 255, 255, 0.08);
}

.tab-filters {
  display: flex;
  background-color: rgba(255, 255, 255, 0.04);
  padding: 0.2rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-family-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  color: var(--text-bright);
}

.tab-btn.active {
  background-color: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
}

.containers-table-wrapper {
  width: 100%;
  overflow-x: auto;
  max-height: 480px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.15);
}

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

.containers-table th, .containers-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.containers-table th {
  background-color: rgba(22, 29, 49, 0.85);
  color: var(--text-muted);
  font-family: var(--font-family-title);
  font-weight: 600;
  user-select: none;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.containers-table th:hover {
  color: var(--text-bright);
}

.containers-table tbody tr {
  transition: background-color 0.2s ease;
}

.containers-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.025);
}

.containers-table tr.row-failed {
  background-color: rgba(239, 68, 68, 0.03);
}

.containers-table tr.row-failed:hover {
  background-color: rgba(239, 68, 68, 0.06);
}

.containers-table td.cell-name {
  font-weight: 600;
  color: var(--text-bright);
  max-width: 240px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.containers-table td.cell-service {
  font-weight: 600;
  color: #c7d2fe;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.containers-table td.cell-stat {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.sort-icon {
  margin-left: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  display: inline-block;
}

.container-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  display: inline-block;
}

.container-badge.up {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.container-badge.down {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
  animation: blink-soft 1.5s infinite;
}

@keyframes blink-soft {
  0% { opacity: 0.7; }
  50% { opacity: 1; }
  100% { opacity: 0.7; }
}

/* FOOTER */
.footer-note {
  margin-top: 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-note p {
  margin-bottom: 0.4rem;
}

.footer-note .copyright {
  opacity: 0.6;
}

/* RESPONSIVE DESIGN */
@media (max-width: 600px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
  }
  .status-summary {
    width: 100%;
    justify-content: space-between;
  }
  .filter-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }
  #container-search {
    width: 100%;
  }
  .tab-filters {
    width: 100%;
    justify-content: space-around;
  }
}
