:root {
  --primary-color: #333;
  --accent-color: #555;
  --text-color: #fff;
  --sidebar-bg: #f4f4f4;
  --button-bg: #e0e0e0;
  --button-active: #a0a0a0;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  /* Safari/Chrome */
  -moz-user-select: none;
  /* Firefox */
  -ms-user-select: none;
  /* Edge antiguo */
  -webkit-user-drag: none;
  user-drag: none;
}

img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

body,
html {
  overflow-x: hidden;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

#app-container {
  overflow-x: visible;
  display: flex;
  height: 100vh;
  width: 100%;
}

/* Sidebars */
.sidebar {
  background-color: var(--sidebar-bg);
  padding: clamp(5px, 0.8vh, 8px);
  display: flex;
  flex-direction: column;
  gap: clamp(4px, 0.6vh, 6px);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #bbb transparent;
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: #bbb;
  border-radius: 4px;
}

#right-sidebar {
  flex: 0 0 32%;
  max-width: 94%;
  min-width: 280px;
}

/* Section Styles (Replacement for Accordions) */
.config-section {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  margin-bottom: clamp(3px, 0.5vh, 5px);
  flex-shrink: 0;
}

.config-section h3 {
  padding: clamp(4px, 0.6vh, 6px) 8px;
  font-size: clamp(0.72rem, 0.95vh, 0.82rem);
  font-weight: 700;
  color: #333;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: #f9f9f9;
  border-bottom: 1px solid #eee;
  text-align: left;
}

.section-content {
  padding: clamp(3px, 0.5vh, 6px);
}

.sidebar-section {
  margin-bottom: clamp(2px, 0.4vh, 4px);
  border-bottom: 1px solid #ddd;
  padding-bottom: clamp(2px, 0.4vh, 4px);
}

.sidebar-section.no-border {
  border-bottom: none;
}

.sidebar-section:last-child {
  border-bottom: none;
}

h3 {
  margin: 0 0 15px;
  color: #333;
  text-align: center;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

h4 {
  margin: 10px 0;
  font-size: 0.85rem;
  color: #666;
  text-transform: uppercase;
  font-weight: 600;
  text-align: center;
}

/* Grid 1 Column */
.grid-1-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
}


/* Grid 3 Columns */
.grid-3-cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
}

@media (min-width: 740px) {
  .grid-3-cols {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Grid 5 Columns */
.grid-5-cols {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.grid-5-cols>* {
  flex: 0 0 calc(33% - 4px);
  max-width: calc(33% - 4px);
}

@media (min-width: 740px) {
  .grid-5-cols>* {
    flex: 0 0 calc(20% - 4px);
    max-width: calc(20% - 4px);
  }
}

/* Grid Legs (Vertical wrap, 3 columns) */
.grid-legs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(2px, 0.4vh, 4px);
  padding-bottom: 2px;
}

.grid-legs .leg-btn {
  width: 100%;
  padding: clamp(2px, 0.4vh, 5px) clamp(2px, 0.3vw, 4px);
  font-size: clamp(9.5px, 1vh, 12px);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: normal;
  line-height: 1.1;
  min-height: clamp(24px, 3vh, 32px);
}

/* Custom scrollbar for legs */
.grid-legs::-webkit-scrollbar {
  height: 4px;
}

.grid-legs::-webkit-scrollbar-track {
  background: #eee;
}

.grid-legs::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

/* Buttons */
button.model-btn,
button.collection-btn,
button.size-btn {
  padding: clamp(2px, 0.35vh, 4px);
  border: none;
  border-radius: 4px;
  background-color: var(--button-bg);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  width: 100%;
  min-height: clamp(26px, 3.5vh, 32px);
  box-sizing: border-box;
}

button.collection-btn,
button.size-btn {
  font-size: clamp(10px, 1.05vh, 12.5px);
  font-weight: 800;
  text-transform: uppercase;
  justify-content: center;
  padding: clamp(3px, 0.5vh, 6px) 6px;
  min-height: clamp(24px, 3.2vh, 32px);
}

button.model-btn img {
  width: 92%;
  height: clamp(30px, 4.2vh, 48px);
  border-radius: 4px;
  background-color: #EDEDED;
  margin: 1px auto;
  object-fit: contain;
  flex-shrink: 0;
  transition: height 0.2s ease;
}

@media (min-width: 740px) {
  button.model-btn img {
    height: clamp(30px, 4.2vh, 48px);
    border-radius: 3px;
  }
}

button.model-btn span {
  font-size: clamp(8.5px, 0.95vh, 10px);
  font-weight: 900;
  text-transform: uppercase;
  color: #222;
  transition: color 0.2s, font-size 0.2s;
  text-align: center;
  line-height: 1.15;
  word-break: normal;
  overflow-wrap: break-word;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2em;
  width: 100%;
  flex-grow: 1;
  padding: 0 2px;
  box-sizing: border-box;
}

@media (min-width: 740px) {
  button.model-btn span {
    font-size: clamp(8.5px, 0.95vh, 10px);
  }
}

button.model-btn.active span,
button.collection-btn.active,
button.size-btn.active {
  color: #fff;
  background-color: #333;
}

button.leg-btn,
.nav-btn,
.tab-btn,
.state-btn {
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  background-color: var(--button-bg);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  text-align: center;
  text-decoration: none;
  color: #444;
  display: block;
  width: 100%;
  font-weight: 600;
}

button:hover,
.nav-btn:hover,
.state-btn:hover {
  background-color: #d8d8d8;
}

button.active,
.nav-btn.active,
.state-btn.active {
  background-color: #333;
  color: white;
}

/* Color Grid */
.color-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(3px, 0.6vh, 6px);
}

.color-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: auto;
  min-width: clamp(24px, 3.6vh, 34px);
}

