/**
 * Cloud 360 - Design System & Modern Engineering Stylesheet
 * Brand: Cloud 360 (Engineering • Innovation • Learning)
 * Owner: Aman Verma
 */

:root {
  /* Dark Theme (Default) - Navy/Charcoal surfaces with Cyan/Blue/Purple accents */
  --c360-bg: #0a0e1a;
  --c360-bg-alt: #0e1526;
  --c360-surface: #121a2d;
  --c360-surface-2: #1b2640;
  --c360-surface-elevated: #1b2640;
  --c360-surface-glass: rgba(18, 26, 45, 0.88);
  
  --c360-border: rgba(255, 255, 255, 0.12);
  --c360-border-hover: rgba(0, 210, 255, 0.45);
  --c360-border-focus: #00d2ff;

  --c360-text: #f1f5f9;
  --c360-text-primary: #f1f5f9;
  --c360-text-subtle: #cbd5e1;
  --c360-text-secondary: #cbd5e1;
  --c360-text-muted: #94a3b8;
  --c360-placeholder: #8194ad;

  --c360-primary: #00d2ff;
  --c360-primary-2: #3a86ff;
  --c360-primary-hover: #38bdf8;
  --c360-primary-rgb: 0, 210, 255;
  --c360-secondary: #3a86ff;
  --c360-secondary-rgb: 58, 134, 255;
  
  --c360-purple: #8338ec;
  --c360-emerald: #06d6a0;
  --c360-success: #06d6a0;
  --c360-amber: #ffd166;
  --c360-warning: #ffd166;
  --c360-rose: #ef476f;
  --c360-danger: #ef476f;

  --c360-radius-sm: 6px;
  --c360-radius-md: 12px;
  --c360-radius-lg: 18px;
  --c360-radius-pill: 9999px;

  --c360-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.35);
  --c360-shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --c360-shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.65);
  --c360-glow: 0 0 24px rgba(0, 210, 255, 0.22);
  --c360-glow-secondary: 0 0 24px rgba(58, 134, 255, 0.25);

  --c360-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --c360-font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Menlo, Consolas, monospace;

  --c360-transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Light Theme - Clean high-contrast surfaces and accessible text */
[data-theme="light"],
[data-bs-theme="light"] {
  --c360-bg: #f8fafc;
  --c360-bg-alt: #f1f5f9;
  --c360-surface: #ffffff;
  --c360-surface-2: #f1f5f9;
  --c360-surface-elevated: #f8fafc;
  --c360-surface-glass: rgba(255, 255, 255, 0.95);

  --c360-border: #cbd5e1;
  --c360-border-hover: rgba(2, 132, 199, 0.5);
  --c360-border-focus: #0284c7;

  --c360-text: #0f172a;
  --c360-text-primary: #0f172a;
  --c360-text-subtle: #334155;
  --c360-text-secondary: #334155;
  --c360-text-muted: #64748b;
  --c360-placeholder: #64748b;

  --c360-primary: #0284c7;
  --c360-primary-2: #2563eb;
  --c360-primary-hover: #0369a1;
  --c360-primary-rgb: 2, 132, 199;
  --c360-secondary: #2563eb;
  --c360-secondary-rgb: 37, 99, 235;

  --c360-emerald: #059669;
  --c360-success: #059669;
  --c360-amber: #d97706;
  --c360-warning: #d97706;
  --c360-rose: #dc2626;
  --c360-danger: #dc2626;

  --c360-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --c360-shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --c360-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --c360-glow: 0 0 20px rgba(2, 132, 199, 0.15);
}

/* Universal Box Sizing & Fluid Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Base Body Styling */
html, body {
  background-color: var(--c360-bg);
  color: var(--c360-text-primary);
  font-family: var(--c360-font-sans);
  line-height: 1.6;
  scroll-behavior: auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0;
}

main {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  color: var(--c360-text-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--c360-primary);
  text-decoration: none;
  transition: var(--c360-transition);
}
a:hover {
  color: var(--c360-primary-hover);
}

