.avl-page .container {
  max-width: 1400px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 30px;
  position: relative;
  z-index: 1;
}

.main{
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.avl-page header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.avl-page header h1 {
  color: #667eea;
  font-size: 2.5em;
  margin-bottom: 10px;
}

.avl-page header p {
  color: #666;
  font-size: 1.1em;
}

.avl-page .controls {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
}

.avl-page .input-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.avl-page .input-group input {
  flex: 1;
  min-width: 150px;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.avl-page .input-group input:focus {
  outline: none;
  border-color: #667eea;
}

.avl-page button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  color: #fff;
}

.avl-page #insertBtn {
  background: #28a745;
}

.avl-page #insertBtn:hover:not(:disabled) {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(40, 167, 69, 0.3);
}

.avl-page #deleteBtn {
  background: #dc3545;
}

.avl-page #deleteBtn:hover:not(:disabled) {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.avl-page #findBtn {
  background: #17a2b8;
}

.avl-page #findBtn:hover:not(:disabled) {
  background: #138496;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(23, 162, 184, 0.3);
}

.avl-page #replaceBtn {
  background: #ffc107;
  color: #333;
}

.avl-page #replaceBtn:hover:not(:disabled) {
  background: #e0a800;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(255, 193, 7, 0.3);
}

.avl-page #undoBtn {
  background: #6c757d;
}

.avl-page #undoBtn:hover:not(:disabled) {
  background: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.avl-page #clearBtn {
  background: #343a40;
}

.avl-page #clearBtn:hover:not(:disabled) {
  background: #23272b;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(52, 58, 64, 0.3);
}

.avl-page button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.avl-page .replace-group {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  padding: 15px;
  background: #fff3cd;
  border-radius: 8px;
  border: 2px solid #ffc107;
}

.avl-page .replace-group input {
  flex: 1;
  padding: 10px;
  border: 2px solid #ffc107;
  border-radius: 8px;
  font-size: 16px;
}

.avl-page #confirmReplaceBtn {
  background: #28a745;
}

.avl-page #cancelReplaceBtn {
  background: #6c757d;
}

.avl-page .action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.avl-page .info-panel {
  display: flex;
  gap: 30px;
  padding: 15px;
  background: #e9ecef;
  border-radius: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.avl-page .info-item {
  display: flex;
  gap: 10px;
  font-size: 16px;
}

.avl-page .info-item span:first-child {
  font-weight: 600;
  color: #495057;
}

.avl-page .info-item span:last-child {
  color: #667eea;
  font-weight: 600;
}

.avl-page .canvas-container {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  min-height: 600px;
  overflow: auto;
}

.avl-page #treeCanvas {
  display: block;
  margin: 0 auto;
}

.avl-page .history-panel {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
  max-height: 220px;
  overflow-y: auto;
}

.avl-page .history-panel h3 {
  color: #667eea;
  margin-bottom: 15px;
}

.avl-page #historyList {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.avl-page .history-item {
  padding: 10px;
  background: #fff;
  border-radius: 6px;
  border-left: 4px solid #667eea;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s;
}

.avl-page .history-item.insert {
  border-left-color: #28a745;
}

.avl-page .history-item.delete {
  border-left-color: #dc3545;
}

.avl-page .history-item.find {
  border-left-color: #17a2b8;
}

.avl-page .history-item.replace {
  border-left-color: #ffc107;
}

.avl-page .history-item.rotation {
  border-left-color: #6f42c1;
}

.avl-page .history-item:hover {
  transform: translateX(5px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.avl-page .history-item.has-explanation::after {
  content: 'ℹ️';
  margin-left: 10px;
  font-size: 16px;
}

.avl-page .help-text {
  font-size: 12px;
  color: #666;
  font-weight: normal;
  font-style: italic;
}

.avl-page .modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

.avl-page .modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 700px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s;
}

.avl-page .close-modal {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 20px;
}

.avl-page .close-modal:hover {
  color: #000;
}

.avl-page #explanationTitle {
  color: #667eea;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
}

.avl-page #explanationContent {
  line-height: 1.8;
  color: #333;
}

.avl-page .explanation-section {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.avl-page .explanation-section h3 {
  color: #667eea;
  margin-bottom: 10px;
  font-size: 1.2em;
}

.avl-page .rotation-steps {
  background: #e7f3ff;
  padding: 15px;
  border-radius: 8px;
  margin-top: 10px;
}

.avl-page .rotation-steps strong {
  color: #0066cc;
}

.avl-page .tree-diagram {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin: 15px 0;
  border: 2px solid #e0e0e0;
}

.avl-page .full-tree-comparison {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 20px 0;
  padding: 20px;
  background: #f8f9fa;
  border-radius: 10px;
}

.avl-page .tree-section {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
}

.avl-page .tree-section-title {
  color: #667eea;
  margin-bottom: 15px;
  text-align: center;
  font-size: 1.1em;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
}

.avl-page .before-after-container {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 20px;
  margin: 20px 0;
  padding: 20px;
  background: #f0f7ff;
  border-radius: 10px;
  border: 2px solid #667eea;
  flex-wrap: wrap;
}

.avl-page .diagram-container {
  flex: 1;
  min-width: 250px;
  max-width: 400px;
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  border: 2px solid #ddd;
}

.avl-page .before-diagram {
  border-left: 4px solid #dc3545;
}

.avl-page .after-diagram {
  border-left: 4px solid #28a745;
}

.avl-page .rotation-arrow {
  font-size: 48px;
  color: #667eea;
  font-weight: bold;
  animation: pulse-arrow 2s infinite;
}

.avl-page .node {
  cursor: pointer;
  transition: all 0.3s;
}

.avl-page .node:hover {
  filter: brightness(1.1);
}

.avl-page .node.highlight {
  filter: brightness(1.3);
  stroke-width: 3;
}

.avl-page .node.found {
  animation: pulse 1s infinite;
}

@keyframes pulse-arrow {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.2);
    opacity: 0.8;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@media (max-width: 768px) {
  .avl-page {
    padding: 12px;
  }

  .avl-page .input-group,
  .avl-page .action-buttons {
    flex-direction: column;
  }

  .avl-page .rotation-arrow {
    transform: rotate(90deg);
  }
}

