/* Base Styles & Universal Token Framework */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Roboto+Flex:wght@400;500;600;700&family=VT323&display=swap');

:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  --container-max-width: 1380px;
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

.container {
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  width: 100%;
}

/* Common Header & Navbar */
.app-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: var(--backdrop-blur, blur(12px));
  -webkit-backdrop-filter: var(--backdrop-blur, blur(12px));
  transition: all var(--transition-normal);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1.5rem;
}

.nav-left-group {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.macos-traffic-lights {
  display: none;
}

.win11-caption-buttons {
  display: none;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: inherit;
  user-select: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--brand-gradient, linear-gradient(135deg, var(--accent-primary), var(--accent-secondary)));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: var(--brand-shadow, 0 4px 14px rgba(0, 0, 0, 0.25));
  transition: transform var(--transition-fast);
}

.brand-section:hover .brand-logo {
  transform: scale(1.05);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.brand-tag {
  font-size: 0.68rem;
  text-transform: uppercase;
  font-weight: 700;
  background: var(--badge-bg);
  color: var(--badge-text);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--badge-border);
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Control Hub (Theme & Template Selectors) */
.controls-hub {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.selector-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  gap: 0.25rem;
}

.selector-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 0.5rem;
  display: none;
}

@media (min-width: 900px) {
  .selector-label { display: block; }
}

.custom-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.custom-select:hover {
  background: var(--bg-card-hover);
}

.custom-select option {
  background: var(--bg-surface);
  color: var(--text-main);
}

.mode-toggle-group {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  gap: 0.2rem;
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.mode-btn:hover {
  color: var(--text-main);
  background: var(--bg-card-hover);
}

.mode-btn.active {
  background: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-glow, rgba(59, 130, 246, 0.3));
}

/* Navigation Tabs */
.view-tabs-bar {
  display: flex;
  gap: 0.4rem;
  margin-top: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.view-tabs-bar::-webkit-scrollbar {
  display: none;
}

.view-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.view-tab:hover {
  color: var(--text-main);
  background: var(--bg-surface);
}

.view-tab.active {
  color: var(--accent-primary);
  background: var(--accent-surface);
  border: 1px solid var(--border-focus);
}

/* Search & Filter Section */
.search-filter-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.75rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.search-bar-row {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input-icon {
  position: absolute;
  left: 0.9rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  pointer-events: none;
}

.search-main-input {
  width: 100%;
  background: var(--bg-input, var(--bg-body));
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  padding: 0.65rem 3.2rem 0.65rem 2.6rem;
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.search-main-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow, rgba(59, 130, 246, 0.2));
}

.search-keyboard-hint {
  position: absolute;
  right: 0.8rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0.15rem 0.4rem;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  pointer-events: none;
}

.categories-pills-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.1rem;
  scrollbar-width: thin;
}

.category-pill {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.category-pill:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.category-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px var(--accent-glow, rgba(59, 130, 246, 0.3));
}

.category-count {
  font-size: 0.68rem;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.2);
  padding: 0.05rem 0.35rem;
  border-radius: var(--radius-full);
}

/* Services Grid (Compact Heimdall Style) */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.95rem;
  margin-bottom: 2.5rem;
}

.service-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
}

.service-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
  box-shadow: var(--shadow-card-hover);
}

.service-card-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.service-icon-box {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.service-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.service-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.service-title {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.service-meta-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

.subcat-badge {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--accent-surface);
  border: 1px solid var(--border-focus);
  padding: 0.12rem 0.5rem;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

.node-badge {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Full-Width Dual Endpoint Action Bar */
.service-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border-subtle);
}

.endpoint-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.38rem 0.65rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  transition: all var(--transition-fast);
  color: inherit;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
}

.endpoint-btn:hover {
  background: var(--accent-surface);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.endpoint-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.endpoint-address {
  font-size: 0.76rem;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.endpoint-btn.external .endpoint-label {
  color: var(--text-secondary);
}

/* Section Common Layout */
.section-wrapper {
  margin-bottom: 3.5rem;
}

.section-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
}

.section-title-text {
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-main);
}

.section-meta-tag {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

/* Node Cards Grid */
.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
}

.node-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.node-box-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.node-identity h3 {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-main);
}

.node-ip-badge {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--accent-primary);
  font-weight: 600;
}

.specs-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  background: var(--bg-surface-elevated);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  border: 1px solid var(--border-subtle);
}

.spec-entry {
  display: flex;
  flex-direction: column;
}

.spec-entry-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.spec-entry-val {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.node-vm-list {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.vm-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  background: var(--bg-body);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.vm-spec-pill {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Network Segmentation Groups & Table */
.network-groups-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.net-group-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.net-group-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.net-group-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.net-group-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.net-group-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.table-responsive-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  box-shadow: var(--shadow-card);
}

.network-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.network-table th {
  background: var(--bg-surface-elevated);
  padding: 0.9rem 1.2rem;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.network-table td {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

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

.network-table tr:hover td {
  background: var(--bg-card-hover);
}

.table-code {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  background: var(--bg-surface-elevated);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

/* Quick Commands Grid */
.commands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1.5rem;
}

.cmd-category-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  box-shadow: var(--shadow-card);
}

.cmd-category-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.25rem;
  color: var(--text-main);
}

.cmd-category-header p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.terminal-block {
  background: var(--bg-terminal, #05070d);
  border: 1px solid var(--border-terminal, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md);
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cmd-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.04);
  gap: 0.75rem;
}

.cmd-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cmd-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.cmd-text {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--terminal-text, #38bdf8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* Toast Notifications */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--toast-bg, #10b981);
  color: #ffffff;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: all var(--transition-normal);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.toast-notice.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* Footer */
.app-footer {
  background: var(--bg-header);
  border-top: 1px solid var(--border-subtle);
  padding: 2.2rem 0;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--accent-primary);
}

/* No results state */
.no-results-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-surface);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
}
