@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Outfit:wght@500;600;700&family=Ubuntu:ital,wght@0,400;0,700;1,400&display=swap');

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

:root {
  /* Dark theme with black and blue */
  --bg-primary: #05080c;
  --bg-secondary: #0f1419;
  --bg-tertiary: #1a1f2e;
  --bg-card: #0d1117;
  --text-primary: #ffffff;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --border-color: #21262d;
  --accent-primary: #0ea5e9;
  --accent-secondary: #06b6d4;
  --accent-success: #22c55e;
  --accent-danger: #ef4444;
  --accent-warning: #f59e0b;
  --wire-red: #ef4444;
  --wire-black: #374151;
  --wire-blue: #3b82f6;
  --wire-yellow: #eab308;
  --wire-purple: #a855f7;
  --wire-gray: #9ca3af;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --gradient-primary: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
  --gradient-secondary: linear-gradient(135deg, #1e40af 0%, #0ea5e9 100%);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #05080c;
  color: var(--text-primary);
  line-height: 1.6;
  transition: none;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

.container {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

/* Logo in Sidebar */
.logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
  width: 100%;
}

.logo-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.logo-text h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0;
}

.logo-text .tagline {
  font-family: 'Ubuntu', cursive;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-secondary);
  margin: 0;
  text-align: center;
}


.logo img {
  width: 80px;
  height: auto;
  border-radius: 8px;
}

.main-content {
  flex: 1;
  padding: 0;
  width: 100%;
  height: 100%;
}

.content-grid {
  display: flex;
  width: 100%;
  height: 100%;
}

.left-panel {
  flex: 0 0 30%;
  background: #0D1117;
  backdrop-filter: blur(10px);
  padding: 2rem 1.5rem;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.right-panel {
  flex: 1;
  background: rgba(8, 12, 20, 0.5);
  backdrop-filter: blur(10px);
  padding: 2rem 1.5rem;
  height: 100%;
  overflow-y: auto;
}

/* Chip Selection */
.chip-selection h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  text-align: left;
  color: var(--text-primary);
  opacity: 0.9;
}

.chip-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chip-card {
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.chip-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.chip-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent-primary);
}

.chip-card:hover::before {
  transform: scaleX(1);
}

.chip-card.selected {
  border-color: var(--accent-primary);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(14, 165, 233, 0.1) 100%);
}

.chip-card.selected::before {
  transform: scaleX(1);
}

.chip-icon {
  width: 3rem;
  height: 3rem;
  background: var(--gradient-primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
  box-shadow: var(--shadow-md);
}

.chip-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Flash Section */
.flash-section {
  flex-shrink: 0;
}

.flash-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
}

.flash-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Centered Button */
.centered-button {
  display: flex;
  justify-content: center;
  width: 100%;
  align-items: center;
}

/* Key Section */
.key-section {
  margin-top: auto;
}

