body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #f5f5f5;
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  font-size: 28px;
}

.main-container {
  display: flex;
  gap: 20px;
  max-width: 1400px;
  margin: 0 auto;
  height: calc(100vh - 120px);
}

.left-column {
  flex: 2;
  background-color: white;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  max-width: 400px;
}

.right-column {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  max-width: 1200px;
}

#input-container {
  background-color: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 940px;
}

#input-container label {
  display: inline-block;
  margin: 5px 5px 5px 0;
  font-weight: bold;
  font-size: 14px;
}

#input-container input,
#input-container select {
  padding: 6px 8px;
  margin: 5px 0;
  font-size: 14px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#vertex-count {
  width: 60px !important;
  text-align: center;
}

.button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  align-items: center;
}

/* ===== СВЕТЛОСИНИ БУТОНИ ===== */
#input-container button {
  padding: 8px 12px;
  background-color: #6ab0f5 !important;
  color: white !important;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  min-width: 60px;
  transition: background-color 0.2s;
}

#input-container button:hover {
  background-color: #4a90e2 !important;
}

/* Специфични стилове за различните групи бутони */
#set-vertices {
  background-color: #6ab0f5 !important;
}

#draw-graph {
  background-color: #6ab0f5 !important;
}

#run-algorithm {
  background-color: #6ab0f5 !important;
}

#algorithm-select {
  flex-grow: 1;
  min-width: 140px;
}

/* Група бутони за експерименти и cytoscape */
.button-group:nth-of-type(2) button,
.button-group:nth-of-type(3) button {
  background-color: #7bb9f8 !important;
  min-width: auto;
  padding: 8px 12px;
  white-space: nowrap;
}

.button-group:nth-of-type(2) button:hover,
.button-group:nth-of-type(3) button:hover {
  background-color: #5a9ee0 !important;
}

/* Специфични имена за всеки бутон */
#run-experiments,
#export-results,
#show-charts,
#adaptive-btn,
#open-cytoscape-window,
#load-cytoscape-data {
  background-color: #7bb9f8 !important;
  color: white !important;
  border: none;
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

#run-experiments:hover,
#export-results:hover,
#show-charts:hover,
#adaptive-btn:hover,
#open-cytoscape-window:hover,
#load-cytoscape-data:hover {
  background-color: #5a9ee0 !important;
}

#edge-inputs {
  margin: 10px 0;
  padding: 10px;
  background-color: #f9f9f9;
  border-radius: 5px;
  max-height: 200px;
  overflow-y: auto;
}

#edge-inputs div {
  margin: 8px 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

#edge-inputs label {
  min-width: 140px;
  font-weight: normal;
  font-size: 13px;
}

#edge-inputs input {
  flex: 1;
  padding: 5px 8px;
  font-size: 13px;
  max-width: 80px;
}

#path-details-container {
  margin-top: 15px;
  padding: 10px;
  background-color: #e8f4f8;
  border-radius: 5px;
  font-size: 13px;
}

#path-details {
  font-family: monospace;
  padding: 8px;
  background-color: white;
  border-radius: 5px;
  font-size: 12px;
}

#graph-container {
  background-color: white;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-grow: 1;
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

#graph-container svg {
  max-width: 100%;
  max-height: 100%;
}

#parameters-container {
  height: 100%;
  overflow-y: auto;
}

.parameter-section {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

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

.parameter-section h3 {
  color: #2c3e50;
  margin-top: 0;
  font-size: 16px;
  margin-bottom: 8px;
}

.formula {
  font-family: monospace;
  background-color: #f8f9fa;
  padding: 6px 8px;
  border-radius: 5px;
  margin: 8px 0;
  font-size: 12px;
  color: #555;
  line-height: 1.3;
}

.current-value {
  background-color: #e8f5e9;
  padding: 10px;
  border-radius: 5px;
  margin: 8px 0;
  font-size: 13px;
}

.current-value label {
  font-weight: bold;
  color: #388e3c;
  display: inline-block;
  margin-right: 10px;
}

#cost-value,
#bandwidth-value,
#reliability-value {
  font-size: 18px;
  font-weight: bold;
  color: #2e7d32;
}

.parameter-controls {
  margin-top: 12px;
}

.parameter-controls label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #666;
}

.parameter-controls .parameter-input {
  display: flex;
  align-items: center;
  margin: 5px 0;
  gap: 5px;
}

.parameter-controls .parameter-input label {
  min-width: 50px;
  margin: 0;
  font-size: 12px;
}

.parameter-controls .parameter-input input {
  flex: 1;
  padding: 5px 8px;
  font-size: 13px;
  max-width: 100px;
}

.parameter-controls button {
  margin-top: 8px;
  padding: 8px;
  width: 100%;
  background-color: #6ab0f5 !important;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}

.parameter-controls button:hover {
  background-color: #4a90e2 !important;
}

#recalculate-all {
  width: 100%;
  padding: 10px;
  background-color: #6ab0f5 !important;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
}