/* Technical Accent Utilities */
.text-gradient {
  background: linear-gradient(135deg, var(--c360-primary) 0%, var(--c360-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.text-gradient-purple {
  background: linear-gradient(135deg, #a06cd5 0%, var(--c360-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.font-mono {
  font-family: var(--c360-font-mono);
}

/* Navbar */
.navbar-c360 {
  background-color: var(--c360-surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--c360-border);
  padding: 0.85rem 0;
  position: sticky;
  top: 0;
  z-index: 1030;
  transition: var(--c360-transition);
}
.navbar-c360 .navbar-brand {
  display: inline-flex;
  align-items: center;
}
.navbar-c360 .nav-link {
  color: var(--c360-text-secondary);
  font-size: 0.93rem;
  font-weight: 500;
  padding: 0.45rem 0.85rem !important;
  border-radius: var(--c360-radius-sm);
  transition: var(--c360-transition);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
}
.navbar-c360 .nav-link:hover {
  color: var(--c360-primary);
  background-color: rgba(var(--c360-primary-rgb), 0.08);
  border-color: rgba(var(--c360-primary-rgb), 0.25);
}
.navbar-c360 .nav-link.active {
  color: #00d2ff !important;
  background-color: rgba(0, 210, 255, 0.16) !important;
  border: 1px solid rgba(0, 210, 255, 0.5) !important;
  font-weight: 700 !important;
  box-shadow: 0 0 14px rgba(0, 210, 255, 0.25);
}
[data-theme="light"] .navbar-c360 .nav-link:hover {
  color: #0284c7;
  background-color: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.3);
}
[data-theme="light"] .navbar-c360 .nav-link.active {
  color: #0284c7 !important;
  background-color: rgba(2, 132, 199, 0.12) !important;
  border: 1px solid rgba(2, 132, 199, 0.55) !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 10px rgba(2, 132, 199, 0.2);
}
.navbar-c360 .navbar-toggler {
  border: 1px solid var(--c360-border);
  color: var(--c360-text-primary);
  padding: 0.4rem 0.65rem;
}
.navbar-c360 .navbar-toggler:focus {
  box-shadow: 0 0 0 2px var(--c360-primary);
}

/* Glassmorphism Cards: Content-Driven Natural Flow */
.card-tech {
  background-color: var(--c360-surface);
  border: 1px solid var(--c360-border);
  border-radius: var(--c360-radius-md);
  padding: 1.5rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card-tech:hover {
  border-color: var(--c360-border-hover);
  transform: translateY(-4px);
  box-shadow: var(--c360-glow);
}
.card-tech-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.card-tech-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--c360-radius-sm);
  background: rgba(var(--c360-primary-rgb), 0.12);
  color: var(--c360-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* Buttons */
.btn-c360-primary {
  background: linear-gradient(135deg, var(--c360-primary) 0%, var(--c360-secondary) 100%);
  color: #0b0f19;
  font-weight: 600;
  border: none;
  border-radius: var(--c360-radius-sm);
  padding: 0.65rem 1.4rem;
  box-shadow: 0 4px 14px rgba(var(--c360-primary-rgb), 0.35);
  transition: var(--c360-transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-c360-primary:hover {
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(var(--c360-primary-rgb), 0.5);
}
.btn-c360-secondary {
  background-color: var(--c360-surface-elevated);
  color: var(--c360-text-primary);
  border: 1px solid var(--c360-border);
  border-radius: var(--c360-radius-sm);
  padding: 0.65rem 1.4rem;
  font-weight: 500;
  transition: var(--c360-transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-c360-secondary:hover {
  background-color: var(--c360-surface);
  border-color: var(--c360-primary);
  color: var(--c360-primary);
  transform: translateY(-2px);
}
.btn-c360-outline {
  background: transparent;
  color: var(--c360-text-primary);
  border: 1px solid var(--c360-border);
  border-radius: var(--c360-radius-sm);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  transition: var(--c360-transition);
}
.btn-c360-outline:hover {
  border-color: var(--c360-primary);
  color: var(--c360-primary);
  background: rgba(var(--c360-primary-rgb), 0.08);
}

/* Badges */
.badge-tech {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--c360-radius-pill);
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.badge-tech-cyan {
  background: rgba(0, 210, 255, 0.12);
  color: #00d2ff;
  border: 1px solid rgba(0, 210, 255, 0.3);
}
.badge-tech-purple {
  background: rgba(131, 56, 236, 0.15);
  color: #c084fc;
  border: 1px solid rgba(131, 56, 236, 0.35);
}
.badge-tech-emerald {
  background: rgba(6, 214, 160, 0.12);
  color: #06d6a0;
  border: 1px solid rgba(6, 214, 160, 0.3);
}
.badge-tech-amber {
  background: rgba(255, 209, 102, 0.12);
  color: #ffd166;
  border: 1px solid rgba(255, 209, 102, 0.3);
}

/* Hero Section */
.hero-section {
  padding: 4.5rem 0 3.5rem 0;
  position: relative;
  overflow: hidden;
  background: radial-gradient(circle at 80% 20%, rgba(58, 134, 255, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 20% 80%, rgba(0, 210, 255, 0.06) 0%, transparent 50%);
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 210, 255, 0.08);
  border: 1px solid rgba(0, 210, 255, 0.25);
  color: var(--c360-primary);
  padding: 0.4rem 1rem;
  border-radius: var(--c360-radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
}
.hero-title {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.25rem;
}
.hero-lead {
  font-size: 1.15rem;
  color: var(--c360-text-secondary);
  margin-bottom: 2rem;
  max-width: 580px;
}
.hero-visual-wrapper {
  position: relative;
  text-align: center;
}
.hero-visual-wrapper img,
.hero-visual-wrapper svg {
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 15px 35px rgba(0, 0, 0, 0.4));
  animation: subtleFloat 6s ease-in-out infinite alternate;
}

@keyframes subtleFloat {
  0% { transform: translateY(0px) rotate(0deg); }
  100% { transform: translateY(-8px) rotate(0.5deg); }
}

/* Section Header */
.section-header {
  margin-bottom: 2.75rem;
}
.section-subtitle {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--c360-primary);
  margin-bottom: 0.5rem;
  display: inline-block;
}
.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 800;
}
.section-desc {
  color: var(--c360-text-secondary);
  max-width: 650px;
  font-size: 1.05rem;
}

/* Learning Levels Grid */
.level-card {
  border-left: 4px solid var(--c360-primary);
}
.level-card.level-beginner { border-left-color: var(--c360-emerald); }
.level-card.level-intermediate { border-left-color: var(--c360-primary); }
.level-card.level-advanced { border-left-color: var(--c360-amber); }

.level-checklist {
  list-style: none;
  padding-left: 0;
  margin-top: 1rem;
}
.level-checklist li {
  font-size: 0.9rem;
  color: var(--c360-text-secondary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.level-checklist li i {
  color: var(--c360-primary);
  margin-top: 0.2rem;
  flex-shrink: 0;
}

/* Creator Section */
.creator-box {
  background: linear-gradient(135deg, var(--c360-surface) 0%, var(--c360-surface-elevated) 100%);
  border: 1px solid var(--c360-border);
  border-radius: var(--c360-radius-lg);
  padding: 2.5rem;
  box-shadow: var(--c360-shadow-md);
}
.creator-avatar-wrap {
  width: 140px;
  height: 140px;
  margin: 0 auto 1.5rem auto;
}
.creator-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid var(--c360-primary);
  box-shadow: var(--c360-glow);
}

/* Footer: Natural Document Flow Sticky Placement */
.footer-c360 {
  background-color: var(--c360-bg-alt);
  border-top: 1px solid var(--c360-border);
  padding: 3.5rem 0 2rem 0;
  margin-top: auto;
  font-size: 0.92rem;
  width: 100%;
  position: relative;
  z-index: 10;
}
.footer-c360 h6 {
  color: var(--c360-text-primary);
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1.25rem;
}
.footer-c360 ul {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}
.footer-c360 ul li {
  margin-bottom: 0.65rem;
}
.footer-c360 p {
  color: var(--c360-text-subtle);
}
.footer-c360 ul li a {
  color: var(--c360-text-subtle);
  transition: var(--c360-transition);
}
.footer-c360 ul li a:hover {
  color: var(--c360-primary);
  padding-left: 4px;
}
.footer-bottom {
  border-top: 1px solid var(--c360-border);
  padding-top: 2rem;
  margin-top: 3rem;
  color: var(--c360-text-muted);
  font-size: 0.85rem;
}
.footer-bottom span {
  color: var(--c360-text-subtle);
}

/* ====================================================================
   Universal Form Controls, Placeholders, Autofill & Labels
   ==================================================================== */

/* Global Input / Textarea / Select Styling */
input,
textarea,
select,
.form-control,
.form-select,
.form-control-tech {
  background-color: var(--c360-surface-2) !important;
  border: 1px solid var(--c360-border) !important;
  color: var(--c360-text) !important;
  border-radius: var(--c360-radius-sm);
  padding: 0.65rem 0.95rem;
  font-size: 0.92rem;
  caret-color: var(--c360-primary);
  transition: var(--c360-transition);
}

/* Explicit Placeholder Styling Across All Engines */
::placeholder {
  color: var(--c360-placeholder) !important;
  opacity: 1 !important;
}

::-webkit-input-placeholder {
  color: var(--c360-placeholder) !important;
  opacity: 1 !important;
}

:-ms-input-placeholder {
  color: var(--c360-placeholder) !important;
  opacity: 1 !important;
}

::-moz-placeholder {
  color: var(--c360-placeholder) !important;
  opacity: 1 !important;
}

:-moz-placeholder {
  color: var(--c360-placeholder) !important;
  opacity: 1 !important;
}

/* Focused Form Controls */
input:focus,
textarea:focus,
select:focus,
.form-control:focus,
.form-select:focus,
.form-control-tech:focus {
  background-color: var(--c360-surface-2) !important;
  border-color: var(--c360-primary) !important;
  color: var(--c360-text) !important;
  box-shadow: 0 0 0 3px rgba(var(--c360-primary-rgb), 0.28) !important;
  outline: none;
}

/* Disabled Form Controls */
input:disabled,
textarea:disabled,
select:disabled,
.form-control:disabled,
.form-select:disabled {
  background-color: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: var(--c360-text-muted) !important;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Dark Theme Autofill Override - Prevents browser from turning text black/unreadable */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--c360-text) !important;
  -webkit-box-shadow: 0 0 0px 1000px var(--c360-surface-2) inset !important;
  box-shadow: 0 0 0px 1000px var(--c360-surface-2) inset !important;
  caret-color: var(--c360-primary) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* Select & Option Elements */
select option,
.form-select option {
  background-color: var(--c360-surface);
  color: var(--c360-text);
  padding: 8px 12px;
}

/* Form Labels & Helper Text */
label,
.form-label,
.form-floating-tech label {
  color: var(--c360-text-subtle) !important;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.form-text,
.form-text-muted {
  color: var(--c360-text-muted) !important;
  font-size: 0.78rem;
  margin-top: 0.3rem;
}

/* Custom Checkbox & Radio */
.form-check-input {
  background-color: var(--c360-surface-2);
  border: 1px solid var(--c360-border);
}

.form-check-input:checked {
  background-color: var(--c360-primary);
  border-color: var(--c360-primary);
}

.form-check-label {
  color: var(--c360-text-subtle);
}

/* Modals */
.modal-content,
.modal-content-tech {
  background-color: var(--c360-surface);
  border: 1px solid var(--c360-border);
  border-radius: var(--c360-radius-md);
  color: var(--c360-text);
  box-shadow: var(--c360-shadow-lg);
}

.modal-header,
.modal-header-tech {
  border-bottom: 1px solid var(--c360-border);
  padding: 1.15rem 1.4rem;
}

.modal-footer {
  border-top: 1px solid var(--c360-border);
}

/* Dropdown Menus */
.dropdown-menu {
  background-color: var(--c360-surface);
  border: 1px solid var(--c360-border);
  border-radius: var(--c360-radius-sm);
  color: var(--c360-text);
  box-shadow: var(--c360-shadow-lg);
}

.dropdown-item {
  color: var(--c360-text-subtle);
  transition: var(--c360-transition);
}

.dropdown-item:hover,
.dropdown-item:focus {
  background-color: var(--c360-surface-2);
  color: var(--c360-primary);
}

.dropdown-divider {
  border-color: var(--c360-border);
}

/* Tables */
.table,
.table-tech {
  --bs-table-color: var(--c360-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--c360-border);
  width: 100%;
  color: var(--c360-text-subtle);
  vertical-align: middle;
}

.table th,
.table-tech th {
  color: var(--c360-text);
  font-weight: 600;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid var(--c360-border);
  background-color: rgba(255, 255, 255, 0.02);
}

.table td,
.table-tech td {
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid var(--c360-border);
  color: var(--c360-text-subtle);
}

.table tr:hover td,
.table-tech tr:hover td {
  background-color: rgba(255, 255, 255, 0.035);
  color: var(--c360-text);
}

/* Global Text Utility Readability Overrides */
.text-muted {
  color: var(--c360-text-muted) !important;
}

.text-secondary {
  color: var(--c360-text-subtle) !important;
}

/* Floating LUNA Trigger with Safe-Area Insets */
.luna-fab {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  right: max(24px, env(safe-area-inset-right, 24px));
  z-index: 1040;
  background: linear-gradient(135deg, #8338ec 0%, #3a86ff 100%);
  color: #ffffff;
  border: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  box-shadow: 0 8px 24px rgba(131, 56, 236, 0.4);
  cursor: pointer;
  transition: var(--c360-transition);
}
.luna-fab:hover {
  transform: scale(1.08) rotate(5deg);
  box-shadow: 0 12px 28px rgba(131, 56, 236, 0.6);
  color: #fff;
}
@media (max-width: 576px) {
  .luna-fab {
    width: 46px;
    height: 46px;
    font-size: 1.2rem;
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    right: max(16px, env(safe-area-inset-right, 16px));
  }
}

/* Code Playground Styles */
.code-window {
  background-color: #0d1117;
  border: 1px solid var(--c360-border);
  border-radius: var(--c360-radius-md);
  overflow: hidden;
  box-shadow: var(--c360-shadow-md);
}
.code-window-header {
  background-color: #161b22;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.code-dots {
  display: flex;
  gap: 6px;
}
.code-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.code-dot-red { background-color: #ff5f56; }
.code-dot-yellow { background-color: #ffbd2e; }
.code-dot-green { background-color: #27c93f; }
.code-editor-textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: #7ee787;
  font-family: var(--c360-font-mono);
  font-size: 0.88rem;
  padding: 1rem;
  resize: vertical;
  min-height: 220px;
  outline: none;
}
.terminal-output {
  background-color: #06090e;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.85rem 1rem;
  font-family: var(--c360-font-mono);
  font-size: 0.82rem;
  color: #00d2ff;
  max-height: 160px;
  overflow-y: auto;
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .hero-section {
    padding: 3rem 0;
    text-align: center;
  }
  .hero-lead {
    margin: 0 auto 2rem auto;
  }
  .hero-visual-wrapper {
    margin-top: 2.5rem;
  }
}

/* ====================================================================
   Cloud 360 - Arduino IDE & Advanced Code Editor Workspace
   ==================================================================== */
.arduino-workspace-toolbar {
  background: #0d1322;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.arduino-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e6edf3;
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: var(--c360-font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
}
.arduino-tool-btn:hover {
  background: rgba(0, 210, 255, 0.15);
  border-color: #00d2ff;
  color: #fff;
}
.arduino-tool-btn.btn-verify {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}
.arduino-tool-btn.btn-verify:hover {
  background: rgba(16, 185, 129, 0.3);
  color: #fff;
}
.arduino-tool-btn.btn-upload {
  background: rgba(0, 210, 255, 0.15);
  border-color: rgba(0, 210, 255, 0.4);
  color: #00d2ff;
}
.arduino-tool-btn.btn-upload:hover {
  background: rgba(0, 210, 255, 0.3);
  color: #fff;
}

/* Multi-file tabs */
.editor-tab-bar {
  background: #080d1a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: thin;
}
.editor-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  font-size: 0.78rem;
  font-family: var(--c360-font-mono);
  color: #8b949e;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  border-top: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
  transition: all 0.15s ease;
}
.editor-tab:hover {
  color: #e6edf3;
  background: rgba(255, 255, 255, 0.03);
}
.editor-tab.active {
  color: #58a6ff;
  background: #0e1626;
  border-top-color: #00d2ff;
}
.editor-tab-close {
  color: #6e7681;
  font-size: 0.75rem;
  margin-left: 0.2rem;
  border-radius: 50%;
  padding: 0 3px;
  line-height: 1;
}
.editor-tab-close:hover {
  color: #ff7b72;
  background: rgba(255, 123, 114, 0.15);
}
.editor-add-tab-btn {
  padding: 0.35rem 0.6rem;
  color: #8b949e;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 0.85rem;
}
.editor-add-tab-btn:hover {
  color: #00d2ff;
}

/* Editor Container & Line Numbers */
.code-editor-wrapper {
  position: relative;
  display: flex;
  background: #080d18;
  height: 420px;
  overflow: hidden;
}
.line-numbers-gutter {
  width: 52px;
  background: #070a12;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: #484f58;
  font-family: var(--c360-font-mono);
  font-size: 0.84rem;
  line-height: 1.5rem;
  padding: 0.75rem 0.4rem;
  text-align: right;
  user-select: none;
  overflow: hidden;
}
.code-editor-textarea {
  flex: 1;
  width: calc(100% - 52px);
  background: transparent;
  border: none;
  color: #e6edf3;
  font-family: var(--c360-font-mono);
  font-size: 0.84rem;
  line-height: 1.5rem;
  padding: 0.75rem 0.85rem;
  resize: none;
  height: 100%;
  outline: none;
  white-space: pre;
  tab-size: 4;
  overflow: auto;
}

/* Search and Replace bar */
.editor-search-bar {
  position: absolute;
  top: 8px;
  right: 16px;
  z-index: 20;
  background: #111827;
  border: 1px solid rgba(0, 210, 255, 0.3);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-width: 440px;
}
.editor-search-bar.d-none {
  display: none !important;
}

/* Virtual Serial Monitor */
.serial-monitor-header {
  background: #090e1a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.4rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.serial-monitor-output {
  background: #04060a;
  color: #58a6ff;
  font-family: var(--c360-font-mono);
  font-size: 0.82rem;
  line-height: 1.45rem;
  padding: 0.75rem 1rem;
  height: 220px;
  overflow-y: auto;
}
.serial-monitor-input-bar {
  background: #090e1a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.4rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.connection-dot.connected {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
}
.connection-dot.disconnected {
  background-color: #6e7681;
}

/* ====================================================================
 * RESPONSIVE POLISH (PHASES 3, 19, 20)
 * ==================================================================== */

/* Single-Line Desktop Navigation */
@media (min-width: 992px) {
  .navbar-nav .nav-link {
    white-space: nowrap;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
  }
}

@media (min-width: 992px) and (max-width: 1200px) {
  .navbar-nav .nav-link {
    font-size: 0.85rem;
    padding-left: 0.45rem !important;
    padding-right: 0.45rem !important;
  }
}

/* Mobile Offcanvas Drawer */
#c360MobileOffcanvas {
  background-color: var(--c360-bg) !important;
  border-left: 1px solid var(--c360-border) !important;
}

#c360MobileOffcanvas .nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: var(--c360-radius-sm);
  padding: 0.65rem 1rem;
  color: var(--c360-text-secondary);
  border-left: 3px solid transparent;
  transition: var(--c360-transition);
}

#c360MobileOffcanvas .nav-link:hover {
  background: var(--c360-surface);
  color: var(--c360-primary);
  border-left-color: rgba(var(--c360-primary-rgb), 0.4);
}

#c360MobileOffcanvas .nav-link.active {
  background: rgba(var(--c360-primary-rgb), 0.15) !important;
  color: var(--c360-primary) !important;
  border-left: 3px solid var(--c360-primary) !important;
  font-weight: 700 !important;
}

[data-theme="light"] #c360MobileOffcanvas .nav-link.active {
  background: rgba(2, 132, 199, 0.12) !important;
  color: #0284c7 !important;
  border-left: 3px solid #0284c7 !important;
}

/* LUNA Modal Responsiveness & Viewport Protection */
#lunaModal .modal-content {
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#lunaChatMessages {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 240px;
  max-height: 52vh;
}
@media (max-width: 576px) {
  #lunaModal .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100vw - 1rem);
  }
  #lunaModal .modal-content {
    max-height: calc(100vh - 1rem);
  }
  #lunaChatMessages {
    max-height: calc(100vh - 220px) !important;
  }
}

/* Universal Overflow & Layout Safeguards */
img, svg, video, canvas, audio, iframe {
  max-width: 100%;
  height: auto;
}
pre, code {
  max-width: 100%;
}
pre {
  overflow-x: auto;
  word-break: normal;
  white-space: pre;
}
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Dynamic Section Heights: Prevent fixed height blowout */
.card-tech-empty-state {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
}

/* Dual Logo Dark/Light Theme Switching */
.c360-logo-light { display: none !important; }
.c360-logo-dark { display: inline-block !important; }

[data-theme="light"] .c360-logo-light,
[data-bs-theme="light"] .c360-logo-light {
  display: inline-block !important;
}
[data-theme="light"] .c360-logo-dark,
[data-bs-theme="light"] .c360-logo-dark {
  display: none !important;
}
[data-theme="light"] img[src*="logo.svg"]:not(.c360-logo-dark),
[data-bs-theme="light"] img[src*="logo.svg"]:not(.c360-logo-dark) {
  filter: drop-shadow(0 0 1px rgba(15, 23, 42, 0.9));
}

/* Navbar Brand Logo Sizing */
.c360-navbar-brand-logo {
  width: 135px;
  height: auto;
  max-height: 32px;
  object-fit: contain;
  vertical-align: middle;
}
@media (max-width: 767.98px) {
  .c360-navbar-brand-logo {
    width: 115px;
    max-height: 28px;
  }
}

/* Brand Name Typography */
.c360-brand-name {
  font-family: var(--c360-font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
  display: inline-block;
  vertical-align: middle;
}
[data-theme="light"] .c360-brand-name,
[data-bs-theme="light"] .c360-brand-name {
  color: #0f172a !important;
}
[data-theme="light"] .c360-brand-name .text-info,
[data-bs-theme="light"] .c360-brand-name .text-info {
  color: #0284c7 !important;
}

/* Progressive Card Collection Hidden Class */
.c360-card-hidden {
  display: none !important;
}

/* Light Theme High-Contrast Content Overrides */
[data-theme="light"] .text-light,
[data-bs-theme="light"] .text-light,
[data-theme="light"] .text-white,
[data-bs-theme="light"] .text-white {
  color: var(--c360-text-primary) !important;
}
[data-theme="light"] .text-secondary,
[data-bs-theme="light"] .text-secondary {
  color: var(--c360-text-secondary) !important;
}
[data-theme="light"] .text-muted,
[data-bs-theme="light"] .text-muted {
  color: var(--c360-text-muted) !important;
}
[data-theme="light"] .text-info,
[data-bs-theme="light"] .text-info {
  color: #0284c7 !important;
}
[data-theme="light"] .text-success,
[data-bs-theme="light"] .text-success {
  color: #16a34a !important;
}
[data-theme="light"] .text-warning,
[data-bs-theme="light"] .text-warning {
  color: #d97706 !important;
}
[data-theme="light"] .text-danger,
[data-bs-theme="light"] .text-danger {
  color: #dc2626 !important;
}
[data-theme="light"] .bg-dark,
[data-bs-theme="light"] .bg-dark {
  background-color: var(--c360-surface-2) !important;
  color: var(--c360-text-primary) !important;
}
[data-theme="light"] .bg-black,
[data-bs-theme="light"] .bg-black {
  background-color: var(--c360-surface-2) !important;
  color: var(--c360-text-primary) !important;
}

/* Cards & Elevated Containers in Light Theme */
[data-theme="light"] .card,
[data-bs-theme="light"] .card,
[data-theme="light"] .card-tech,
[data-bs-theme="light"] .card-tech {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .card-tech:hover,
[data-bs-theme="light"] .card-tech:hover {
  border-color: #0284c7 !important;
  box-shadow: 0 6px 20px rgba(2, 132, 199, 0.15) !important;
}
[data-theme="light"] [style*="rgba(17, 24, 43"],
[data-bs-theme="light"] [style*="rgba(17, 24, 43"] {
  background: var(--c360-surface) !important;
  border-color: var(--c360-border) !important;
}

/* Badges in Light Theme */
[data-theme="light"] .badge-tech-cyan,
[data-bs-theme="light"] .badge-tech-cyan {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #bae6fd !important;
}
[data-theme="light"] .badge-tech-purple,
[data-bs-theme="light"] .badge-tech-purple {
  background: #f3e8ff !important;
  color: #7e22ce !important;
  border: 1px solid #e9d5ff !important;
}
[data-theme="light"] .badge-tech-emerald,
[data-bs-theme="light"] .badge-tech-emerald {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #bbf7d0 !important;
}
[data-theme="light"] .badge-tech-amber,
[data-bs-theme="light"] .badge-tech-amber {
  background: #fef3c7 !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
}

/* Tables in Light Theme */
[data-theme="light"] .table,
[data-bs-theme="light"] .table,
[data-theme="light"] .table-tech,
[data-bs-theme="light"] .table-tech {
  --bs-table-bg: #ffffff;
  --bs-table-color: #0f172a;
  --bs-table-border-color: #e2e8f0;
  color: #0f172a !important;
}
[data-theme="light"] .table-dark,
[data-bs-theme="light"] .table-dark {
  --bs-table-bg: transparent;
  --bs-table-color: #0f172a;
  color: #0f172a !important;
}
[data-theme="light"] .table th,
[data-bs-theme="light"] .table th,
[data-theme="light"] .table-tech th,
[data-bs-theme="light"] .table-tech th {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-bottom-color: #cbd5e1 !important;
}
[data-theme="light"] .table td,
[data-bs-theme="light"] .table td,
[data-theme="light"] .table-tech td,
[data-bs-theme="light"] .table-tech td {
  color: #1e293b !important;
  border-bottom-color: #f1f5f9 !important;
}

/* Modals in Light Theme */
[data-theme="light"] .modal-content-tech,
[data-bs-theme="light"] .modal-content-tech {
  background-color: #ffffff !important;
  border-color: var(--c360-border) !important;
  color: var(--c360-text-primary) !important;
}
[data-theme="light"] .modal-header-tech,
[data-bs-theme="light"] .modal-header-tech {
  background-color: #f1f5f9 !important;
  border-bottom-color: var(--c360-border) !important;
}
[data-theme="light"] .btn-close-white,
[data-bs-theme="light"] .btn-close-white {
  filter: none !important;
}

/* Forms in Light Theme */
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select,
[data-theme="light"] .form-control,
[data-theme="light"] .form-select,
[data-theme="light"] .form-control-tech,
[data-bs-theme="light"] input,
[data-bs-theme="light"] textarea,
[data-bs-theme="light"] select,
[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select,
[data-bs-theme="light"] .form-control-tech {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}
[data-theme="light"] input:focus,
[data-theme="light"] textarea:focus,
[data-theme="light"] select:focus,
[data-theme="light"] .form-control:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-control-tech:focus,
[data-bs-theme="light"] input:focus,
[data-bs-theme="light"] textarea:focus,
[data-bs-theme="light"] select:focus,
[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus,
[data-bs-theme="light"] .form-control-tech:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25) !important;
}
[data-theme="light"] input:-webkit-autofill,
[data-bs-theme="light"] input:-webkit-autofill {
  -webkit-text-fill-color: #0f172a !important;
  -webkit-box-shadow: 0 0 0px 1000px #ffffff inset !important;
  box-shadow: 0 0 0px 1000px #ffffff inset !important;
}

/* LUNA Chat Bubbles in Light Theme */
[data-theme="light"] #lunaChatMessages .justify-content-start > div,
[data-bs-theme="light"] #lunaChatMessages .justify-content-start > div {
  background-color: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}
[data-theme="light"] #lunaChatMessages .justify-content-end > div,
[data-bs-theme="light"] #lunaChatMessages .justify-content-end > div {
  background: #0284c7 !important;
  color: #ffffff !important;
}
[data-theme="light"] .luna-msg-body,
[data-bs-theme="light"] .luna-msg-body {
  color: #1e293b !important;
}

/* ====================================================================
 * CODING LAB & VIRTUAL IDE — LIGHT MODE HIGH-CONTRAST READABILITY
 * Strictly scoped to Coding Lab editor elements under light theme
 * ==================================================================== */

/* Editor Container & Line Numbers Gutter */
[data-theme="light"] .code-editor-wrapper,
[data-bs-theme="light"] .code-editor-wrapper {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}
[data-theme="light"] .line-numbers-gutter,
[data-bs-theme="light"] .line-numbers-gutter {
  background: #f8fafc !important;
  border-right: 1px solid #e2e8f0 !important;
  color: #475569 !important;
}

/* Code Editor Textarea Content, Caret, Selection, & Placeholder */
[data-theme="light"] .code-editor-textarea,
[data-bs-theme="light"] .code-editor-textarea {
  background-color: #ffffff !important;
  color: #0f172a !important;
  caret-color: #0284c7 !important;
}
[data-theme="light"] .code-editor-textarea::placeholder,
[data-bs-theme="light"] .code-editor-textarea::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
}
[data-theme="light"] .code-editor-textarea::selection,
[data-bs-theme="light"] .code-editor-textarea::selection {
  background: rgba(2, 132, 199, 0.25) !important;
  color: #0f172a !important;
}

/* Multi-File Tab Bar & Tabs */
[data-theme="light"] .editor-tab-bar,
[data-bs-theme="light"] .editor-tab-bar {
  background: #f1f5f9 !important;
  border-bottom: 1px solid #cbd5e1 !important;
}
[data-theme="light"] .editor-tab,
[data-bs-theme="light"] .editor-tab {
  color: #475569 !important;
  border-right: 1px solid #cbd5e1 !important;
}
[data-theme="light"] .editor-tab:hover,
[data-bs-theme="light"] .editor-tab:hover {
  color: #0f172a !important;
  background: #e2e8f0 !important;
}
[data-theme="light"] .editor-tab.active,
[data-bs-theme="light"] .editor-tab.active {
  color: #0284c7 !important;
  background: #ffffff !important;
  border-top-color: #0284c7 !important;
  font-weight: 600;
}
[data-theme="light"] .editor-tab-close,
[data-bs-theme="light"] .editor-tab-close {
  color: #64748b !important;
}
[data-theme="light"] .editor-tab-close:hover,
[data-bs-theme="light"] .editor-tab-close:hover {
  color: #dc2626 !important;
  background: rgba(220, 38, 38, 0.12) !important;
}
[data-theme="light"] .editor-add-tab-btn,
[data-bs-theme="light"] .editor-add-tab-btn {
  color: #475569 !important;
}
[data-theme="light"] .editor-add-tab-btn:hover,
[data-bs-theme="light"] .editor-add-tab-btn:hover {
  color: #0284c7 !important;
}

/* Arduino Workspace Toolbar & Tool Buttons */
[data-theme="light"] .arduino-workspace-toolbar,
[data-bs-theme="light"] .arduino-workspace-toolbar {
  background: #f8fafc !important;
  border-bottom: 1px solid #cbd5e1 !important;
}
[data-theme="light"] .arduino-tool-btn,
[data-bs-theme="light"] .arduino-tool-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}
[data-theme="light"] .arduino-tool-btn:hover,
[data-bs-theme="light"] .arduino-tool-btn:hover {
  background: rgba(2, 132, 199, 0.08) !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
}
[data-theme="light"] .arduino-tool-btn.active,
[data-bs-theme="light"] .arduino-tool-btn.active {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  color: #0284c7 !important;
  font-weight: 600;
}
[data-theme="light"] .arduino-tool-btn.btn-verify,
[data-bs-theme="light"] .arduino-tool-btn.btn-verify {
  background: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #047857 !important;
  font-weight: 600;
}
[data-theme="light"] .arduino-tool-btn.btn-verify:hover,
[data-bs-theme="light"] .arduino-tool-btn.btn-verify:hover {
  background: #d1fae5 !important;
  color: #065f46 !important;
}
[data-theme="light"] .arduino-tool-btn.btn-upload,
[data-bs-theme="light"] .arduino-tool-btn.btn-upload {
  background: #e0f2fe !important;
  border-color: #bae6fd !important;
  color: #0369a1 !important;
  font-weight: 600;
}
[data-theme="light"] .arduino-tool-btn.btn-upload:hover,
[data-bs-theme="light"] .arduino-tool-btn.btn-upload:hover {
  background: #bae6fd !important;
  color: #0284c7 !important;
}

