/* ============================================
   00b5e2 Dashboard - Stylesheet
   ============================================ */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  --bg: #0a0a0a;
  --bg-card: #111;
  --bg-hover: #1a1a1a;
  --bg-input: #0d0d0d;
  --text: #fff;
  --text-dim: #777;
  --accent: #00b5e2;
  --accent-dim: rgba(0, 181, 226, 0.1);
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;
  --font: "Space Mono", "JetBrains Mono", monospace;
  --container-padding: clamp(20px, 5vw, 40px);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --transition-fast: 0.25s var(--ease);
}

/* ============================================
   RESET & BASE
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-weight: 400;
  background: var(--bg);
  color: var(--text-dim);
  line-height: 1.6;
  text-transform: lowercase;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* Force lowercase on all text */
body,
button,
input,
.btn,
.sidebar__link,
.log-entry,
.status-card,
.redirects-table {
  text-transform: lowercase;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

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

.hidden {
  display: none !important;
}

/* ============================================
   LOGIN
   ============================================ */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login__box {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.login__title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 4px;
}

.login__subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 32px;
}

.login__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login__error {
  color: var(--error);
  font-size: 12px;
  min-height: 18px;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.sidebar__logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.sidebar__subtitle {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 32px;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  transition: all var(--transition-fast);
}

.sidebar__link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.sidebar__link.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar__link svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 24px;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
  padding: 24px var(--container-padding);
  overflow-y: auto;
}

.main__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.main__title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

/* ============================================
   PANELS
   ============================================ */
.panel {
  display: none;
}

.panel.active {
  display: block;
}

.section {
  margin-bottom: 24px;
}

.section__title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* ============================================
   STATUS GRID
   ============================================ */
.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.status-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 16px;
}

.status-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.status-card__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-card__dot.operational {
  background: var(--success);
}

.status-card__dot.degraded {
  background: var(--warning);
}

.status-card__dot.offline {
  background: var(--error);
}

.status-card__dot.checking {
  background: var(--text-dim);
  animation: pulse 1.5s var(--ease) infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.4;
  }
}

.status-card__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.status-card__latency {
  font-size: 11px;
  color: var(--text-dim);
}

/* ============================================
   STATS GRID
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.stat-card__value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card__label {
  font-size: 11px;
  color: var(--text-dim);
}

/* ============================================
   CARDS & FORMS
   ============================================ */
.card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
  margin-bottom: 12px;
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  transition: border-color var(--transition-fast);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-note {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-dim);
}

/* ============================================
   BUTTONS (pill style matching core)
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  color: var(--text-dim);
  transition:
    background var(--transition-fast),
    color var(--transition-fast);
}

.btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}

.btn--primary:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 4px 16px rgba(0, 181, 226, 0.3);
}

.btn--secondary {
  background: var(--bg-card);
  color: var(--text-dim);
}

.btn--secondary:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.btn--danger {
  background: var(--bg-card);
  color: var(--error);
}

.btn--danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.btn--small {
  padding: 6px 12px;
  font-size: 11px;
}

.btn--full {
  width: 100%;
}

/* ============================================
   REDIRECTS TABLE
   ============================================ */
.redirects-table {
  width: 100%;
  border-collapse: collapse;
}

.redirects-table th,
.redirects-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.redirects-table th {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.redirects-table td {
  font-size: 12px;
}

.redirects-table .slug {
  font-weight: 600;
  color: var(--accent);
}

.redirects-table .destination {
  color: var(--text);
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redirects-table .actions {
  display: flex;
  gap: 6px;
}

/* ============================================
   LOGS
   ============================================ */
.logs {
  background: var(--bg-input);
  border-radius: 6px;
  padding: 12px;
  font-size: 11px;
  max-height: 400px;
  overflow-y: auto;
}

.log-entry {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.log-entry:last-child {
  border-bottom: none;
}

.log-entry__time {
  color: var(--text-dim);
  flex-shrink: 0;
}

.log-entry__type {
  font-weight: 600;
  flex-shrink: 0;
  width: 50px;
}

.log-entry__type.info {
  color: var(--accent);
}

.log-entry__type.success {
  color: var(--success);
}

.log-entry__type.error {
  color: var(--error);
}

.log-entry__message {
  color: var(--text);
}

/* ============================================
   CDN GRID
   ============================================ */
.cdn-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.cdn-item {
  background: var(--bg-card);
  border-radius: 8px;
  overflow: hidden;
}

.cdn-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.cdn-item__info {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cdn-item__key {
  font-size: 11px;
  color: var(--text);
  word-break: break-all;
}

.cdn-item__size {
  font-size: 10px;
  color: var(--text-dim);
}

.cdn-item__actions {
  padding: 0 10px 10px;
  display: flex;
  gap: 6px;
}

/* ============================================
   CATEGORY TITLES
   ============================================ */
.category-title {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  margin: 16px 0 8px;
}

/* ============================================
   SERVICE ITEMS
   ============================================ */
.service-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-card);
  border-radius: 6px;
  margin-bottom: 6px;
}

.service-item__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.service-item__name {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}

.service-item__url {
  color: var(--text-dim);
  font-size: 11px;
}

.service-item__actions {
  display: flex;
  gap: 6px;
}

/* ============================================
   EMPTY STATES
   ============================================ */
.empty-message {
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px 0;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .cdn-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}