.color-btn {
  position: relative;
  width: clamp(24px, 3.6vh, 34px);
  height: clamp(24px, 3.6vh, 34px);
  border-radius: 50%;
  border: 1px solid #dcdcdc;
  background-color: transparent;
  cursor: pointer;
  transition:
    border-color 0.3s ease,
    box-shadow 0.3s ease,
    width 0.2s ease,
    height 0.2s ease;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.color-label {
  font-size: clamp(7.5px, 0.85vh, 9px);
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.1;
}

.color-btn:hover {
  border-color: #888;
}

.color-btn.active {
  border-color: #333;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.color-btn.active::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  /* Smaller checkmark */
  height: 18px;
  border: solid white;
  border-width: 0 3px 3px 0;
  transform: translate(-50%, -60%) rotate(45deg);
  filter: drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.6));
}

/* Main Content */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: #eee;
  min-width: 0;
}

#canvas-container {
  flex: 1;
  width: 100%;
  background: radial-gradient(circle at center, #E0E0E2 0%, #E0E0E2 50%, #d4d4d6 100%);
  touch-action: none;
}

#canvas-container canvas {
  touch-action: none;
}

/* Volver Sutil */
.volver-sutil {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1001;
  background: transparent;
  border: none;
  color: #333;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  padding: 10px;
  transition: opacity 0.3s ease;
}

.volver-sutil:hover {
  opacity: 0.7;
}

.dark-mode .volver-sutil {
  color: #fff;
}

@media (min-width: 740px) {
  .volver-sutil {
    font-size: 1.2rem;
    /* Adjusted from chairs' 1.8rem which felt too big for mesas */
    font-weight: 800;
  }
}

/* Bottom Controls (Abierto/Cerrado) */
#bottom-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 100;
}

.state-btn {
  min-width: 120px;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
}

@media (max-width: 739px) {
  .state-btn {
    min-width: 80px;
    padding: 8px 10px;
    font-size: 13px;
  }
}

/* Stock Container */
#stock-container {
  position: sticky;
  bottom: 0;
  background: var(--sidebar-bg);
  z-index: 5;
  padding: 4px 0;
  margin-top: auto;
  flex-shrink: 0;
}

#stock-container .nav-btn {
  width: 100%;
  padding: clamp(6px, 0.9vh, 9px) 10px;
  font-size: clamp(12px, 1.3vh, 14px);
}

