/* MosDev Control Center V1.1.0 - Dark & Deep Black Modern Theme */
:root {
  --bg-base: #0a0c10;
  --bg-surface: #12161f;
  --bg-surface-hover: #1a202c;
  --bg-glass: rgba(18, 22, 31, 0.75);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: #00ff87;
  
  --text-primary: #f0f4f8;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent-green: #00ff87;
  --accent-green-glow: rgba(0, 255, 135, 0.15);
  --accent-purple: #a855f7;
  --accent-purple-glow: rgba(168, 85, 247, 0.15);
  --accent-blue: #38bdf8;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Cantarell, "Fira Code", monospace, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-panel: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --spacing-card: 1.25rem;
}

/* Deep Black Display Mode */
[data-theme="deep-black"] {
  --bg-base: #000000;
  --bg-surface: #0a0a0c;
  --bg-surface-hover: #121215;
  --bg-glass: rgba(10, 10, 12, 0.85);
  --border-color: rgba(255, 255, 255, 0.12);
}

/* Compact Density */
[data-density="compact"] {
  --spacing-card: 0.75rem;
  font-size: 14px;
}

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

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-family);
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 2rem;
}

/* Header Component */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

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

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-green), var(--accent-purple));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #000;
  box-shadow: 0 0 12px var(--accent-green-glow);
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-version {
  font-size: 0.75rem;
  background: rgba(0, 255, 135, 0.1);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 135, 0.3);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
}

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

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

.pulse-dot.degraded {
  background-color: var(--accent-amber);
  box-shadow: 0 0 8px var(--accent-amber);
}

.pulse-dot.error {
  background-color: var(--accent-red);
  box-shadow: 0 0 8px var(--accent-red);
}

.btn {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--text-muted);
}

.btn-primary {
  background: linear-gradient(135deg, #00ff87, #00b862);
  color: #000;
  font-weight: 600;
  border: none;
}

.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 0 12px var(--accent-green-glow);
}

/* Navigation Tabs */
.nav-tabs-container {
  max-width: 1400px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs-container::-webkit-scrollbar {
  display: none;
}

.nav-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.25rem;
  min-width: max-content;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  transition: all 0.2s ease;
  position: relative;
}

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

.tab-btn.active {
  color: var(--accent-green);
  font-weight: 600;
  background: var(--bg-surface);
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
}

/* Main Container */
.main-content {
  max-width: 1400px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}

.tab-panel {
  display: none;
}

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

/* Stale Warning Banner */
.stale-banner {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--accent-amber);
  color: #fbbf24;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

/* Card Grid Layouts */
.grid-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-card);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0.5rem 0 0.25rem;
  color: var(--text-primary);
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Section Header */
.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Panel Containers */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--spacing-card);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-panel);
}

/* Projects Grid */
.grid-projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.project-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: rgba(0, 255, 135, 0.4);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.project-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(0, 255, 135, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(0, 255, 135, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.project-details {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.project-detail-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.project-actions {
  display: flex;
  gap: 0.5rem;

  margin-top: auto;
}

.project-actions a {
  text-decoration: none;
  flex: 1;
  text-align: center;
}

/* Services Grid */
.grid-services {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.service-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.service-card.interactive {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.service-card.interactive:hover,
.service-card.interactive:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(0, 255, 135, 0.4);
  box-shadow: 0 0 12px var(--accent-green-glow);
  outline: none;
}

.service-icon-hint {
  font-size: 0.85rem;
  color: var(--accent-green);
  opacity: 0.8;
  margin-left: 0.3rem;
  transition: opacity 0.2s ease;
}

.service-card.interactive:hover .service-icon-hint,
.service-card.interactive:focus-visible .service-icon-hint {
  opacity: 1;
}

/* Modal Component */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

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

.modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
}

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

.modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.modal-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.modal-label {
  color: var(--text-muted);
}

.modal-value {
  color: var(--text-primary);
  font-weight: 500;
}

.font-mono {
  font-family: "Fira Code", monospace;
  color: var(--accent-green);
}

.modal-notice {
  font-size: 0.82rem;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 0.75rem;
  border-radius: var(--radius-md);
  line-height: 1.4;
}

.modal-command-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.modal-code-snippet {
  margin-top: 0.2rem;
}

.modal-footer {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
}

/* Health Checks List */
.health-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.health-item {
  background: var(--bg-surface-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Log Terminal Box */
.log-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.input-text, .select-input {
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  outline: none;
}

.input-text:focus, .select-input:focus {
  border-color: var(--accent-green);
}

.log-box {
  background: #05070a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: "Fira Code", monospace, monospace;
  font-size: 0.82rem;
  color: #a7f3d0;
  max-height: 480px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

.log-line {
  padding: 0.15rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.log-line:hover {
  background: rgba(255, 255, 255, 0.04);
}

.copy-icon-btn {
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s;
  user-select: none;
}

.copy-icon-btn:hover {
  opacity: 1;
}

/* Command Cards */
.command-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.code-snippet {
  background: #05070a;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-family: "Fira Code", monospace;
  font-size: 0.9rem;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  overflow-x: auto;
}

/* Progress bar */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.4rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-purple));
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Accordion & Guide */
.guide-content {
  line-height: 1.7;
  color: var(--text-secondary);
}

.guide-section {
  margin-bottom: 1.5rem;
}

.guide-section h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

/* Responsive Rules for Galaxy Z Fold and Mobile */
@media (max-width: 600px) {
  .site-header {
    padding: 0.5rem 1rem;
  }

  .header-container {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-tabs-container {
    padding: 0 0.75rem;
  }

  .main-content {
    padding: 0 0.75rem;
  }

  .grid-metrics, .grid-projects, .grid-services {
    grid-template-columns: 1fr;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
