/* CSS variables for HSL colors and tokens */
:root {
  --bg: 240 10% 3.9%;          /* #0a0a0c */
  --bg-gradient-1: 260 30% 12%; /* Dark violet accent */
  --bg-gradient-2: 200 40% 10%; /* Dark cyan accent */
  
  --card-bg: 240 10% 6%;       /* #0f0f12 */
  --card-border: 240 5% 15%;
  --glass-bg: rgba(15, 15, 20, 0.65);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-border-hover: rgba(255, 255, 255, 0.12);
  
  --text: 0 0% 98%;            /* White */
  --text-muted: 240 5% 65%;    /* Muted Gray */
  
  --primary: 210 100% 50%;     /* Blue #0080ff */
  --primary-hover: 210 100% 60%;
  
  --success: 142 70% 45%;      /* Emerald #10b981 */
  --success-glow: rgba(16, 185, 129, 0.15);
  
  --danger: 0 84% 60%;         /* Rose/Red #f43f5e */
  --danger-glow: rgba(244, 63, 94, 0.15);
  
  --cyan: 180 100% 50%;        /* #00f2fe */
  --purple: 270 100% 60%;      /* #a855f7 */
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: hsl(var(--bg));
  color: hsl(var(--text));
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Ambient glow backgrounds */
.glow-bg-1 {
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, hsla(var(--purple) / 0.15) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

.glow-bg-2 {
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 50%;
  height: 50%;
  background: radial-gradient(circle, hsla(var(--cyan) / 0.12) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

/* Main Container */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-height: 100vh;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(16px);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--purple)));
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  color: white;
  box-shadow: 0 0 20px hsla(var(--primary) / 0.3);
}

.brand-text h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 30%, hsl(var(--text-muted)));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
  font-weight: 400;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary) / 0.8));
  color: white;
  box-shadow: 0 4px 14px hsla(var(--primary) / 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, hsl(var(--primary-hover)), hsl(var(--primary)));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px hsla(var(--primary) / 0.35);
}

.btn-danger {
  background: transparent;
  border-color: hsla(var(--danger) / 0.3);
  color: hsl(var(--danger));
}

.btn-danger:hover {
  background: hsla(var(--danger) / 0.1);
  border-color: hsl(var(--danger));
  transform: translateY(-2px);
}

/* Switch Toggle styles */
.auto-refresh-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-right: 1rem;
}

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

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: hsla(var(--text-muted) / 0.2);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: hsl(var(--primary));
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  border-radius: 16px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  transition: var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--glass-border-hover);
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
}

.icon-blue {
  background: hsla(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.icon-green {
  background: hsla(var(--success) / 0.1);
  color: hsl(var(--success));
}

.icon-red {
  background: hsla(var(--danger) / 0.1);
  color: hsl(var(--danger));
}

.stat-info h3 {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 700;
}

/* Colors & Utility classes */
.text-green { color: hsl(var(--success)); }
.text-red { color: hsl(var(--danger)); }
.hidden { display: none !important; }

/* Dashboard Main Layout */
.dashboard-main {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.5rem;
  height: 680px;
}

@media (max-width: 1024px) {
  .dashboard-main {
    grid-template-columns: 1fr;
    height: auto;
  }
}

.logs-section, .viewer-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  border-radius: 20px;
  padding: 1.5rem;
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.section-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Search Bar */
.search-bar {
  position: relative;
  flex: 1;
  max-width: 320px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: hsl(var(--text-muted));
  font-size: 0.9rem;
}

.search-input, .search-bar input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.2rem;
  border-radius: 10px;
  background-color: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition-fast);
}

.search-bar input:focus {
  border-color: hsla(var(--primary) / 0.5);
  background-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px hsla(var(--primary) / 0.1);
}

/* Tabs */
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 0.75rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: hsl(var(--text-muted));
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: white;
  background-color: hsla(var(--primary) / 0.12);
  border: 1px solid hsla(var(--primary) / 0.2);
}

/* Logs List */
.logs-list-wrapper {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.logs-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Log Item Card */
.log-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: var(--transition-fast);
}