/* Responsive */
@media (max-width: 900px) {
  #app-container {
    flex-direction: column;
    overflow-y: auto;
  }

  .sidebar {
    width: 100%;
    height: auto;
    padding: 10px;
    box-shadow: none;
    box-sizing: border-box;
  }

  #main-content {
    height: 50vh;
    min-height: 380px;
    flex: none;
    order: 1;
  }

  #right-sidebar {
    order: 2;
    border-left: none;
    border-top: 1px solid #ddd;
    flex: none;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  #app-container {
    background-color: #F4F4F4;
  }
}

/* Mobile tab-mode (< 900px) */
#mobile-tab-bar {
  display: none;
  /* hidden on desktop */
}

@media (max-width: 900px) {
  #mobile-tab-bar {
    display: flex;
    gap: 0.2rem;
    background: #1a1a1a;
    border-radius: 14px;
    padding: 5px;
    margin-bottom: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .mobile-tab {
    flex: 1;
    padding: 6px 6px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #888;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.25s ease;
  }

  .mobile-tab.active {
    background: #fff;
    color: #111;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .config-section h3 {
    display: none;
  }

  .config-section {
    border: none;
    box-shadow: none;
    background: transparent;
    display: none;
    margin-bottom: 0;
  }

  .config-section.mobile-active {
    display: block;
  }

  #right-sidebar {
    gap: 0;
    padding: 10px;
    overflow-y: auto;
    width: 100%;
    box-sizing: border-box;
  }

  #stock-container {
    margin-top: 12px;
    position: static;
    background: transparent;
  }
}

/* Loader */
#loader-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  display: none;
  pointer-events: none;
}

.loader {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #333;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Background Toggle Button */
.bg-toggle-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 1001;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background-color: white;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

@media (min-width: 740px) {
  .bg-toggle-btn {
    width: 44px;
    height: 44px;
  }
}

.bg-toggle-btn:hover {
  transform: scale(1.1);
  background-color: #f0f0f0;
}

.bg-toggle-btn svg {
  width: 24px;
  height: 24px;
}

/* Dark mode updates */
.dark-mode #canvas-container {
  background: #575866 !important;
}

.dark-mode .bg-toggle-btn {
  background-color: #333;
  color: #fff;
}

/* Rotation Hint */
.rotation-hint {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) scale(0.5);
  pointer-events: none;
  opacity: 0.8;
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (min-width: 740px) {
  .rotation-hint {
    bottom: 95px;
    transform: translateX(-50%);
  }
}

/* Stock Popup Styles */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  backdrop-filter: blur(5px);
}

.popup-container {
  background-color: #fff;
  width: 98%;
  max-width: 1400px;
  max-height: 95vh;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  animation: popupFadeIn 0.3s ease-out;
}

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

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

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  font-size: 30px;
  cursor: pointer;
  color: #333;
  z-index: 10;
}

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

.popup-left {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border-right: 1px solid #eee;
  background-color: #fbfbfb;
}

.popup-left img {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid #1a1a1a;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  background-color: #f0f0f0;
}

.popup-right {
  flex: 1;
  padding: 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

.popup-title {
  margin: 0;
  font-size: 1.8rem;
  color: #333;
}

.stock-item {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #eee;
}

.stock-label {
  font-weight: 600;
  color: #555;
}

.stock-value {
  color: #333;
}

.popup-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup-field label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #666;
}

