:root {
  --bg-dark: #090d13;
  --bg-card: rgba(22, 27, 34, 0.65);
  --bg-card-hover: rgba(33, 38, 45, 0.8);
  --border-color: rgba(240, 246, 252, 0.12);
  --border-hover: rgba(88, 166, 255, 0.35);
  
  --color-primary: #58a6ff;
  --color-primary-hover: #388bfd;
  --color-success: #3fb950;
  --color-warning: #d29922;
  --color-danger: #f85149;
  
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-sans);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

/* Background glows */
.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}

.bg-glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--color-primary) 0%, transparent 70%);
  top: -100px;
  right: -100px;
}

.bg-glow-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #ab47bc 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
}

/* Shared Glassmorphism Helper */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Main Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

/* HEADER */
.app-header {
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.brand h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 0%, var(--color-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 4px;
}

.badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-version {
  background-color: rgba(88, 166, 255, 0.15);
  color: var(--color-primary);
  border: 1px solid rgba(88, 166, 255, 0.3);
  margin-left: 6px;
  vertical-align: middle;
}

.header-status-cards {
  display: flex;
  gap: 16px;
}

.status-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.status-icon {
  font-size: 1.5rem;
}

.status-info {
  display: flex;
  flex-direction: column;
}

.status-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-val {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 2px;
}

/* LAYOUT */
.main-layout {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 30px;
  align-items: start;
}

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

/* SIDEBAR */
.sidebar {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sidebar h2 {
  font-size: 1.3rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

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

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

.form-group input[type="text"] {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

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

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  flex: 1;
}

.input-with-btn button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 42px;
  color: var(--text-main);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.input-with-btn button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-primary);
}

.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 0;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.checkbox-group label {
  cursor: pointer;
  user-select: none;
}

.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

/* BUTTONS */
.btn {
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: none;
  text-align: center;
  transition: background 0.2s ease, transform 0.1s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background-color: var(--color-success);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #2ea043;
  box-shadow: 0 0 12px rgba(63, 185, 80, 0.3);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: var(--border-hover);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* TABS CONTAINER */
.tabs-container {
  padding: 0;
  overflow: hidden;
}

.tabs-header {
  display: flex;
  background: rgba(0, 0, 0, 0.15);
  border-bottom: 1px solid var(--border-color);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  padding: 16px 20px;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
  border-bottom: 2px solid transparent;
}

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

.tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: rgba(88, 166, 255, 0.04);
}

.tabs-content {
  padding: 24px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.tab-desc {
  margin-bottom: 20px;
}

.tab-desc h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.tab-desc p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* COMPONENT TREE */
.tree-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 16px;
  border: 1px solid var(--border-color);
}

.tree-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease;
  user-select: none;
  gap: 12px;
}

.tree-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.tree-item-level-0 {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-main);
  border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
  padding-top: 14px;
  padding-bottom: 10px;
}

.tree-item-level-0:first-child {
  padding-top: 0;
}

.tree-item-level-1 {
  padding-left: 28px;
  font-size: 0.95rem;
  color: #c9d1d9;
}

.tree-item-level-2 {
  padding-left: 56px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Cyclic Checklist Checkbox simulation */
.chk-box {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
  user-select: none;
  transition: all 0.15s ease;
}

.chk-box-checked {
  background-color: var(--color-success);
  border-color: var(--color-success);
  color: #ffffff;
}

.chk-box-remove {
  background-color: var(--color-danger);
  border-color: var(--color-danger);
  color: #ffffff;
}

.chk-box-unchecked {
  background-color: transparent;
  border-color: var(--text-muted);
  color: transparent;
}

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

.tree-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 6px;
}

/* Tree badges */
.tree-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.tree-badge-new {
  background-color: rgba(63, 185, 80, 0.15);
  color: var(--color-success);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.tree-badge-modified {
  background-color: rgba(210, 153, 34, 0.15);
  color: var(--color-warning);
  border: 1px solid rgba(210, 153, 34, 0.3);
}

/* SYSTEM DEPENDENCIES */
.dependencies-container {
  padding: 24px;
  margin-top: 30px;
}

.dependencies-container h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.section-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.dependencies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.dep-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.dep-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
}

.dep-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
}

.dep-name {
  font-weight: 600;
  font-size: 1rem;
}

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

.dep-status-ok {
  background-color: var(--color-success);
  box-shadow: 0 0 8px var(--color-success);
}

.dep-status-missing {
  background-color: var(--color-warning);
  box-shadow: 0 0 8px var(--color-warning);
}

.dep-version {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-all;
}

.btn-install-dep {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  background-color: rgba(88, 166, 255, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(88, 166, 255, 0.3);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  text-align: center;
}

.btn-install-dep:hover {
  background-color: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 0 8px rgba(88, 166, 255, 0.3);
}

/* MODALS */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-card {
  transform: translateY(0);
}

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

.modal-header h2 {
  font-size: 1.3rem;
  font-weight: 600;
}

.pulse-indicator {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.pulse-indicator::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--color-primary);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 1; box-shadow: 0 0 0 0 rgba(88, 166, 255, 0.7); }
  70% { transform: scale(1.1); opacity: 0.6; box-shadow: 0 0 0 6px rgba(88, 166, 255, 0); }
  100% { transform: scale(0.9); opacity: 1; box-shadow: 0 0 0 0 rgba(88, 166, 255, 0); }
}

.btn-close-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.8rem;
  cursor: pointer;
  line-height: 1;
}

.btn-close-icon:hover {
  color: var(--text-main);
}

/* TERMINAL / LOG BODY */
.terminal-body {
  background-color: #040609;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: #7ee787;
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 350px;
  max-height: 500px;
  border-bottom: 1px solid var(--border-color);
}

.terminal-line {
  margin-bottom: 4px;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-line-error {
  color: var(--color-danger);
}

.terminal-line-success {
  color: #a5d6ff;
  font-weight: 600;
}

.terminal-line-info {
  color: #8b949e;
}

.modal-footer {
  padding: 16px 24px;
  background: rgba(0, 0, 0, 0.15);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* CHANGELOG CONTENT */
.changelog-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 500px;
  font-size: 0.95rem;
  line-height: 1.6;
}

.changelog-section {
  margin-bottom: 20px;
}

.changelog-section:last-child {
  margin-bottom: 0;
}

.changelog-title-added { color: var(--color-success); font-weight: 600; font-size: 1.05rem; margin-bottom: 8px; }
.changelog-title-modified { color: var(--color-warning); font-weight: 600; font-size: 1.05rem; margin-bottom: 8px; }
.changelog-title-removed { color: var(--color-danger); font-weight: 600; font-size: 1.05rem; margin-bottom: 8px; }

.changelog-list {
  list-style-type: none;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  border: 1px solid var(--border-color);
}

.changelog-list li {
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.changelog-list li:last-child {
  margin-bottom: 0;
}

.changelog-empty {
  color: var(--color-success);
  text-align: center;
  font-weight: 600;
  padding: 20px 0;
}
