@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
  --bg-dark: #090d16;
  --bg-panel: rgba(17, 24, 39, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.15);
  --secondary: #10b981;
  --secondary-glow: rgba(16, 185, 129, 0.15);
  --accent: #8b5cf6;
  
  --text-primary: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #4b5563;
  
  --danger: #ef4444;
  --warning: #f59e0b;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 40%);
  background-attachment: fixed;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: rgba(9, 13, 22, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 2.25rem;
  height: 2.25rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #ffffff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-badge {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  padding: 0.15rem 0.4rem;
  border-radius: 9999px;
  font-weight: 600;
  margin-left: 0.5rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  padding: 0.4rem 0.8rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
}

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

.status-dot.online {
  background-color: var(--secondary);
  box-shadow: 0 0 8px var(--secondary);
  animation: pulse 2s infinite;
}

.status-dot.offline {
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

main {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 2rem;
}

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

/* Sidebar Styling */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.navigation-tabs {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.35rem;
  display: flex;
  gap: 0.25rem;
  backdrop-filter: blur(12px);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.75rem 0.5rem;
  border-radius: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s ease;
}

.tab-btn i {
  font-size: 1.1rem;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

/* Control Panel */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  display: none;
}

.panel.active {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: fadeIn 0.3s ease-in-out;
}

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

.panel-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.form-input {
  width: 100%;
  background: rgba(9, 13, 22, 0.6);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder {
  color: #4b5563;
}

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

.toggle-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(9, 13, 22, 0.6);
  border: 1px solid var(--border-color);
  padding: 0.25rem;
  border-radius: 0.5rem;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.5rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toggle-btn.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.action-btn {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none;
  color: #ffffff;
  padding: 0.9rem 1.5rem;
  border-radius: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.25);
}

.action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.action-btn:active {
  transform: translateY(0);
}

.action-btn:disabled {
  background: #374151;
  color: #6b7280;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Right Panel Content / Viewer */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  min-height: 500px;
}

.viewer-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.viewer-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.viewer-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.viewer-actions {
  display: flex;
  gap: 0.5rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 2rem;
  height: 2rem;
  border-radius: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.viewer-body {
  flex: 1;
  position: relative;
  background: rgba(9, 13, 22, 0.4);
  display: flex;
  flex-direction: column;
  min-height: 450px;
}

.placeholder-view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  gap: 1rem;
  color: var(--text-muted);
}

.placeholder-icon {
  font-size: 3rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0.7;
}

.placeholder-view h3 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.placeholder-view p {
  max-width: 400px;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* PDF & JSON Viewers */
#pdf-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #525659; /* Standard PDF reader background */
}

#json-pre {
  margin: 0;
  padding: 1.5rem;
  overflow: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #a5b4fc;
  background: rgba(9, 13, 22, 0.8);
  height: 100%;
  max-height: 600px;
}

/* Terminal / Log Panel */
.terminal-card {
  background: #06090f;
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.8);
}

.terminal-header {
  background: rgba(255, 255, 255, 0.02);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.terminal-dots {
  display: flex;
  gap: 0.35rem;
}

.t-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.t-dot.red { background-color: #ef4444; }
.t-dot.yellow { background-color: #f59e0b; }
.t-dot.green { background-color: #10b981; }

.terminal-title {
  font-family: 'Fira Code', monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.terminal-body {
  padding: 1rem;
  height: 150px;
  overflow-y: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.8rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  scroll-behavior: smooth;
}

.log-entry {
  color: #9ca3af;
}

.log-time {
  color: #4b5563;
  margin-right: 0.5rem;
  user-select: none;
}

.log-entry.info .log-msg { color: #a5b4fc; }
.log-entry.success .log-msg { color: #34d399; }
.log-entry.warning .log-msg { color: #fbbf24; }
.log-entry.error .log-msg { color: #f87171; }

/* Diagnostic Cards Grid */
.diagnostic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 600px;
}

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

.diag-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.diag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.diag-title {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Cache List styling */
.cache-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 180px;
  overflow-y: auto;
  font-size: 0.8rem;
  padding-right: 0.25rem;
}

.cache-item {
  background: rgba(9, 13, 22, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 0.35rem;
  padding: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cache-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.cache-key {
  font-weight: 600;
  color: var(--text-primary);
}

.cache-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.cache-actions {
  display: flex;
  gap: 0.25rem;
}

.btn-small-danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
  padding: 0.25rem 0.4rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.health-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.health-stat-box {
  background: rgba(9, 13, 22, 0.5);
  border: 1px solid var(--border-color);
  padding: 0.75rem;
  border-radius: 0.5rem;
  text-align: center;
}

.health-stat-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.health-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.diag-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-secondary {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.6rem;
  border-radius: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Scrollbar customizations */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(9, 13, 22, 0.4);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}
