/* Shape Understanding Section Styles */
#shape-understanding {
  padding: 0.5rem 0;
}

/* Shape Understanding Layout - 2/5, 1/5, 2/5 Proportions */
.shape-understanding-columns {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  min-height: 450px;
}

.understanding-code-column {
  flex: 2;
  max-width: 40%;
  display: flex;
  flex-direction: column;
}

.understanding-llm-column {
  flex: 1;
  max-width: 20%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.understanding-qa-column {
  flex: 2;
  max-width: 40%;
  display: flex;
  flex-direction: column;
}

.understanding-code-container {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.understanding-code-wrapper {
  position: relative;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #ddd;
  overflow: auto;
  flex: 1;
}

.understanding-code-wrapper .wrap-toggle-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  background: #f8f8f8;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  z-index: 20;
  transition: all 0.3s ease;
}

.understanding-code-wrapper .wrap-toggle-btn:hover {
  background: #e9ecef;
  border-color: #569cd6;
  color: #569cd6;
}

.understanding-code-wrapper .wrap-toggle-btn.active {
  background: #569cd6;
  color: white;
  border-color: #569cd6;
}

.understanding-code-display {
  background: #ffffff;
  padding: 15px;
  height: 350px;
  overflow-y: auto;
  overflow-x: auto;
  white-space: pre;
  position: relative;
  font-size: 11px;
  line-height: 1.4;
  min-width: max-content;
  box-sizing: border-box;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  transition: height 0.3s ease;
}

.understanding-code-display.wrap-mode {
  white-space: pre-wrap;
  word-break: break-all;
  min-width: auto;
  overflow-x: hidden;
}

/* Understanding code syntax highlighting */
.understanding-code-display .keyword { 
  color: #0066cc; 
  font-weight: bold; 
}

.understanding-code-display .string { 
  color: #669900; 
}

.understanding-code-display .number { 
  color: #ff6600; 
  display: inline !important;
  background-color: transparent !important;
  border-radius: 0 !important;
  font-size: inherit !important;
  height: auto !important;
  margin-right: 0 !important;
  min-width: auto !important;
  padding: 0 !important;
  text-align: inherit !important;
  vertical-align: baseline !important;
}

.understanding-code-display .comment { 
  color: #999999; 
  font-style: italic; 
}

.understanding-code-display .function { 
  color: #cc0066; 
  font-weight: bold; 
}

.understanding-code-display .code-line {
  display: block;
  margin-bottom: 0;
  white-space: pre;
  min-width: max-content;
}

.understanding-code-display.wrap-mode .code-line {
  white-space: pre-wrap;
  min-width: auto;
}

.understanding-code-display .code-line-number {
  color: #999999;
  margin-right: 10px;
  user-select: none;
  display: inline-block;
  width: 25px;
  text-align: right;
  flex-shrink: 0;
}

.understanding-code-display .code-word {
  opacity: 0;
  animation: wordPop 0.1s ease forwards;
  display: inline;
  white-space: pre;
}

.understanding-code-display.wrap-mode .code-word {
  white-space: pre-wrap;
}

@keyframes wordPop {
  0% {
    opacity: 0;
    transform: scale(0.95);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Highlighted code sections */
.understanding-code-display .code-line.highlight {
  background-color: rgba(86, 156, 214, 0.1);
  border-left: 3px solid #569cd6;
  padding-left: 10px;
  margin-left: -13px;
}

/* Code scrollbar styling */
.understanding-code-display::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.understanding-code-display::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.understanding-code-display::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.understanding-code-display::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

.understanding-code-display::-webkit-scrollbar-corner {
  background: #f1f1f1;
}

/* LLM Processing Indicator */
.llm-processing-container {
  background: white;
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: height 0.3s ease;
}

.llm-processing-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  text-align: center;
}

.processing-icon {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
}

.processing-dots {
  display: flex;
  gap: 4px;
  margin-top: 1rem;
  justify-content: center;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #569cd6;
  animation: dotBounce 1.4s ease-in-out infinite both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0s; }

@keyframes dotBounce {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* Q&A Container */
.understanding-qa-container {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.qa-wrapper {
  flex: 1;
  overflow-y: auto;
}

.question-set {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.qa-item {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.qa-item:hover {
  border-color: #569cd6;
  box-shadow: 0 2px 8px rgba(86, 156, 214, 0.1);
}

.question {
  display: flex;
  align-items: center;
  padding: 1rem;
  background: #f8f9fa;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.question:hover {
  background: #e9ecef;
}

.question-icon {
  font-size: 1.2rem;
  margin-right: 0.75rem;
  min-width: 24px;
}

.question-text {
  flex: 1;
  font-weight: 500;
  color: #333;
  font-size: 0.95rem;
}

.ask-button {
  background: #569cd6;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 0.75rem;
}

.ask-button:hover {
  background: #4a8bc2;
  transform: translateY(-1px);
}

.ask-button:active {
  transform: translateY(0);
}

.ask-button.processing {
  background: #ffa500;
  cursor: not-allowed;
}

.ask-button.answered {
  background: #28a745;
}

.answer {
  padding: 1rem;
  background: white;
  border-top: 1px solid #e5e5e5;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
  to {
    opacity: 1;
    max-height: 200px;
    padding-top: 1rem;
    padding-bottom: 1rem;
  }
}

.answer-content {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.answer-icon {
  font-size: 1.1rem;
  min-width: 20px;
  margin-top: 0.1rem;
}

.answer-text {
  flex: 1;
  color: #495057;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Active states */
.qa-item.active {
  border-color: #28a745;
  box-shadow: 0 3px 12px rgba(40, 167, 69, 0.2);
}

.qa-item.processing {
  border-color: #ffa500;
  box-shadow: 0 3px 12px rgba(255, 165, 0, 0.2);
}

/* Responsive adjustments */
@media screen and (max-width: 768px) {
  .shape-understanding-columns {
    flex-direction: column;
    gap: 2rem;
    min-height: auto;
  }
  
  .understanding-code-column,
  .understanding-llm-column,
  .understanding-qa-column {
    max-width: 100%;
    flex: none;
  }
  
  .understanding-code-container,
  .llm-processing-container,
  .understanding-qa-container {
    height: auto;
    min-height: 300px;
  }
  
  .llm-processing-container {
    margin: 1rem 0;
    padding: 1rem;
    min-height: 150px;
  }
  
  .understanding-qa-container {
    max-height: 400px;
  }
}

/* Scrollbar styling for Q&A container */
.qa-wrapper::-webkit-scrollbar {
  width: 6px;
}

.qa-wrapper::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.qa-wrapper::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.qa-wrapper::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
} 