:root {
  --bg-dark: #050508;
  --panel-bg: #0c0914;
  --panel-border: #281d3d;
  --accent-purple: #a855f7;
  --accent-neon-purple: #d8b4fe;
  --accent-green: #22c55e;
  --accent-cyan: #06b6d4;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --font-pixel: 'Press Start 2P', monospace;
  --font-mono: 'VT323', monospace;
  --font-main: 'Inter', sans-serif;
}

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

body {
  background-color: var(--bg-dark);
  background-image:
    linear-gradient(rgba(168, 85, 247, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 85, 247, 0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  color: var(--text-main);
  font-family: var(--font-main);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

/* App Window Shell */
.app-window {
  width: 100%;
  max-width: 1050px;
  background: var(--panel-bg);
  border: 2px solid var(--panel-border);
  border-radius: 12px;
  box-shadow: 0 0 40px rgba(168, 85, 247, 0.25), 0 20px 50px rgba(0, 0, 0, 0.9);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: #06040a;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--panel-border);
  flex-wrap: wrap;
  gap: 10px;
}

.window-controls {
  display: flex;
  gap: 8px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.brand-name {
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  letter-spacing: 1px;
}
.brand-name .highlight {
  color: var(--accent-purple);
}

.system-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent-green);
}

.status-indicator {
  width: 8px;
  height: 8px;
  background: var(--accent-green);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

/* Pixel Hero Banner Image Container */
.hero-banner-container {
  width: 100%;
  max-height: 220px;
  overflow: hidden;
  border-bottom: 2px solid var(--panel-border);
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Tabs Navigation */
.app-nav {
  display: flex;
  flex-wrap: wrap;
  background: #090611;
  border-bottom: 1px solid var(--panel-border);
}

.nav-btn {
  flex: 1 1 140px;
  padding: 16px 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.nav-btn:hover {
  color: var(--text-main);
  background: rgba(168, 85, 247, 0.05);
}

.nav-btn.active {
  color: var(--accent-neon-purple);
  border-bottom: 2px solid var(--accent-purple);
  background: rgba(168, 85, 247, 0.1);
}

/* App Main Content */
.app-content {
  padding: clamp(16px, 4vw, 30px);
  min-height: 480px;
}

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

.panel-header {
  margin-bottom: 25px;
}

.panel-header h2 {
  font-size: clamp(1.2rem, 4vw, 1.5rem);
  margin-bottom: 5px;
}

.panel-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Grid of Pixel Terminal Rigs */
.rigs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 25px;
}

.rig-card {
  background: #110d1c;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rig-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(168, 85, 247, 0.2);
  border-color: var(--accent-purple);
}

.badge {
  position: absolute;
  top: 15px;
  right: 15px;
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge.purple { background: rgba(168, 85, 247, 0.2); color: var(--accent-neon-purple); border: 1px solid var(--accent-purple); }
.badge.gold { background: rgba(234, 179, 8, 0.2); color: #facc15; border: 1px solid #facc15; }
.badge.green { background: rgba(34, 197, 94, 0.2); color: var(--accent-green); border: 1px solid var(--accent-green); }

.rig-img-wrapper {
  width: 100%;
  height: 180px;
  background: #050308;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 15px;
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid rgba(168, 85, 247, 0.2);
}

.pixel-rig-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.rig-card h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.rig-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 15px;
}

.rig-specs {
  list-style: none;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.rig-specs li {
  padding: 3px 0;
}

.rig-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.rig-price {
  font-family: var(--font-mono);
  font-size: 1.6rem;
  color: var(--accent-green);
  font-weight: bold;
}

/* Builder Layout */
.builder-container {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 25px;
}

.config-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.option-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.option-group label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
}

.builder-select {
  background: #110d1c;
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 12px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
}

.builder-select:focus {
  border-color: var(--accent-purple);
}

.builder-summary-card {
  background: #110d1c;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.spec-list {
  list-style: none;
  margin: 15px 0;
}

.spec-list li {
  font-size: 0.85rem;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.price-breakdown {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed var(--panel-border);
}

.total-amount {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  color: var(--accent-green);
  font-weight: bold;
}

/* Common Action Button */
.action-btn {
  padding: 12px 18px;
  background: var(--accent-purple);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.action-btn:hover {
  background: #9333ea;
  box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
}

.rig-footer .action-btn {
  width: auto;
}

/* Services */
.services-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
}

.service-cards {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.service-box {
  background: #110d1c;
  border: 1px solid var(--panel-border);
  padding: 15px;
  border-radius: 8px;
}

.service-icon {
  font-size: 1.4rem;
  margin-bottom: 5px;
}

.service-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 6px 0;
}

.service-cost {
  font-family: var(--font-mono);
  color: var(--accent-cyan);
  font-size: 1.2rem;
}

.service-form {
  background: #110d1c;
  border: 1px solid var(--panel-border);
  padding: 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.service-form input, .service-form select, .service-form textarea {
  width: 100%;
  padding: 10px;
  background: #08060e;
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  color: var(--text-main);
  font-family: var(--font-main);
}

/* Cart */
.cart-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 25px;
}

.cart-items {
  background: #110d1c;
  border: 1px solid var(--panel-border);
  padding: 20px;
  border-radius: 8px;
  min-height: 200px;
}

.empty-msg {
  color: var(--text-muted);
  text-align: center;
  margin-top: 60px;
}

.cart-item-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--panel-border);
}

.checkout-box {
  background: #110d1c;
  border: 1px solid var(--panel-border);
  padding: 20px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.checkout-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.checkout-line.total {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--accent-green);
}

.divider {
  border: 0;
  border-top: 1px solid var(--panel-border);
}

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

/* Footer Terminal */
.app-footer {
  background: #06040a;
  padding: 12px 20px;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
  .builder-container, .services-container, .cart-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px;
  }
  .brand-name {
    font-size: 0.65rem;
  }
  .system-status {
    font-size: 0.95rem;
  }
}
