/* Stylesheet for Alphainsit Academy Industrial Unit Converter */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Color Palette - Light Theme */
  --brand-primary: #0f2a7a;
  --brand-primary-rgb: 15, 42, 122;
  --brand-accent: #3b82f6;
  --brand-accent-hover: #2563eb;
  --brand-secondary: #475569;

  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #f1f5f9;
  --bg-interactive: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-light: #ffffff;

  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;

  /* Shadows & Radius */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-premium: 0 15px 35px -5px rgba(15, 42, 122, 0.08), 0 5px 15px -3px rgba(15, 42, 122, 0.04);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-full: 9999px;

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Courier, monospace;

  --focus-ring: rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] {
  /* Color Palette - Dark Theme */
  --brand-primary: #3b82f6;
  --brand-primary-rgb: 59, 130, 246;
  --brand-accent: #60a5fa;
  --brand-accent-hover: #93c5fd;
  --brand-secondary: #94a3b8;

  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --bg-interactive: #475569;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-light: #ffffff;

  --border-color: #334155;
  --border-focus: #60a5fa;

  --success: #34d399;
  --success-light: rgba(52, 211, 153, 0.1);

  --shadow-premium: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
  --focus-ring: rgba(96, 165, 250, 0.5);
}

/* Modificaciones de Marca para Modo Oscuro */
[data-theme="dark"] .logo-svg {
  filter: brightness(0) invert(1);
}

[data-theme="dark"] label {
  color: #94a3b8;
}

[data-theme="dark"] .select-wrapper select,
[data-theme="dark"] .input-number-wrapper input,
[data-theme="dark"] .search-input {
  color: #f8fafc;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow: hidden;
}

/* Header & Navbar */
header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0.4rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  height: 52px;
  box-sizing: border-box;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.logo-svg {
  height: 38px;
  width: auto;
  fill: currentColor;
  transition: transform 0.3s ease;
}

.logo-container:hover .logo-svg {
  transform: scale(1.03);
}

.logo-text {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.logo-text span.brand-ai {
  color: var(--brand-primary);
  transition: color 0.3s ease;
}

.logo-text span.brand-academy {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle-btn, .help-toggle-btn {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.45rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  height: 36px;
  width: 36px;
  box-sizing: border-box;
}

.theme-toggle-btn:hover, .help-toggle-btn:hover {
  background: var(--bg-interactive);
  border-color: var(--text-muted);
}

.theme-toggle-btn svg, .help-toggle-btn svg {
  width: 20px;
  height: 20px;
}

/* Main Layout */
main {
  max-width: 100%;
  width: 100%;
  padding: 0.75rem;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  box-sizing: border-box;
  overflow: hidden;
  height: calc(100vh - 52px);
}

.panel-left {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: visible;
  height: 100%;
}

.panel-center {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow: hidden;
  height: 100%;
}

.panel-right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: hidden;
  height: 100%;
}

@media (max-width: 1024px) {
  body {
    height: auto;
    overflow: auto;
  }
  main {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .panel-left, .panel-center, .panel-right {
    height: auto;
    overflow: visible;
  }
}

/* Banner/Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 0.5rem;
}

.hero-section h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.hero-section p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 400;
  max-width: 600px;
  margin: 0 auto;
}

/* Card General Styling */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-premium);
  padding: 0.85rem;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
  box-sizing: border-box;
}

/* Search Box / Predictive Input */
.search-wrapper {
  position: relative;
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  z-index: 10;
}

.search-input-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.4rem 1rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.search-input-container:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.search-icon {
  color: var(--text-muted);
  margin-right: 0.75rem;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  border: none;
  background: transparent;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 1rem;
  padding: 0.4rem 0;
  font-weight: 500;
}

.search-input::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

.clear-search-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 50%;
  display: none;
  /* Shown via JS when input has text */
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.clear-search-btn:hover {
  color: var(--text-primary);
  background: var(--bg-interactive);
}

/* Typeahead Suggestion Popover */
.suggestions-box {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 380px;
  overflow-y: auto;
  display: none;
  transition: var(--transition);
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

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

.suggestions-list {
  list-style: none;
}

.suggestion-item {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: var(--transition);
}

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

.suggestion-item:hover,
.suggestion-item.active {
  background-color: var(--bg-input);
}

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

.suggestion-icon {
  background-color: var(--bg-interactive);
  color: var(--brand-primary);
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  font-size: 0.85rem;
}

.suggestion-text {
  display: flex;
  flex-direction: column;
}

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

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

.suggestion-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}

.suggestion-badge {
  background: var(--bg-interactive);
  color: var(--text-secondary);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.suggestion-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--brand-accent);
  font-weight: 600;
  margin-top: 0.2rem;
}

