*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

:root {
  --main: #8b5cf6;
  --accent: #c084fc;
  --main-rgb: 139, 92, 246;
  --green: #22c55e;
  --green-bg: #dcfce7;
  --red: #ef4444;
  --red-bg: #fee2e2;
  --yellow: #eab308;
  --yellow-bg: #fef9c3;
  --grey: #9ca3af;
  --grey-bg: #f3f4f6;
  --bg: #f0f2f5;
  --bg-card: #ffffff;
  --text: #1f2328;
  --text-muted: #656d76;
  --text-light: #9ca3af;
  --border: #d1d5db;
  --border-light: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --radius-lg: 12px;
  --font: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  --bg: #111827;
  --bg-card: #1f2937;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --text-light: #6b7280;
  --border: #374151;
  --border-light: #1f2937;
  --green-bg: rgba(34, 197, 94, 0.12);
  --red-bg: rgba(239, 68, 68, 0.12);
  --yellow-bg: rgba(234, 179, 8, 0.12);
  --grey-bg: rgba(156, 163, 175, 0.12);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

#monitors {
  flex: 1;
}

a {
  color: var(--main);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.uk-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.uk-h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.uk-h3 {
  margin-top: 50px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: center;
}

.uk-margin-remove {
  margin-bottom: 0;
}

.uk-margin-small-bottom {
  margin-bottom: 8px;
}

.font-14 {
  font-size: 14px;
  color: var(--text-muted);
}

.font-18 {
  font-size: 18px;
}

.uk-hidden {
  display: none !important;
}

/* ============================================
   HEADER
   ============================================ */
#main-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  position: relative;
  text-decoration: none;
  width: 44px;
  height: 44px;
}

.logo-wrapper:hover {
  text-decoration: none;
}

.page-logo {
  height: 44px;
  width: 44px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  display: block;
}

[data-theme="light"] .page-logo {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.logo-text {
  position: absolute;
  left: 54px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--main), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  margin: 0;
  white-space: nowrap;
}

[data-theme="light"] .page-logo {
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.logo-text {
  font-size: 20px;
  font-weight: 900;
  background: linear-gradient(90deg, var(--main), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  margin: 0;
}

.header-info {
  text-align: center;
  flex: 1;
}

.header-meta {
  margin-top: 4px;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  color: var(--main);
  border-color: var(--main);
  background: var(--bg);
}

.theme-toggle-btn .icon {
  width: 16px;
  height: 16px;
}

/* ============================================
   STATUS CARD
   ============================================ */
.psp-status-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin: 28px 0 24px;
  box-shadow: var(--shadow);
}

.status-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.psp-main-status-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.dot.is-big {
  width: 22px;
  height: 22px;
}

.dot.is-green {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-bg);
  animation: pulse-green 2s ease-in-out infinite;
}

.dot.is-red {
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-bg);
  animation: pulse-red 2s ease-in-out infinite;
}

.dot.is-yellow {
  background: var(--yellow);
  box-shadow: 0 0 0 4px var(--yellow-bg);
  animation: pulse-yellow 2s ease-in-out infinite;
}

.dot.is-grey {
  background: var(--grey);
  box-shadow: 0 0 0 4px var(--grey-bg);
}

.dot.is-big.is-green {
  box-shadow: 0 0 0 6px var(--green-bg);
}

.dot.is-big.is-red {
  box-shadow: 0 0 0 6px var(--red-bg);
}

.dot.is-big.is-yellow {
  box-shadow: 0 0 0 6px var(--yellow-bg);
}

.dot.is-big.is-grey {
  box-shadow: 0 0 0 6px var(--grey-bg);
}

.psp-main-status {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.psp-main-status .loading-text {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 15px;
}

.psp-latest-downtime {
  font-size: 13px;
  color: var(--text-muted);
}

/* ============================================
   MONITORS SECTION
   ============================================ */
.monitors-header {
  margin-bottom: 16px;
}

.psp-monitor-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
  width: 100%;
}

.monitor-row {
  max-width: 1000px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  transition:
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.monitor-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: left;
}

.monitor-row-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.monitor-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.monitor-url {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 400;
  transition: color 0.15s ease;
}

.monitor-url:hover {
  color: var(--main);
  text-decoration: underline;
}

.monitor-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.monitor-badge-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.monitor-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.monitor-badge.operational {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid var(--green);
}

[data-theme="dark"] .monitor-badge.operational {
  background: rgba(34, 197, 94, 0.15);
}

.monitor-badge.down {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red);
}

[data-theme="dark"] .monitor-badge.down {
  background: rgba(239, 68, 68, 0.15);
}

.monitor-badge.checking {
  background: var(--grey-bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ============================================
   PRELOADER SKELETON
   ============================================ */
.psp-monitor-preloader {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fake-row {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.fake-name {
  height: 16px;
  width: 140px;
  background: var(--border-light);
  border-radius: 4px;
}

.fake-status {
  height: 24px;
  width: 90px;
  background: var(--border-light);
  border-radius: 20px;
}

.fake-bars {
  grid-column: 1 / 3;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  margin-top: 4px;
}

@keyframes skeleton-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ============================================
   FOOTER
   ============================================ */
#main-footer {
  padding: 20px 0;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.footer-right {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.footer-right a {
  color: var(--main);
  font-size: 13px;
}

.footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
}

.footer-btn:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--main);
}

.footer-btn .icon {
  width: 16px;
  height: 16px;
}

.footer-brand {
  color: var(--text-light);
  font-size: 12px;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pulse-green {
  0%,
  100% {
    box-shadow: 0 0 0 6px var(--green-bg);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(34, 197, 94, 0.05);
  }
}

@keyframes pulse-red {
  0%,
  100% {
    box-shadow: 0 0 0 6px var(--red-bg);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0.05);
  }
}

@keyframes pulse-yellow {
  0%,
  100% {
    box-shadow: 0 0 0 6px var(--yellow-bg);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(234, 179, 8, 0.05);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .uk-container {
    padding: 0 12px;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-info {
    text-align: left;
  }

  .psp-status-card {
    padding: 16px;
    margin: 16px 0;
  }

  .status-card-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .monitor-row {
    padding: 12px 14px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}
