:root {
  /* Brand Accent - can be overridden by JS from settings */
  --accent-primary: #ffc107;
  --accent-secondary: #ffb300;
  --accent-glow: rgba(255, 193, 7, 0.25);

  /* Status Colors */
  --status-up: #10b981;
  --status-down: #ef4444;
  --status-pending: #f59e0b;
  --status-unknown: #4b5563;

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* === DARK MODE (default) === */
:root, [data-theme="dark"] {
  --bg-main: #1a1a24;
  --bg-secondary: #2c2c38;
  --bg-card: rgba(44, 44, 56, 0.8);
  --bg-card-hover: rgba(60, 60, 75, 0.95);

  --text-main: #f0f0f5;
  --text-muted: #9090a8;

  --border-color: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

/* === LIGHT MODE === */
[data-theme="light"] {
  --bg-main: #f5f5f7;
  --bg-secondary: #e8e8f0;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 1);

  --text-main: #1a1a24;
  --text-muted: #5a5a70;

  --border-color: rgba(0, 0, 0, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
  background-image: 
    radial-gradient(circle at 15% 50%, var(--accent-glow), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(44, 44, 56, 0.3), transparent 25%);
  background-attachment: fixed;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Typography Specifics */
h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-secondary);
}

/* Glassmorphism Classes */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--glass-shadow);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-dot {
  width: 12px;
  height: 12px;
  background-color: var(--accent-primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--accent-glow);
}

.logo img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

/* Forms & Buttons */
.input-group {
  margin-bottom: 1.5rem;
}

.input-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="url"],
input[type="number"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-family: var(--font-family);
  transition: all 0.3s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

/* Dashboard Toggles */
.toggle-btn {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s;
}

.toggle-btn:hover:not(.active):not(.disabled) {
  border-color: var(--accent-primary);
  color: var(--text-main);
}

.toggle-btn.active {
  background: var(--accent-primary);
  color: #000;
  border-color: var(--accent-primary);
  font-weight: 600;
}

.toggle-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  font-family: var(--font-family);
}

.btn-primary {
  background: var(--accent-primary);
  color: #1a1a24;
  font-weight: 600;
  box-shadow: 0 4px 15px var(--accent-glow);
}

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

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-down);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* View Toggles */
.view-toggles {
  display: flex;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.toggle-btn {
  padding: 0.4rem 1rem;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-btn.active {
  background: var(--accent-primary);
  color: #1a1a24;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Utility Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.5s ease forwards;
}

/* Dashboard Specifics */
.overall-status {
  padding: 2rem;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.status-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-icon.all-good {
  background: rgba(16, 185, 129, 0.1);
  color: var(--status-up);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.2);
}
.status-icon.issues {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-down);
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.status-text h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.site-card {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.site-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.15);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.site-info h3 {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-url {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.current-status-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-up {
  background: rgba(16, 185, 129, 0.1);
  color: var(--status-up);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.badge-down {
  background: rgba(239, 68, 68, 0.1);
  color: var(--status-down);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Grid vs List Views */
.sites-grid {
  display: flex;
  flex-direction: column;
}

.sites-grid.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.sites-grid.grid-view .site-card {
  margin-bottom: 0;
}

.sites-grid.grid-view .history-bars {
  height: 24px;
}

/* History Bar (Claude Status style) */
.history-container {
  margin-bottom: 1rem;
  overflow: hidden;
}

.history-bars {
  display: flex;
  height: 32px;
  gap: 2px;
  margin-bottom: 0.5rem;
  align-items: flex-end;
}

.history-bar {
  flex: 1;
  background-color: var(--status-unknown);
  border-radius: 1px;
  height: 80%;
  transition: height 0.3s ease, opacity 0.2s;
  cursor: pointer;
}

/* Grid View specific overrides for bars */
.grid-view .history-bars {
  justify-content: flex-end;
  gap: 1.5px;
}

.grid-view .history-bar {
  flex: 0 1 5px; /* Don't grow, just shrink up to 5px */
  min-width: 2px;
  max-width: 5px;
}

.history-bar:hover {
  opacity: 0.7;
}

.bar-up { background-color: var(--status-up); }
.bar-down { background-color: var(--status-down); }
.bar-pending { background-color: var(--status-pending); }
.bar-empty { background-color: rgba(255, 255, 255, 0.05); }

/* Claude-style line labels */
.history-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: relative;
  gap: 15px;
}

.history-labels::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background-color: var(--border-color);
  z-index: 0;
}

.history-labels > span {
  position: relative;
  z-index: 1;
  background-color: var(--bg-card); /* Matches the card to cut the line */
  padding: 0 4px;
}

/* Tooltip */
.tooltip {
  position: absolute;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  line-height: 1.4;
  white-space: nowrap;
}

/* Header Links */
.header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

/* Mini Stats (SSL info) */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stat-icon {
  color: var(--text-muted);
  font-size: 1.25rem;
}

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Admin Specifics */
.admin-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 2rem;
  min-height: calc(100vh - 120px);
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}



.nav-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-primary);
  border-left: 3px solid var(--accent-primary);
  font-weight: 600;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

th {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:last-child td {
  border-bottom: none;
}

/* Responsive */
@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  
  header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
}