/* Floating Search & Replace Bar */
[data-theme="light"] .editor-search-bar,
[data-bs-theme="light"] .editor-search-bar {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12) !important;
}
[data-theme="light"] #findMatchCount,
[data-bs-theme="light"] #findMatchCount {
  color: #475569 !important;
}

/* Serial Monitor Header & Input Bar in Light Mode */
[data-theme="light"] .serial-monitor-header,
[data-bs-theme="light"] .serial-monitor-header {
  background: #f8fafc !important;
  border-top: 1px solid #cbd5e1 !important;
  border-bottom: 1px solid #cbd5e1 !important;
}
[data-theme="light"] .serial-monitor-header #serialConnStatus,
[data-bs-theme="light"] .serial-monitor-header #serialConnStatus {
  color: #0f172a !important;
}
[data-theme="light"] .serial-monitor-header .text-secondary,
[data-bs-theme="light"] .serial-monitor-header .text-secondary {
  color: #475569 !important;
}
[data-theme="light"] .serial-monitor-input-bar,
[data-bs-theme="light"] .serial-monitor-input-bar {
  background: #f8fafc !important;
  border-top: 1px solid #cbd5e1 !important;
}

/* Serial Monitor Terminal High-Contrast Dark Canvas Protection (Consistent in Both Themes) */
.serial-monitor-output,
[data-theme="light"] .serial-monitor-output,
[data-bs-theme="light"] .serial-monitor-output {
  background: #070b14 !important;
  color: #38bdf8 !important;
}
.serial-monitor-output .text-light,
[data-theme="light"] .serial-monitor-output .text-light,
[data-bs-theme="light"] .serial-monitor-output .text-light,
.serial-monitor-output .text-white,
[data-theme="light"] .serial-monitor-output .text-white,
[data-bs-theme="light"] .serial-monitor-output .text-white {
  color: #f1f5f9 !important;
}
.serial-monitor-output .text-secondary,
[data-theme="light"] .serial-monitor-output .text-secondary,
[data-bs-theme="light"] .serial-monitor-output .text-secondary {
  color: #94a3b8 !important;
}
.serial-monitor-output .text-info,
[data-theme="light"] .serial-monitor-output .text-info,
[data-bs-theme="light"] .serial-monitor-output .text-info {
  color: #38bdf8 !important;
}
.serial-monitor-output .text-success,
[data-theme="light"] .serial-monitor-output .text-success,
[data-bs-theme="light"] .serial-monitor-output .text-success {
  color: #4ade80 !important;
}
.serial-monitor-output .text-warning,
[data-theme="light"] .serial-monitor-output .text-warning,
[data-bs-theme="light"] .serial-monitor-output .text-warning {
  color: #fbbf24 !important;
}