.popup-field input {
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.stock-status {
  margin-top: 10px;
  padding: 15px;
  border-radius: 6px;
  display: none;
}

.stock-status.available {
  display: block;
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

.stock-status.unavailable {
  display: block;
  background-color: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
}

/* Hydra Toggle Styles */
.hydra-toggle-container {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #eee;
  animation: fadeIn 0.3s ease;
}

.hydra-btn-group {
  display: flex;
  gap: 10px;
}

.hydra-btn {
  flex: 1;
  padding: 10px;
  border: 1px solid #ddd;
  background: #f9f9f9;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 13px;
  transition: all 0.2s ease;
}

.hydra-btn:hover {
  background: #f0f0f0;
}

.hydra-btn.active {
  background: #333;
  color: #fff;
  border-color: #333;
}

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

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

/* Responsive popup rules */
@media (max-width: 900px) {
  .popup-container {
    max-height: 90vh;
    overflow-y: auto;
    width: 95%;
  }

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

  .popup-left {
    border-right: none;
    border-bottom: 1px solid #eee;
    padding: 15px;
  }

  .popup-left img {
    max-height: 350px;
  }

  .popup-right {
    padding: 20px;
    gap: 15px;
  }
}

/* Adaptación responsiva para dimensiones con altura de pantalla reducida (laptops y pantallas < 800px) */
@media (max-height: 800px) and (min-width: 901px) {
  .sidebar {
    padding: 5px;
    gap: 4px;
  }

  .config-section {
    margin-bottom: 3px;
  }

  .config-section h3 {
    padding: 3px 8px;
    font-size: 0.75rem;
  }

  .section-content {
    padding: 3px;
  }

  .grid-legs .leg-btn {
    padding: 2px 2px;
    font-size: 10px;
    min-height: 24px;
  }

  button.model-btn img {
    height: 32px;
  }

  button.model-btn span {
    font-size: 8.5px;
    min-height: 1.9em;
  }

  button.size-btn {
    min-height: 24px;
    padding: 2px 4px;
    font-size: 10px;
  }

  .color-btn {
    width: 26px;
    height: 26px;
  }

  .color-label {
    font-size: 7.5px;
  }

  #stock-container .nav-btn {
    padding: 6px 8px;
    font-size: 12px;
  }
}

@media (max-height: 680px) and (min-width: 901px) {
  .sidebar {
    padding: 4px;
    gap: 3px;
  }

  .config-section {
    margin-bottom: 2px;
  }

  .config-section h3 {
    padding: 2px 6px;
    font-size: 0.7rem;
  }

  .section-content {
    padding: 2px;
  }

  .grid-legs .leg-btn {
    padding: 1px 2px;
    font-size: 9px;
    min-height: 22px;
  }

  button.model-btn img {
    height: 26px;
  }

  button.model-btn span {
    font-size: 8px;
    min-height: 1.8em;
  }

  button.size-btn {
    min-height: 22px;
    padding: 2px 4px;
    font-size: 9.5px;
  }

  .color-btn {
    width: 22px;
    height: 22px;
  }

  .color-label {
    font-size: 7px;
  }
}

/* Selector de Idioma (Evita quedar cortado en la parte inferior) */
.lang-selector {
  position: fixed !important;
  bottom: 16px !important;
  top: auto !important;
  right: calc(32% + 15px) !important;
  z-index: 9999 !important;
  font-family: 'Inter', sans-serif;
}

@media (max-width: 900px) {
  .lang-selector {
    right: 15px !important;
    bottom: 15px !important;
    top: auto !important;
  }
}

#download-pdf-btn {
  width: 80%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Stock Query Button & Result Box */
.stock-query-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: -10px;
  width: 100%;
}

#stock-result-container {
  width: 100%;
}

.stock-query-btn {
  background: #b3e8b6 !important;
  color: #1f3d24 !important;
  border: none;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  width: 80%;
  margin: 0 auto;
  box-sizing: border-box;
}

.stock-query-btn:hover {
  background: #9fe0a3 !important;
}

.stock-query-btn:active {
  transform: none;
}

.stock-query-btn.loading {
  pointer-events: none;
  opacity: 0.85;
  background: #a5dba9 !important;
}

.stock-btn-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(31, 61, 36, 0.25);
  border-top-color: #1f3d24;
  border-radius: 50%;
  animation: stockSpin 0.7s linear infinite;
  display: none;
}

.stock-query-btn.loading .stock-btn-spinner {
  display: inline-block;
}

@keyframes stockSpin {
  to {
    transform: rotate(360deg);
  }
}

/* Loading Card Indicator */
.stock-loading-card {
  margin-top: 10px;
  padding: 14px 18px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #334155;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: stockCardFadeIn 0.25s ease-out;
}