.suggestions-empty {
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

.suggestions-empty svg {
  margin: 0 auto 0.75rem;
  color: var(--text-muted);
  display: block;
}

/* Quick Shortcuts */
.shortcuts-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  margin-top: 0.5rem;
}

.shortcut-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

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

/* Interactive Converter Grid */
.converter-container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
}

@media (max-width: 900px) {
  .converter-container {
    grid-template-columns: 1fr;
  }
}

/* Controls Form Panel */
.controls-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.select-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.select-wrapper select {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 2.25rem 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  cursor: pointer;
  appearance: none;
  transition: var(--transition);
}

.select-wrapper select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.select-arrow {
  position: absolute;
  right: 1rem;
  pointer-events: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

/* Value input styles */
.input-number-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-number-wrapper input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: var(--transition);
}

.input-number-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Direct/Swap Unit Controls */
.unit-select-grid {
  display: grid;
  grid-template-columns: 1fr 48px 1fr;
  align-items: flex-end;
  gap: 1rem;
}

@media (max-width: 480px) {
  .unit-select-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .swap-button-container {
    justify-content: center;
  }
}

.swap-button-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 32px;
  margin: -0.25rem 0;
}

.swap-units-btn {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.swap-units-btn:hover {
  background-color: var(--bg-interactive);
  border-color: var(--text-muted);
  transform: rotate(180deg);
}

/* Output Display Panel */
.result-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, rgba(var(--brand-primary-rgb), 0.03) 0%, rgba(var(--brand-primary-rgb), 0.08) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  justify-content: space-between;
  gap: 0.75rem;
  position: relative;
  overflow: hidden;
  flex: 1;
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(var(--brand-primary-rgb), 0.1);
  padding-bottom: 0.75rem;
}

.result-header-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.075em;
  color: var(--text-secondary);
}

.precision-control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.precision-select {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

/* High precision calculation displaying */
.result-display-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 0;
}

.result-value-container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.result-value {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  word-break: break-all;
}

.result-unit-symbol {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--brand-primary);
}

.result-input-mirror {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.result-input-mirror span.input-val {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Scientific notation switch */
.notation-toggle-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: -0.5rem;
}

.toggle-switch-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-interactive);
  transition: .3s;
  border-radius: var(--radius-full);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-light);
  transition: .3s;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

input:checked+.slider {
  background-color: var(--brand-accent);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Info and formulas panel */
.result-footer-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background-color: rgba(var(--brand-primary-rgb), 0.04);
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(var(--brand-primary-rgb), 0.08);
}

.info-formula {
  font-size: 0.85rem;
  color: var(--text-primary);
}

.info-formula-code {
  font-family: var(--font-mono);
  font-weight: 600;
  background-color: var(--bg-card);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  display: inline-block;
  margin-left: 0.25rem;
}

.info-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Copy to Clipboard widget */
.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--brand-accent);
  border: 1px solid var(--brand-accent);
  color: var(--text-light);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  width: 100%;
}

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

.copy-btn.success {
  background-color: var(--success);
  color: var(--text-light);
  border-color: var(--success);
}

/* History and Analytics Panel */
.secondary-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
}

.history-card {
  display: flex;
  flex-direction: column;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
  max-height: 240px;
  overflow: hidden;
  gap: 0.5rem;
}

.history-card.collapsed {
  max-height: 44px;
  padding-bottom: 0;
  padding-top: 0.6rem;
}

.history-card.collapsed .history-list {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.history-card:not(.collapsed) .history-list {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease 0.1s;
}

.history-card:not(.collapsed) .collapse-icon {
  transform: rotate(180deg);
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.clear-history-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.clear-history-btn:hover {
  color: #ef4444;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: var(--transition);
}

.history-item:hover {
  background-color: var(--bg-interactive);
  transform: translateX(4px);
}

.history-left {
  display: flex;
  flex-direction: column;
}

.history-expr {
  font-size: 0.9rem;
  font-weight: 600;
}

.history-expr span.val {
  font-family: var(--font-mono);
}

.history-discipline {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  margin-top: 0.15rem;
}

.history-right {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.history-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
}

/* Resources / Engineering Cards */
.info-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.info-links-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  list-style: none;
}

.info-link-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  transition: var(--transition);
}

.info-link-item a:hover {
  background-color: var(--bg-interactive);
  border-color: var(--text-muted);
  transform: translateY(-2px);
}

/* Footer Section */
footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  text-align: center;
  margin-top: auto;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

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

.footer-links a:hover {
  color: var(--brand-primary);
}

/* Lead Capture CRM integration overlay structure */
.lead-fence-banner {
  background: linear-gradient(90deg, #1e3a8a 0%, #0d276b 100%);
  color: var(--text-light);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-md);
}

.lead-fence-text {
  flex: 1;
  min-width: 280px;
}

.lead-fence-title {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.2rem;
}

.lead-fence-subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
}