/* Stacking Context & Modal / Offcanvas Stability */
.modal {
  z-index: 1055 !important;
}
.modal-backdrop {
  z-index: 1050 !important;
}
.offcanvas {
  z-index: 1060 !important;
}
.offcanvas-backdrop {
  z-index: 1050 !important;
}
body.modal-open,
body.offcanvas-open {
  padding-right: 0 !important;
}

/* Mobile Offcanvas Link Clickability & Touch Reliability */
.offcanvas .nav-link,
.offcanvas a.btn,
.offcanvas a {
  cursor: pointer !important;
  pointer-events: auto !important;
  position: relative;
  z-index: 1;
}

/* Modal Viewport Accessibility & Sticky Action Footers */
.modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

.modal-dialog-scrollable .modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-dialog-scrollable .modal-footer {
  position: sticky;
  bottom: 0;
  background: var(--c360-surface);
  z-index: 5;
  border-top: 1px solid var(--c360-border);
}

[data-theme="light"] .modal-dialog-scrollable .modal-footer,
[data-bs-theme="light"] .modal-dialog-scrollable .modal-footer {
  background: #ffffff !important;
}

/* ====================================================================
   Cloud 360 - Unified Responsive Tables & Compact Admin Data Styling
   ==================================================================== */
.table-tech {
  width: 100%;
  color: var(--c360-text-primary);
  border-collapse: separate;
  border-spacing: 0;
}
.table-tech th {
  background: rgba(0, 0, 0, 0.25);
  color: var(--c360-text-secondary);
  font-family: var(--c360-font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--c360-border);
  white-space: nowrap;
}
.table-tech td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.85rem;
  vertical-align: middle;
  overflow-wrap: break-word;
  word-break: normal;
}
[data-theme="light"] .table-tech th,
[data-bs-theme="light"] .table-tech th {
  background: #f1f5f9;
  color: #475569;
  border-bottom: 1px solid #cbd5e1;
}
[data-theme="light"] .table-tech td,
[data-bs-theme="light"] .table-tech td {
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
}

