/* Status dashboard and login styles */

:root {
  --bg-0: #08171a;
  --bg-1: #0f2326;
  --card: rgba(254, 255, 244, 0.92);
  --card-border: rgba(0, 0, 0, 0.07);
  --text: #17363b;
  --muted: #4f676a;
  --accent-a: #0b8e91;
  --accent-b: #e9b949;
  --danger: #b1232f;
  --success: #0a7a4a;
  --shadow: 0 22px 48px rgba(0, 0, 0, 0.22);
  --input-bg: rgba(255, 255, 255, 0.72);
  --item-bg: rgba(255, 255, 255, 0.58);
}

[data-theme="dark"] {
  --bg-0: #040d0e;
  --bg-1: #08171a;
  --card: #142a2d;
  --card-border: rgba(255, 255, 255, 0.12);
  --text: #e0f2f3;
  --muted: #8ba5a8;
  --shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
  --input-bg: rgba(255, 255, 255, 0.05);
  --item-bg: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .badge {
  color: #fff;
  background: linear-gradient(90deg, rgba(233, 185, 73, 0.45), rgba(11, 142, 145, 0.35));
}

[data-theme="dark"] .form-select {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .form-select option {
  background-color: #142a2d;
  color: #e0f2f3;
}

[data-theme="dark"] .form-input {
  border-color: rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .status-item,
[data-theme="dark"] .url-list-item,
[data-theme="dark"] .overview-item,
[data-theme="dark"] .status-tools,
[data-theme="dark"] .fav-card {
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .top-nav,
[data-theme="dark"] .fav-section,
[data-theme="dark"] .url-list {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .fav-actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .dot {
  background: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .star-btn {
  color: rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .star-btn.active {
  color: var(--accent-b);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font: 16px/1.5 "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 900px at 10% 0%, rgba(11, 142, 145, 0.35), transparent 60%),
    radial-gradient(900px 700px at 90% 20%, rgba(233, 185, 73, 0.23), transparent 55%),
    linear-gradient(180deg, var(--bg-0), var(--bg-1));
  transition: background-color 0.3s, color 0.3s;
}

.page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px;
}

.card {
  width: min(760px, 100%);
  padding: 34px 30px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(4px);
}

.brand-logo {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: var(--shadow);
}

.brand-logo-nav {
  width: 40px;
  height: 40px;
  margin: 0;
  border-radius: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.12em;
  font-weight: 700;
  color: #10363a;
  background: linear-gradient(90deg, rgba(233, 185, 73, 0.75), rgba(11, 142, 145, 0.45));
  border: 1px solid rgba(0, 0, 0, 0.14);
}

h1 {
  margin: 14px 0 8px;
  font-size: clamp(28px, 3.5vw, 44px);
  line-height: 1.12;
  letter-spacing: -0.02em;
}

.subtitle {
  margin: 0 0 18px;
  font-size: 18px;
  color: var(--muted);
}

.meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
}

.dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
}

.link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed rgba(0, 0, 0, 0.35);
}

.link:hover {
  border-bottom-color: rgba(0, 0, 0, 0.75);
}

.footer {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.kbd {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: rgba(0, 0, 0, 0.06);
}

.muted {
  color: var(--muted);
}

.hint {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.login-form label {
  font-weight: 700;
  font-size: 14px;
}

.login-form input {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
}

.btn {
  margin-top: 8px;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 700;
  color: #13353a;
  cursor: pointer;
  background: linear-gradient(90deg, rgba(233, 185, 73, 0.92), rgba(11, 142, 145, 0.74));
}

.btn:hover {
  filter: brightness(0.98);
}

.btn-muted {
  background: rgba(0, 0, 0, 0.06);
}

.page-status {
  align-items: start;
}

.card-status {
  margin: 24px 0;
}

.status-meta {
  margin-bottom: 14px;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
}

.overview-item {
  min-width: 0;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 12px;
  background: var(--item-bg);
}

.overview-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.overview-item strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 22px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.overview-item .overview-danger {
  color: var(--danger);
}

.status-tools {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 12px;
  background: var(--item-bg);
}

.search-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.status-search {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tab,
.status-action {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  text-decoration: none;
}

.filter-tab.active {
  color: #13353a;
  background: linear-gradient(90deg, rgba(233, 185, 73, 0.92), rgba(11, 142, 145, 0.64));
}

.status-grid {
  display: grid;
  gap: 12px;
}

.status-item {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 12px;
  background: var(--item-bg);
}

.status-dot {
  width: 14px;
  height: 14px;
  margin-top: 6px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.status-dot.up {
  background: var(--success);
}

.status-dot.down {
  background: var(--danger);
}

.status-title {
  margin: 0;
  font-size: 18px;
}

.status-streak {
  display: inline-flex;
  width: fit-content;
  margin: 5px 0 0;
  border-radius: 8px;
  padding: 3px 8px;
  color: var(--success);
  background: rgba(10, 122, 74, 0.1);
  font-size: 12px;
  font-weight: 700;
}

.status-streak.down {
  color: var(--danger);
  background: rgba(177, 35, 47, 0.1);
}

.status-details {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.error-details {
  margin-top: 8px;
  color: var(--danger);
  font-size: 13px;
}

.error-details summary {
  width: fit-content;
  cursor: pointer;
  font-weight: 700;
}

.error-details p {
  margin: 6px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  align-self: center;
}

.status-action:hover,
.filter-tab:hover {
  background: rgba(0, 0, 0, 0.08);
}

.status-action:disabled {
  cursor: wait;
  opacity: 0.6;
}

.empty-status {
  margin: 0;
  border: 1px dashed rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.refresh-status {
  margin-top: 8px;
}

.build-version {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

@media (prefers-reduced-motion: no-preference) {
  .card {
    transform: translateY(0);
    animation: rise 500ms ease-out;
  }

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

@media (max-width: 640px) {
  .card {
    padding: 22px 16px;
  }

  .overview-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .status-item {
    grid-template-columns: 14px 1fr;
  }

  .status-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .footer {
    flex-wrap: wrap;
  }
}

/* ---- Favourites ---- */
.fav-section {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.09);
}

.fav-section-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.fav-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.fav-card {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 14px;
  background: var(--input-bg);
}

.fav-card-title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fav-chart-label {
  margin: 0 0 6px;
  font-size: 11px;
  color: var(--muted);
}

.fav-canvas {
  display: block;
  width: 100%;
  height: 90px;
  margin-bottom: 10px;
}

.fav-stats {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.fav-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.fav-stat-label {
  color: var(--muted);
}

.fav-stat-value {
  font-weight: 700;
}

.fav-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--success);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.fav-status-icon.down {
  background: var(--danger);
}

.fav-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

.fav-btn {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.fav-btn:hover {
  background: rgba(0, 0, 0, 0.1);
}

.fav-btn-remove {
  color: var(--danger);
  border-color: rgba(177, 35, 47, 0.3);
}

/* Star button on status items */
.star-btn:not(.status-action) {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 2px 4px;
  color: rgba(0, 0, 0, 0.22);
  align-self: center;
  line-height: 1;
  transition: color 0.15s;
}

.star-btn:hover {
  color: var(--accent-b);
}

.star-btn.active {
  color: var(--accent-b);
}

@media (max-width: 640px) {
  .fav-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Top Navigation ---- */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.09);
}

.nav-left,
.nav-right {
  display: flex;
  gap: 16px;
}

.nav-link {
  color: var(--accent-a);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--accent-b);
}

/* ---- Settings Form ---- */
.settings-form {
  display: grid;
  gap: 24px;
  margin-top: 20px;
}

.form-group {
  border: none;
  padding: 0;
  margin: 0;
}

.form-group legend {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.form-description {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.form-description-secondary {
  margin-top: 12px;
  font-size: 13px;
}

.form-label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
}

.form-select {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  margin-bottom: 12px;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px rgba(11, 142, 145, 0.1);
}

.btn-primary {
  background: linear-gradient(90deg, rgba(233, 185, 73, 0.92), rgba(11, 142, 145, 0.74));
  color: #13353a;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .top-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .settings-form {
    gap: 18px;
  }
}

/* ---- URL Management ---- */
.url-input-section {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.url-input-group {
  display: grid;
  gap: 6px;
}

.form-input {
  width: 100%;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 12px;
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px rgba(11, 142, 145, 0.1);
}

.form-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.url-list {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.09);
}

.url-list-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.url-list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  padding: 12px;
  background: var(--item-bg);
}

.url-list-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.url-name {
  margin: 0;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.url-value {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
  overflow-wrap: break-word;
}

.url-remove-btn {
  border: 1px solid rgba(177, 35, 47, 0.3);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
  background: rgba(177, 35, 47, 0.05);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.url-remove-btn:hover {
  background: rgba(177, 35, 47, 0.15);
}

@media (max-width: 640px) {
  .url-list-item {
    grid-template-columns: 1fr;
  }

  .url-remove-btn {
    width: 100%;
  }
}

/* Tooltip styles */
.chart-tooltip {
  background: var(--card);
  border: 1px solid var(--card-border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  font-family: inherit;
  font-size: 12px;
  max-width: 220px;
  backdrop-filter: blur(8px);
  pointer-events: none;
}

[data-theme="dark"] .chart-tooltip {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Skeleton Loaders */
.skeleton-item {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  padding: 12px;
  background: var(--item-bg);
  align-items: center;
}

[data-theme="dark"] .skeleton-item {
  border-color: rgba(255, 255, 255, 0.08);
}

.skeleton-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--item-bg) 25%, rgba(0,0,0,0.06) 50%, var(--item-bg) 75%);
  background-size: 200% 100%;
  animation: loading-pulse 1.5s infinite;
}

[data-theme="dark"] .skeleton-dot {
  background: linear-gradient(90deg, var(--item-bg) 25%, rgba(255,255,255,0.05) 50%, var(--item-bg) 75%);
  background-size: 200% 100%;
}

.skeleton-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skeleton-line {
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--item-bg) 25%, rgba(0,0,0,0.06) 50%, var(--item-bg) 75%);
  background-size: 200% 100%;
  animation: loading-pulse 1.5s infinite;
}

[data-theme="dark"] .skeleton-line {
  background: linear-gradient(90deg, var(--item-bg) 25%, rgba(255,255,255,0.05) 50%, var(--item-bg) 75%);
  background-size: 200% 100%;
}

.skeleton-line.title {
  width: 40%;
  height: 16px;
}

.skeleton-line.details {
  width: 80%;
  height: 11px;
}

.skeleton-star {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--item-bg) 25%, rgba(0,0,0,0.06) 50%, var(--item-bg) 75%);
  background-size: 200% 100%;
  animation: loading-pulse 1.5s infinite;
}

[data-theme="dark"] .skeleton-star {
  background: linear-gradient(90deg, var(--item-bg) 25%, rgba(255,255,255,0.05) 50%, var(--item-bg) 75%);
  background-size: 200% 100%;
}

@keyframes loading-pulse {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* checking button state */
.btn.checking {
  opacity: 0.8;
  cursor: wait;
  background: linear-gradient(90deg, rgba(11, 142, 145, 0.74), rgba(233, 185, 73, 0.92));
  animation: button-checking-glow 1.5s infinite alternate;
}

@keyframes button-checking-glow {
  from {
    filter: brightness(0.95);
  }
  to {
    filter: brightness(1.1);
  }
}