#recalculate-all:hover {
  background-color: #4a90e2 !important;
}

/* Graph visualization styles */
.node {
  stroke: #333;
  stroke-width: 2px;
  fill: #555;
  cursor: pointer;
}

.node:hover {
  fill: #6ab0f5;
}

.link {
  stroke: #999;
  stroke-width: 2px;
}

.path {
  stroke: #e74c3c;
  stroke-width: 4px;
  stroke-linecap: round;
}

.link-label {
  font-size: 12px;
  fill: #333;
  font-weight: bold;
}

.label {
  font-size: 14px;
  fill: white;
  font-weight: bold;
  pointer-events: none;
}

.path-label {
  font-size: 13px;
  fill: #e74c3c;
  font-weight: bold;
}

/* ===== Yen секция ===== */
.yen-section {
    margin: 15px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f0fa 100%);
    border: 2px solid #3498db;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.yen-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.yen-section:hover::before {
    opacity: 1;
}

.yen-section:hover {
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.4);
    transform: translateY(-2px);
    border-color: #2980b9;
}

/* NEW badge */
.yen-section span[style*="border-radius: 12px"] {
    background: linear-gradient(135deg, #3498db, #2980b9) !important;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    font-weight: bold;
    letter-spacing: 0.5px;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 4px 10px rgba(52,152,219,0.5); }
    100% { transform: scale(1); }
}

/* Бутон за Yen */
#run-yen {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 25px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
}

#run-yen::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

#run-yen:hover::after {
    width: 100px;
    height: 100px;
}

#run-yen:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.5);
    background: linear-gradient(135deg, #2980b9, #1f6a9a);
}

#run-yen:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(52,152,219,0.3);
}

/* Полето за резултати */
#yen-results {
    background: #ffffff;
    border-radius: 8px;
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 12px;
    line-height: 1.6;
    border: 1px solid #d0e0f0;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.02);
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #3498db #f0f7ff;
}

#yen-results::-webkit-scrollbar {
    width: 8px;
}

#yen-results::-webkit-scrollbar-track {
    background: #f0f7ff;
    border-radius: 4px;
}

#yen-results::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 4px;
    border: 2px solid #f0f7ff;
}

#yen-results::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* Стилове за различните пътища */
.path-result-0 { 
    border-left: 4px solid #e74c3c; 
    padding-left: 8px;
    margin: 5px 0;
    background: rgba(231, 76, 60, 0.05);
}

.path-result-1 { 
    border-left: 4px solid #3498db; 
    padding-left: 8px;
    margin: 5px 0;
    background: rgba(52, 152, 219, 0.05);
}

.path-result-2 { 
    border-left: 4px solid #2ecc71; 
    padding-left: 8px;
    margin: 5px 0;
    background: rgba(46, 204, 113, 0.05);
}

.path-result-3 { 
    border-left: 4px solid #f39c12; 
    padding-left: 8px;
    margin: 5px 0;
    background: rgba(243, 156, 18, 0.05);
}

/* Инпут полетата в Yen секцията */
.yen-section input[type="text"],
.yen-section input[type="number"] {
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    transition: all 0.3s;
    background: white;
}

.yen-section input[type="text"]:focus,
.yen-section input[type="number"]:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}

.yen-section label {
    color: #2c3e50;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

/* Checkbox стил */
#yen-auto {
    width: 16px;
    height: 16px;
    accent-color: #3498db;
    cursor: pointer;
}

/* Path visualization */
.yen-path {
    pointer-events: all;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}

.yen-path:hover {
    stroke-width: 6 !important;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    cursor: pointer;
}

/* Легенда */
.yen-legend {
    background: rgba(255,255,255,0.9);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(5px);
}

.yen-legend text {
    font-family: 'Monaco', monospace;
    font-size: 11px;
    fill: #2c3e50;
    font-weight: 500;
}

/* Специални бутони */
.button-group.special-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 15px 0;
    width: 100%;
}

.button-group.special-buttons button {
    background: linear-gradient(135deg, #6c757d, #5a6268) !important;
    color: white !important;
    border: none !important;
    padding: 12px 5px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.button-group.special-buttons button:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #5a6268, #495057) !important;
}

/* Индикатор за зареждане */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.yen-loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .main-container {
    flex-direction: column;
    height: auto;
  }
  
  .left-column,
  .right-column {
    max-width: 100%;
  }
  
  #input-container {
    max-width: 100%;
  }
  
  .button-group.special-buttons {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
    .yen-section {
        padding: 12px;
    }
    
    .yen-section > div[style*="display: flex"] {
        flex-direction: column;
        gap: 12px;
    }
    
    .yen-section > div[style*="display: flex"] > div {
        width: 100%;
    }
    
    #run-yen {
        width: 100%;
    }
    
    .button-group.special-buttons {
        grid-template-columns: 1fr;
    }
}