/* Mobile Coding Lab & Responsive Sizing (320px - 768px) */
@media (max-width: 768px) {
  .modal-dialog {
    margin: 0.5rem;
    max-width: calc(100vw - 1rem);
  }
  .modal-dialog-scrollable .modal-content {
    max-height: calc(100vh - 1rem);
  }
  .code-editor-wrapper {
    height: 320px;
    max-width: 100%;
    overflow: hidden;
  }
  .serial-monitor-output {
    height: 180px;
    max-width: 100%;
    overflow-x: auto;
    word-break: break-all;
  }
  .line-numbers-gutter {
    width: 38px;
    font-size: 0.75rem;
    padding: 0.5rem 0.2rem;
    flex-shrink: 0;
  }
  .code-editor-textarea {
    width: calc(100% - 38px);
    font-size: 0.78rem;
    padding: 0.5rem 0.6rem;
    white-space: pre-wrap !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
  }
  .arduino-workspace-toolbar {
    padding: 0.4rem 0.6rem;
    gap: 0.35rem;
    flex-wrap: wrap !important;
  }
  .arduino-workspace-toolbar select,
  .arduino-workspace-toolbar .form-select {
    max-width: 100% !important;
  }
  .arduino-tool-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
  }
  .editor-search-bar {
    left: 8px;
    right: 8px;
    max-width: 100%;
  }
  .serial-monitor-input-bar .input-group {
    flex-wrap: wrap;
  }
  .serial-monitor-input-bar input,
  .serial-monitor-input-bar select,
  .serial-monitor-input-bar button {
    font-size: 0.75rem;
  }
  .table-tech th,
  .table-tech td {
    padding: 0.45rem 0.5rem;
    font-size: 0.78rem;
  }
}

/* ==========================================================================
   GLOBAL: Ban Decorative / Colourful Fill Bars & Progress Bar Visualizations
   ========================================================================== */
.progress,
.progress-bar,
[role="progressbar"],
.gauge-bar,
.fill-bar,
.distribution-bar {
  display: none !important;
}

/* ==========================================================================
   Modal Scrolling Architecture (Oversized Admin Modals & Mobile Access)
   ========================================================================== */
.modal-dialog-scrollable {
  max-height: calc(100vh - 2rem);
}
.modal-dialog-scrollable .modal-content {
  max-height: calc(100vh - 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-dialog-scrollable .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.modal-dialog-scrollable .modal-content > form > .modal-body,
.modal-dialog-scrollable .modal-body {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  flex: 1 1 auto;
}
.modal-dialog-scrollable .modal-header,
.modal-dialog-scrollable .modal-footer {
  flex-shrink: 0;
}