.log-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: scale(1.005);
}

.log-item.active {
  background-color: hsla(var(--primary) / 0.08);
  border-color: hsla(var(--primary) / 0.3);
}

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

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-success {
  background-color: hsl(var(--success));
  box-shadow: 0 0 10px hsl(var(--success));
}

.status-unauthorized {
  background-color: hsl(var(--danger));
  box-shadow: 0 0 10px hsl(var(--danger));
}

.log-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.log-title {
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.method-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
}

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

.log-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
}

.log-time {
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
}

.log-ip {
  font-size: 0.75rem;
  font-family: monospace;
  color: hsl(var(--text-muted));
  opacity: 0.7;
}

/* Empty State / Spinner */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  color: hsl(var(--text-muted));
  gap: 1rem;
  text-align: center;
}

.empty-state i {
  font-size: 2.5rem;
  opacity: 0.5;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.page-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.page-btn:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

.page-btn.active {
  background-color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

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

/* Badges */
.badge {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 500;
  background-color: rgba(255, 255, 255, 0.06);
  color: hsl(var(--text-muted));
}

.badge-success {
  background-color: hsla(var(--success) / 0.15);
  color: hsl(var(--success));
  border: 1px solid hsla(var(--success) / 0.3);
}

.badge-unauthorized {
  background-color: hsla(var(--danger) / 0.15);
  color: hsl(var(--danger));
  border: 1px solid hsla(var(--danger) / 0.3);
}

/* Inspector Viewer Details */
.viewer-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.015);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.viewer-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 3rem;
  text-align: center;
  color: hsl(var(--text-muted));
}

.placeholder-icon {
  font-size: 3.5rem;
  background: linear-gradient(135deg, hsl(var(--primary) / 0.5), hsl(var(--purple) / 0.5));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.5rem;
}

.viewer-placeholder h3 {
  font-family: 'Outfit', sans-serif;
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.viewer-placeholder p {
  font-size: 0.85rem;
  max-width: 320px;
}

.viewer-details {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Metadata Grid */
.metadata-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 1.25rem;
  background-color: rgba(255, 255, 255, 0.01);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-item:nth-child(3) {
  grid-column: span 2;
}

.meta-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: hsl(var(--text-muted));
  font-weight: 600;
  letter-spacing: 0.03em;
}

.meta-value {
  font-size: 0.85rem;
  font-weight: 500;
}

.code-font {
  font-family: 'Courier New', Courier, monospace;
  background-color: rgba(0, 0, 0, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

/* Inspector Tabs */
.inspector-tabs {
  display: flex;
  background-color: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.inspector-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: hsl(var(--text-muted));
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.inspector-tab:hover {
  color: white;
}

.inspector-tab.active {
  color: white;
  border-bottom-color: hsl(var(--primary));
  background-color: rgba(255, 255, 255, 0.02);
}

/* Tab panes */
.inspector-tab-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tab-pane {
  display: none;
  flex-direction: column;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

.tab-pane.active {
  display: flex;
}

.json-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background-color: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.75rem;
  color: hsl(var(--text-muted));
}

.btn-copy {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: hsl(var(--text-muted));
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.7rem;
  transition: var(--transition-fast);
}

.btn-copy:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.25);
  background-color: rgba(255, 255, 255, 0.04);
}

.btn-copy.copied {
  background-color: hsla(var(--success) / 0.15);
  border-color: hsl(var(--success));
  color: hsl(var(--success));
}

/* JSON Code Container */
.json-container {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
  background-color: rgba(0, 0, 0, 0.25);
  margin: 0;
}

.json-container code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

/* JSON Syntax Highlighter Colors */
.json-key { color: #f43f5e; font-weight: 500; }     /* Coral key */
.json-string { color: #34d399; }                  /* Emerald string */
.json-number { color: #38bdf8; }                  /* Sky blue number */
.json-boolean { color: #a78bfa; font-weight: bold; } /* Purple boolean */
.json-null { color: #94a3b8; font-style: italic; } /* Slate null */

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}