.lead-fence-action-btn {
  background-color: #ffffff;
  color: #0d276b;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}

.lead-fence-action-btn:hover {
  background-color: #e2e8f0;
  transform: translateY(-1px);
}

.lead-fence-banner.compact {
  margin-top: 0;
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--brand-primary) 0%, var(--brand-primary-hover) 100%);
}

.lead-fence-banner.compact .lead-fence-text {
  min-width: auto;
  flex: 1;
}

.lead-fence-banner.compact .lead-fence-title {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0;
}

.lead-fence-banner.compact .lead-fence-action-btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  background-color: #ffffff;
  color: var(--brand-primary);
}

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

::-webkit-scrollbar-track {
  background: var(--bg-app);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Control de Logos Duales (Modo Claro / Oscuro) */
.brand-logo-dark {
  display: none;
}

.brand-logo-light {
  display: block;
}

/* Cuando el modo oscuro está activo: */
body.dark-mode .brand-logo-light,
body.dark-theme .brand-logo-light,
[data-theme="dark"] .brand-logo-light {
  display: none;
}

body.dark-mode .brand-logo-dark,
body.dark-theme .brand-logo-dark,
[data-theme="dark"] .brand-logo-dark {
  display: block;
}

/* Constantes de Referencia Component Styles */
.constants-card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
  max-height: 350px;
  overflow: hidden;
  flex-shrink: 0;
}

.constants-card.collapsed {
  max-height: 44px;
  padding-bottom: 0;
  padding-top: 0.6rem;
}

.collapsible-trigger {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  width: 100%;
  height: 32px;
}

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

.collapse-icon {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.constants-card:not(.collapsed) .collapse-icon {
  transform: rotate(180deg);
}

.constants-card.collapsed .constants-list {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.constants-card:not(.collapsed) .constants-list {
  opacity: 1;
  pointer-events: auto;
  transition: opacity 0.3s ease 0.1s;
}

.system-toggle-container {
  display: flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  padding: 2px;
  border-radius: var(--radius-sm);
}

.system-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.75rem;
  border-radius: calc(var(--radius-sm) - 2px);
  cursor: pointer;
  transition: var(--transition);
}

.system-toggle-btn.active {
  background-color: var(--brand-accent);
  color: var(--text-light);
}

.system-toggle-btn:hover:not(.active) {
  color: var(--text-primary);
  background-color: var(--bg-interactive);
}

.constants-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  max-height: 280px;
  padding-right: 4px;
}

.constant-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.constant-item:hover {
  border-color: var(--text-muted);
}

.constant-details {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.constant-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.constant-symbol {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-accent);
  background-color: rgba(var(--brand-primary-rgb), 0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

[data-theme="dark"] .constant-symbol {
  background-color: rgba(96, 165, 250, 0.15);
}

.constant-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.constant-val-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.constant-value {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.constant-unit {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.constant-copy-btn {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.constant-copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
  background-color: var(--bg-interactive);
}

.constant-copy-btn.success {
  background-color: var(--success);
  color: var(--text-light);
  border-color: var(--success);
}

/* Tooltips Dinámicos Contextuales */
.help-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  cursor: help;
  margin-left: 0.3rem;
  transition: var(--transition);
  vertical-align: middle;
}

.help-badge:hover {
  background-color: var(--brand-accent);
  color: #ffffff;
  border-color: var(--brand-accent);
}

[data-tooltip] {
  position: relative;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background-color: #1e293b;
  color: #f8fafc;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.3;
  width: 200px;
  white-space: normal;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  border: 1px solid #334155;
  z-index: 1000;
}

[data-tooltip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body:not(.dark-mode):not(.dark-theme):not([data-theme="dark"]) [data-tooltip]::before {
  background-color: #0f172a;
  border-color: #1e293b;
}

/* Modal Guía de Inicio Rápido (Onboarding) */
.onboarding-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.onboarding-overlay.active {
  opacity: 1;
}

.onboarding-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  max-width: 440px;
  width: 90%;
  box-shadow: var(--shadow-premium);
  transform: scale(0.95);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.onboarding-overlay.active .onboarding-card {
  transform: scale(1);
}

.onboarding-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
}

.onboarding-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.onboarding-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.onboarding-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--brand-accent);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.step-text strong {
  display: block;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.step-text p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.onboarding-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
}

.btn-onboarding {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-onboarding.primary {
  background-color: var(--brand-accent);
  border: 1px solid var(--brand-accent);
  color: #ffffff;
}

.btn-onboarding.primary:hover {
  background-color: var(--brand-accent-hover);
  border-color: var(--brand-accent-hover);
}

.btn-onboarding.secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-onboarding.secondary:hover {
  background-color: var(--bg-interactive);
  color: var(--text-primary);
  border-color: var(--text-muted);
}