.stock-inline-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid #cbd5e1;
  border-top-color: #0f172a;
  border-radius: 50%;
  animation: stockSpin 0.75s linear infinite;
  flex-shrink: 0;
}

/* Stock Result Card */
.stock-result-card {
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 8px;
  animation: stockCardFadeIn 0.25s ease-out;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  text-align: left;
}

@keyframes stockCardFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

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

.stock-result-card.success-high {
  background: #ecfdf5;
  border: 1.5px solid #10b981;
  color: #065f46;
}

.stock-result-card.success-limited {
  background: #f0fdfa;
  border: 1.5px solid #0d9488;
  color: #134e4a;
}

.stock-result-card.warning-low {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  color: #92400e;
}

.stock-result-card.out-of-stock {
  background: #fff1f2;
  border: 1.5px solid #f43f5e;
  color: #881337;
}

.stock-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.stock-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stock-result-card.success-high .stock-badge {
  background: #10b981;
  color: #ffffff;
}

.stock-result-card.success-limited .stock-badge {
  background: #0d9488;
  color: #ffffff;
}

.stock-result-card.warning-low .stock-badge {
  background: #f59e0b;
  color: #ffffff;
}

.stock-result-card.out-of-stock .stock-badge {
  background: #f43f5e;
  color: #ffffff;
}

.stock-result-body {
  font-size: 0.88rem;
  line-height: 1.45;
  font-weight: 500;
}

.stock-phone-link {
  font-weight: 700;
  text-decoration: underline;
  color: inherit;
}

.stock-components-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.76rem;
  opacity: 0.9;
}

.stock-component-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stock-comp-name {
  font-weight: 500;
}

.stock-comp-qty {
  font-weight: 700;
}

/* Stock Retry Button in Error State */
.stock-retry-wrapper {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.stock-retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  color: #be123c;
  background: #ffffff;
  border: 1.5px solid #f43f5e;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(244, 63, 94, 0.12);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  outline: none;
}

.stock-retry-btn:hover {
  background: #be123c;
  color: #ffffff;
  border-color: #be123c;
  box-shadow: 0 4px 12px rgba(190, 18, 60, 0.25);
  transform: translateY(-1px);
}

.stock-retry-btn:hover .stock-retry-icon {
  transform: rotate(180deg);
}

.stock-retry-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(190, 18, 60, 0.15);
}

.stock-retry-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.35);
}

.stock-retry-icon {
  transition: transform 0.4s ease;
  flex-shrink: 0;
}

.stock-retry-btn.is-retrying {
  pointer-events: none;
  opacity: 0.85;
  background: #fff1f2;
}

.stock-retry-btn.is-retrying .stock-retry-icon {
  animation: stockSpin 0.7s linear infinite;
}

/* Mobile Responsive Adjustments for Stock Query */
@media (max-width: 768px) {

  #download-pdf-btn,
  .stock-query-btn {
    width: 92% !important;
    font-size: 14px;
    padding: 9px 8px;
  }

  .stock-query-actions {
    margin-top: -6px;
    width: 100%;
  }

  .stock-result-card {
    margin-top: 8px;
    padding: 12px 14px;
    border-radius: 6px;
    width: 100%;
    box-sizing: border-box;
  }

  .stock-result-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 6px;
  }

  .stock-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    line-height: 1.2;
  }

  .stock-result-body {
    font-size: 0.84rem;
    line-height: 1.42;
    word-break: break-word;
  }

  .stock-loading-card {
    margin-top: 8px;
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .stock-inline-spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
  }

  .stock-retry-wrapper {
    margin-top: 12px;
  }
}

@media (max-width: 480px) {

  #download-pdf-btn,
  .stock-query-btn {
    width: 100% !important;
    font-size: 13.5px;
    padding: 9px 6px;
  }

  .stock-result-card {
    padding: 10px 12px;
  }

  .stock-result-body {
    font-size: 0.8rem;
    line-height: 1.38;
  }

  .stock-badge {
    font-size: 0.68rem;
    padding: 2px 6px;
  }

  .stock-retry-wrapper {
    width: 100%;
  }

  .stock-retry-btn {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}