.key-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.key-text {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.btn-key {
  background: var(--gradient-primary);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
}

.btn-key:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Modern Tab Navigation */
.main-guide-tabs {
  display: flex;
  background: rgba(15, 20, 25, 0.8);
  backdrop-filter: blur(15px);
  padding: 0.5rem;
  border-radius: 14px;
  gap: 0.5rem;
  margin-bottom: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.main-guide-tab-btn {
  flex: 1;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  font-family: 'Outfit', sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
  white-space: nowrap;
}

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

.main-guide-tab-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.tab-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: -16px 0 2rem 0;
  opacity: 1;
  width: 100%;
}

/* Sub-Tab Navigation */
.tab-navigation {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  padding-bottom: 0.5rem;
  flex-wrap: wrap;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 0.6rem 1.25rem;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

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

.tab-btn.active {
  background: var(--accent-primary);
  color: white;
}

/* Tab Content */
.tab-content {
  position: relative;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

/* Key Description Section */
.key-description-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.key-description-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
}

.key-description-card h3 {
  color: var(--accent-primary);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.key-policy {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.key-policy h4 {
  color: var(--accent-secondary);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.key-policy ul {
  list-style: none;
  padding-left: 0;
}

.key-policy li {
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  padding-left: 1.5rem;
  position: relative;
}

.key-policy li::before {
  content: "✓";
  color: var(--accent-success);
  position: absolute;
  left: 0;
  font-weight: bold;
}

.pricing-section {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.pricing-section h4 {
  color: var(--accent-warning);
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.price-card {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 1rem;
  display: inline-block;
}

.price-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.price-label {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.price-value {
  color: var(--accent-primary);
  font-size: 1.5rem;
  font-weight: 700;
}

.purchase-section {
  text-align: center;
}

.purchase-section h4 {
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.purchase-section p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* Program Description Section */
.program-description-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.program-description-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
}

.program-description-card h3 {
  font-family: 'Outfit', sans-serif;
  color: var(--accent-primary);
  font-size: 1.5rem;
  margin-bottom: 2rem;
  text-align: left;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.feature-item {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.feature-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.feature-content h4 {
  color: var(--accent-secondary);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.feature-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.update-notice {
  background: var(--bg-tertiary);
  border: 1px solid var(--accent-primary);
  border-radius: 8px;
  padding: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.update-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.update-content h4 {
  color: var(--accent-primary);
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.update-content p {
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Chip Type Tabs */
.chip-type-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.chip-tab-btn {
  background: var(--bg-tertiary);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
  text-align: center;
}

.chip-tab-btn:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.chip-tab-btn.active {
  background: var(--accent-primary);
  color: white;
}

.chip-tab-content {
  display: none;
}

.chip-tab-content.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

/* Wiring Section */
.wiring-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.wiring-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
}

.wiring-card h3 {
  color: var(--accent-primary);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.wiring-card h4 {
  color: var(--accent-secondary);
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.wiring-card h5 {
  color: var(--accent-primary);
  font-size: 1.1rem;
  margin: 1.5rem 0 0.75rem;
}

/* Diagram Container */
.diagram-container {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 2rem;
  text-align: center;
}

.wiring-diagram {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Connection Table */
.connection-table {
  margin-bottom: 2rem;
}

.connection-table table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-tertiary);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.connection-table th,
.connection-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.connection-table th {
  background: var(--accent-primary);
  color: white;
  font-weight: 600;
}

.connection-table td {
  color: var(--text-secondary);
}

.wire-red {
  color: var(--wire-red);
  font-weight: 600;
}

.wire-black {
  color: var(--wire-black);
  font-weight: 600;
}

.wire-blue {
  color: var(--wire-blue);
  font-weight: 600;
}

.wire-yellow {
  color: var(--wire-yellow);
  font-weight: 600;
}

.wire-purple {
  color: var(--wire-purple);
  font-weight: 600;
}

.wire-gray {
  color: var(--wire-gray);
  font-weight: 600;
}

/* Important Notes */
.important-notes {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--accent-warning);
  border-radius: 8px;
  padding: 1.5rem;
}

.important-notes h4 {
  color: var(--accent-warning);
  margin-bottom: 1rem;
}

.important-notes ul {
  list-style: none;
  padding-left: 0;
}

.important-notes li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  padding-left: 1.5rem;
  position: relative;
}

.important-notes li::before {
  content: "⚠️";
  position: absolute;
  left: 0;
}

/* Activation Section */
.activation-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.activation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
}

.activation-card h3 {
  color: var(--accent-primary);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.activation-card h4 {
  color: var(--accent-secondary);
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* Step Container */
.step-container {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
}

.step-number {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 1.1rem;
}

.step-content {
  flex: 1;
  margin-top: 1rem;
  background: transparent;
  overflow: hidden;
}

.step-header {
  padding: 0.4rem 0;
  cursor: pointer;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
}

.step-header::-webkit-details-marker {
  display: none;
}

.step-header h4 {
  color: var(--accent-primary);
  margin: 0;
  font-size: 1.1rem;
  /* Increased size */
  font-weight: 700;
  line-height: 1.2;
}

.step-icon-toggle::after {
  content: '▶';
  font-size: 0.85rem;
  color: #ffffff;
  transition: transform 0.2s ease;
  display: inline-block;
  transform: translateY(-5px);
  /* Nudge up more for larger text */
}

.step-content[open] .step-icon-toggle::after {
  transform: rotate(90deg) translateX(-5px);
}

.step-content ul {
  list-style: none;
  padding: 0.2rem 0 0.8rem 1.3rem;
  margin: 0;
}

.step-content li {
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
  padding: 0.25rem 0 0.25rem 1.1rem;
  position: relative;
  display: block;
  line-height: 1.4;
  font-size: 0.95rem;
  /* Match update list */
}

.step-content li strong {
  font-weight: 500;
}

.step-content li::before {
  content: "→";
  color: var(--accent-primary);
  position: absolute;
  left: 0;
  top: 0.3rem;
  /* Align with first line of text */
  transform: none;
  font-weight: bold;
}

/* Image Placeholder */
.image-placeholder {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  padding: 3rem 1rem;
  margin: 1rem 0;
  text-align: center;
}

.placeholder-text {
  color: var(--text-muted);
  font-style: italic;
}

/* Code Block */
.code-block {
  background: var(--bg-card);
  border-radius: 4px;
  padding: 1rem;
  margin: 1rem 0;
  font-family: "Courier New", monospace;
  color: var(--accent-primary);
  text-align: center;
  font-weight: 600;
}

/* Result Container */
.result-container {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.result-container h4 {
  margin-bottom: 1rem;
}

.result-container p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.result-container.error h4 {
  color: var(--accent-danger);
}

.result-container.success h4 {
  color: var(--accent-success);
}

/* App Section */
.app-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.app-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
}

.app-card h3 {
  color: var(--accent-primary);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.app-card h4 {
  color: var(--accent-secondary);
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

/* App Download */
.app-download {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.app-stores {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.app-store-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem 2rem;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.app-store-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
}

.app-store-icon {
  font-size: 1.5rem;
}

.qr-placeholder {
  background: white;
  width: 150px;
  height: 150px;
  margin: 1rem auto;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* App Setup */
.app-setup {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.setup-steps {
  list-style: none;
  padding-left: 0;
  counter-reset: step-counter;
}

.setup-steps li {
  margin-bottom: 1.5rem;
  padding-left: 2.5rem;
  position: relative;
}

.setup-steps li::before {
  counter-increment: step-counter;
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.75rem;
  height: 1.75rem;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.setup-steps li strong {
  color: var(--accent-primary);
  display: block;
  margin-bottom: 0.25rem;
}

.setup-steps li p {
  color: var(--text-secondary);
}

/* App Interface */
.app-interface {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.interface-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.interface-item {
  text-align: center;
}

.interface-placeholder {
  background: var(--bg-card);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  padding: 3rem 1rem;
  margin-bottom: 1rem;
}

.interface-item p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* App Troubleshooting */
.app-troubleshooting {
  background: var(--bg-tertiary);
  border-radius: 8px;
  padding: 1.5rem;
}

.trouble-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.trouble-item {
  background: var(--bg-card);
  border-radius: 8px;
  padding: 1.5rem;
}

.trouble-item h5 {
  color: var(--accent-primary);
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.trouble-item ul {
  list-style: none;
  padding-left: 0;
}

.trouble-item li {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  padding-left: 1.5rem;
  position: relative;
  font-size: 0.9rem;
}

.trouble-item li::before {
  content: "→";
  color: var(--accent-primary);
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ESP Web Tools Button Styling */
esp-web-install-button {
  --esp-tools-button-color: white;
  --esp-tools-button-background: var(--accent-primary);
  --esp-tools-button-border-radius: 8px;
  --esp-tools-button-padding: 0.75rem 1.5rem;
  --esp-tools-button-font-weight: 600;
  width: 100%;
}

.invisible {
  visibility: hidden;
}

/* Status Section */
.status-section {
  flex-shrink: 0;
}

.status-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.status-icon {
  width: 3rem;
  height: 3rem;
  background: var(--gradient-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto 1rem;
  animation: pulse 2s infinite;
}

.status-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--accent-primary);
}

.status-card p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

/* Footer */
.footer {
  padding: 3rem 0 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 3rem;
  width: 100%;
}

.footer-content {
  text-align: center;
}

.footer-content h3 {
  color: var(--accent-primary);
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.footer-link {
  color: var(--text-secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s ease;
  font-weight: 500;
}

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

.footer-icon {
  font-size: 1.2rem;
}

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

/* Animations */
@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}

/* Responsive Design - Comprehensive Optimization */
@media (max-width: 1024px) {
  body {
    overflow-x: hidden;
  }

  .container,
  .main-content,
  .content-grid {
    height: auto;
    overflow: visible;
    padding: 0;
    margin: 0;
    width: 100%;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .content-grid {
    flex-direction: column;
  }

  .left-panel,
  .right-panel {
    flex: 1 1 auto;
    width: 100%;
    padding: 1.5rem 1rem;
    border-radius: 0;
    border: none;
    background: transparent;
    backdrop-filter: none;
    height: auto;
    box-shadow: none;
  }

  .logo {
    padding: 1rem 0 2rem;
    border-bottom: none;
    margin-bottom: 0;
  }

  /* Utility Responsive Fixes */
  img,
  .wiring-diagram {
    max-width: 100% !important;
    height: auto !important;
  }

  table {
    word-break: break-word !important;
  }

  td,
  th {
    white-space: normal !important;
  }

  .connection-table {
    overflow-x: auto !important;
  }

  .popup-box {
    width: 95% !important;
    padding: 1.5rem !important;
  }
}

@media (max-width: 768px) {
  .logo-text h1 {
    font-size: 1.5rem;
  }

  .main-guide-tabs {
    padding: 0.25rem;
    border-radius: 12px;
  }

  .main-guide-tab-btn {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }

  .tab-navigation {
    gap: 0.4rem;
  }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  .update-card,
  .program-description-card {
    padding: 1.5rem;
  }

  .update-card h3,
  .program-description-card h3 {
    font-size: 1.25rem;
  }
}

.update-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.update-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 2rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.update-card h3 {
  font-family: 'Outfit', sans-serif;
  color: var(--accent-primary);
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.update-card ul {
  list-style: none;
  padding-left: 0;
}

.update-card li {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  position: relative;
}

.update-card li::before {
  content: "✔️";
  position: absolute;
  left: 0;
  color: var(--accent-success);
}

.feature-request-form {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin-top: 2rem;
}

.feature-request-form h4 {
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.feature-request-form p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
}

#formMessage {
  margin-top: 1rem;
  font-weight: 600;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

::-webkit-scrollbar-thumb {
  background: #0EA5E9;
  border-radius: 10px;
  border: 2px solid #05080c;
}

::-webkit-scrollbar-thumb:hover {
  background: #0ea5e9;
  filter: brightness(1.2);
}



/* === Tab 4 License - Dark theme === */
.license-scope {
  color: var(--text, #e5eef7);
  padding-top: 8px;
}

.license-scope .header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0 16px;
}

.license-scope #title {
  margin: 0;
  font-size: 20px;
  color: var(--heading, #e6f0ff);
}

.license-scope .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--chip, #1f2937);
  color: var(--muted-fg, #cbd5e1);
  border: 1px solid var(--chip-border, #2a3646);
  white-space: nowrap;
}

.license-scope .badge.muted {
  opacity: .95;
}

.license-scope .badge.ok {
  background: #146c43;
  color: #fff;
  border-color: #146c43;
}

.license-scope .row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.license-scope input,
.license-scope textarea {
  flex: 1;
  background: var(--bg-input, #0f172a);
  color: var(--text, #e5eef7);
  border: 1px solid var(--border, #2a3646);
  border-radius: 12px;
  padding: 12px 14px;
}

.license-scope input::placeholder,
.license-scope textarea::placeholder {
  color: #9aa7b2;
}

.license-scope button {
  height: 40px;
  line-height: 1;
  padding: 10px 14px;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--btn-border, #2a3646);
  background: var(--btn-bg, #1f2937);
  color: var(--btn-fg, #e5e7eb);
  transition: transform .02s ease, filter .15s ease;
}

.license-scope button:hover {
  filter: brightness(1.08);
}

.license-scope button:active {
  transform: translateY(1px);
}

.license-scope button:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.license-scope #btnConnect {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #fff;
}

.license-scope #btnActivate {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
}

.license-scope #btnReboot {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
}

.license-scope #log {
  margin-top: 12px;
  padding: 16px;
  min-height: 180px;
  max-height: 320px;
  overflow: auto;
  border-radius: 12px;
  background: var(--bg-card, #0e1620);
  border: 1px solid var(--border, #2a3646);
  color: #d1e7ff;
}

.license-scope hr {
  border: 0;
  height: 1px;
  background: var(--border, #2a3646);
  margin: 18px 0;
}

@media (max-width:560px) {
  .license-scope #title {
    font-size: 22px;
  }

  .license-scope .badge {
    height: 24px;
    font-size: 11px;
    padding: 0 8px;
  }
}

.iv.hidden {
  display: none;
}

/* Overlay */
.iv {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  user-select: none;
  touch-action: none;
  /* để xử lý pinch/drag bằng Pointer Events */
}

/* Thanh công cụ */
.iv__toolbar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  color: #fff;
  font: 500 14px/1.2 system-ui, sans-serif;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.iv__btn {
  margin-left: auto;
  pointer-events: auto;
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.iv__btn:hover {
  background: rgba(255, 255, 255, .12);
}

.iv__hint {
  opacity: .85;
}

/* Sân khấu giữ ảnh */
.iv__stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  cursor: grab;
}

.iv__stage.dragging {
  cursor: grabbing;
}

/* Ảnh được transform */
#ivImg {
  will-change: transform;
  transform-origin: 50% 50%;
  max-width: none;
  max-height: none;
  /* để tự tính scale */
  image-rendering: -webkit-optimize-contrast;
  -ms-interpolation-mode: nearest-neighbor;
}

/* --- Parts / Links catalogue --- */
.links-section {
  display: block;
}

.links-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.links-card h3 {
  text-align: center;
  color: var(--accent-primary);
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

.parts-group+.parts-group {
  margin-top: 1.25rem;
}

.parts-group h4 {
  color: var(--accent-secondary);
  font-size: 1.05rem;
  margin: 0.75rem 0 0.75rem;
}

.parts-list {
  list-style: none;
  padding-left: 0;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.part-link {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.25rem 0.75rem;
  align-items: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  text-decoration: none;
  transition: all .2s ease;
}

.part-title {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.25;
}

.part-note {
  color: var(--text-secondary);
  font-size: 0.88rem;
  grid-column: 1 / span 1;
}

.part-go {
  color: var(--accent-primary);
  font-weight: 700;
  white-space: nowrap;
}

.part-link:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(14, 165, 233, 0.08) 100%);
}

@media (max-width: 560px) {
  .parts-list {
    grid-template-columns: 1fr;
  }
}

.version-item {
  display: grid;
  gap: 4px;
}

.version-name {
  font-weight: 700;
}

.version-desc {
  font-size: 0.9rem;
  line-height: 1.3;
  opacity: 0.9;
}

.version-desc a {
  text-decoration: underline;
}

/* ===== Popup ===== */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.popup-box {
  width: min(680px, 92vw);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: .9rem 1rem .9rem;
  box-shadow: var(--shadow-lg);
  animation: fadeIn .3s ease;
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.close-btn {
  position: absolute;
  top: .75rem;
  right: .75rem;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.popup-header h3 {
  margin: 0 0 .15rem 0;
  font-size: 1.3rem;
  color: var(--accent-primary);
  text-align: center;
}

.popup-header p {
  margin: 0 0 .5rem 0;
  color: var(--text-secondary);
  text-align: center;
  font-size: .88rem;
  line-height: 1.4;
}

.popup-subtitle {
  margin: 0 0 .5rem 0;
  color: var(--text-secondary);
  text-align: center;
  font-size: .88rem;
}

/* Danh sách thông báo */
.notice-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  text-align: left;
}

.notice-item {
  display: grid;
  grid-template-columns: 1.4rem 1fr;
  column-gap: .35rem;
  align-items: start;
  padding: .65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: none;
}

.notice-item:last-child {
  border-bottom: none;
}

.notice-item:hover .notice-title {
  color: var(--accent-primary);
}

.notice-icon {
  font-size: .95rem;
  line-height: 1.4;
  padding-top: .05rem;
}

.notice-content {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.notice-title {
  font-weight: 700;
  color: var(--text-primary);
  font-size: .88rem;
  line-height: 1.4;
  text-align: left;
  transition: color .2s;
}

.notice-desc {
  color: var(--text-secondary);
  font-size: .88rem;
  line-height: 1.45;
  text-align: left;
}

.notice-important .notice-title {
  color: var(--accent-warning);
}

/* Nút hành động */
.popup-actions {
  margin-top: .6rem;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: .75rem;
}

.popup-actions .btn {
  flex: 1;
  min-width: 0;
  box-sizing: border-box;
  white-space: nowrap;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: .5rem 1rem;
  font-size: .88rem;
}

/* Mobile */
@media (max-width: 480px) {
  .popup-box {
    padding: 1rem .9rem .9rem;
  }

  .notice-item {
    grid-template-columns: 32px 1fr;
  }
}

/* Step Container */
#donate-tab .card {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

#donate-tab h1 {
  font-size: 1.75rem;
  color: var(--accent-primary);
}

#donate-tab .muted {
  color: var(--text-secondary);
}

#donate-tab .btn-primary {
  background: var(--accent-primary);
  color: white;
  padding: .75rem 1.5rem;
  border-radius: 25px;
  text-transform: uppercase;
  transition: background 0.3s;
  font-weight: 600;
}

#donate-tab .btn-primary:hover {
  background: var(--accent-hover);
}

#donate-tab .qr-container {
  text-align: center;
  margin-bottom: 1.5rem;
}

#donate-tab .qr-codes {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

#donate-tab .qr-code-section {
  flex: 1;
  text-align: center;
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

#donate-tab .qr-code-section h4 {
  font-size: 1.25rem;
  color: var(--text-primary);
}

#donate-tab .qr-code-img {
  max-width: 250px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  border-radius: 12px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#donate-tab .qr-code-section p {
  font-size: 1rem;
  color: var(--text-primary);
}

#donate-tab .controls {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

#donate-tab .controls .btn-primary {
  min-width: 180px;
}

#donate-tab p a {
  color: var(--accent-primary);
  text-decoration: none;
}

#donate-tab p a:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  #donate-tab .qr-codes {
    flex-direction: column;
    gap: 1.5rem;
  }
}

.input {
  padding: 10px 12px;
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  background: transparent;
  color: inherit;
}

.result.error {
  color: #ff6b6b;
}



/* Bố cục nút chip: ảnh trên, tên dưới */
.chip-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Khung chứa ảnh */
.chip-thumb {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.25rem;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Ảnh bên trong */
.chip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Tên chip */
.chip-label {
  font-size: 0.9rem;
  line-height: 1.3;
}

/* New Centered Notification Modal */
.notification-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
  animation: fadeInModal 0.3s ease;
}

.notification-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 2.5rem;
  width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: scaleUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.notification-icon-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.notification-icon-circle.success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 3px solid #22c55e;
}

.notification-icon-circle.error {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 3px solid #ef4444;
}

.notification-icon-circle.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 3px solid #f59e0b;
}

.notification-icon-circle.info {
  background: rgba(14, 165, 233, 0.15);
  color: #0ea5e9;
  border: 3px solid #0ea5e9;
}

.notification-message {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  font-family: 'Outfit', sans-serif;
}

@keyframes fadeInModal {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleUpModal {
  from {
    transform: scale(0.8);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Update Card Wrapper */
.update-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border-left: 5px solid var(--accent-primary);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.update-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

/* Status Badge Prominence */
.statusBadge.badge.err {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #ef4444 !important;
  border: 1px solid #ef4444 !important;
  font-weight: 800 !important;
}

.statusBadge.badge.ok {
  background: rgba(34, 197, 94, 0.2) !important;
  color: #22c55e !important;
  border: 1px solid #22c55e !important;
  font-weight: 800 !important;
}