/* Modern CSS Reset & Variable Tokens */
:root {
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --border-color: #334155;
  --accent-cyan: #38bdf8;
  --accent-blue: #3b82f6;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;
  --shadow-main: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  padding-bottom: 120px; /* Space for sticky footer */
}

/* Header Navbar */
.app-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 24px;
}

.header-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  font-size: 0.75rem;
  background: rgba(56, 189, 248, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 500;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--accent-amber);
}

.status-dot.active {
  background-color: var(--accent-green);
}

.status-dot.pulsing {
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Layout */
.main-layout {
  max-width: 1280px;
  margin: 24px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Ad Slot Containers & Placeholders */
.ad-slot-wrapper {
  background: rgba(30, 41, 59, 0.6);
  border: 1.5px dashed var(--accent-cyan);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease;
}

.ad-slot-wrapper:hover {
  border-color: var(--accent-blue);
}

.slot-meta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.slot-name {
  font-weight: 600;
  color: var(--text-main);
}

.slot-size-tag {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
}

.ad-slot-box {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.ad-placeholder {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 20px;
  text-align: center;
}

/* Header Slot Specific */
.header-slot-wrapper {
  min-height: 140px;
}

/* Card Styling */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-main);
}

.card-header {
  margin-bottom: 20px;
}

.card-header h2 {
  font-size: 1.15rem;
  font-weight: 600;
}

.sub-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Configuration Form Grid */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
}

.form-group input[type="text"] {
  background: #0f172a;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.form-group small {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.checkbox-group {
  grid-column: span 2;
  flex-direction: row;
  gap: 24px;
  align-items: center;
  padding-top: 8px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-actions {
  grid-column: span 2;
  display: flex;
  justify-content: flex-end;
}

/* Grid Layout for Main & Sidebar */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.content-card p {
  margin-bottom: 16px;
  color: var(--text-muted);
}

.callout {
  background: rgba(56, 189, 248, 0.1);
  border-left: 4px solid var(--accent-cyan);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 0.9rem;
}

.feature-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.feature-list li {
  background: #0f172a;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
}

/* Sidebar Slot */
.sidebar-slot-wrapper {
  min-height: 350px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
}
.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
}
.btn-outline:hover {
  background: rgba(56, 189, 248, 0.1);
}

.btn-sm {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-sm:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Event Console Output */
.console-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.console-body {
  background: #090d16;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.console-log-row {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  gap: 12px;
}

.console-log-row .timestamp {
  color: var(--text-muted);
}
.console-log-row.event-requested { border-left: 3px solid var(--accent-blue); }
.console-log-row.event-received { border-left: 3px solid var(--accent-cyan); }
.console-log-row.event-rendered { border-left: 3px solid var(--accent-green); }
.console-log-row.event-viewable { border-left: 3px solid var(--accent-amber); }
.console-log-row.event-empty { border-left: 3px solid var(--accent-red); }

/* Sticky Footer */
.sticky-footer-wrapper {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  padding: 12px 24px;
  z-index: 99;
}

.sticky-footer-bar {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sticky-meta {
  margin-bottom: 6px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
  .config-grid {
    grid-template-columns: 1fr;
  }
  .checkbox-group, .form-actions {
    grid-column: span 1;
  }
}
