/* K-Clustering Algorithm Visualization Simulation - CSS */

.clustering-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    font-family: 'Courier New', monospace;
    background-color: #0a0a0a;
    color: #ffffff;
    border-radius: 8px;
}

/* ===== Control Panel ===== */
.control-panel {
    background-color: #111111;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.section-label {
    color: #00ffff;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    border-bottom: 1px solid #444444;
    padding-bottom: 10px;
}

.control-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.control-row:last-child {
    margin-bottom: 0;
}

.control-row label {
    color: #cccccc;
    font-size: 12px;
    min-width: 80px;
    text-align: right;
    white-space: nowrap;
}

.control-row input[type="range"] {
    flex: 1;
    min-width: 100px;
    max-width: 200px;
    height: 6px;
    background: #333333;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.control-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.control-row input[type="range"]::-webkit-slider-thumb:hover {
    background: #00ffff;
    box-shadow: 0 0 8px #00ffff;
    transform: scale(1.1);
}

.control-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #00ffff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.control-row span {
    color: #00ff00;
    font-size: 12px;
    min-width: 60px;
    text-align: left;
    font-family: 'Courier New', monospace;
    white-space: nowrap;
}

.control-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #00ff00;
}

.control-row select {
    background-color: #1a1a1a;
    color: #00ff00;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
    min-width: 140px;
}

.control-row select:hover {
    background-color: #222222;
    border-color: #666666;
}

.control-row select:focus {
    border-color: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.control-row select option {
    background-color: #1a1a1a;
    color: #00ff00;
    padding: 8px;
}

/* ===== Preset Select ===== */
.preset-select {
    background-color: #1a1a1a;
    color: #00ff00;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s;
}

.preset-select:hover {
    background-color: #222222;
    border-color: #666666;
}

.preset-select:focus {
    border-color: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

/* ===== Buttons ===== */
.control-row button {
    background-color: #002233;
    color: #00ffff;
    border: 1px solid #00ffff;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    transition: all 0.2s;
    white-space: nowrap;
}

.control-row button:hover {
    background-color: #003344;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

.control-row button:active {
    background-color: #00ffff;
    color: #002233;
}

/* ===== Spinbox ===== */
.spinbox-container {
    display: inline-flex;
    align-items: center;
}

.k-spinbox {
    width: 50px;
    padding: 5px 4px 5px 8px;
    background-color: #1a1a1a;
    border: 1px solid #666666;
    border-radius: 4px 0 0 4px;
    color: #00ff00;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    text-align: center;
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

.k-spinbox::-webkit-outer-spin-button,
.k-spinbox::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.k-spinbox:hover {
    border-color: #00ff00;
}

.k-spinbox:focus {
    outline: none;
    border-color: #00ff00;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.spin-buttons {
    display: flex;
    flex-direction: column;
}

.spin-btn {
    width: 20px;
    height: 14px;
    background-color: #1a1a1a;
    border: 1px solid #666666;
    border-left: none;
    color: #888888;
    font-size: 8px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    transition: all 0.15s ease;
}

.spin-btn.spin-up {
    border-radius: 0 4px 0 0;
    border-bottom: none;
}

.spin-btn.spin-down {
    border-radius: 0 0 4px 0;
}

.spin-btn:hover {
    color: #00ff00;
    background-color: #222222;
}

.spin-btn:active {
    background-color: #00ff00;
    color: #1a1a1a;
}

/* ===== Value Display ===== */
.value-display {
    color: #00ff00;
    font-size: 12px;
    min-width: 40px;
    font-family: 'Courier New', monospace;
}

/* ===== Algorithm Description ===== */
.algo-description {
    background-color: #111111;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 12px;
    margin-bottom: 15px;
}

.algo-description h4 {
    color: #00ffff;
    margin: 0 0 8px 0;
    font-size: 14px;
}

.algo-description p {
    color: #cccccc;
    margin: 0 0 8px 0;
    font-size: 12px;
    line-height: 1.4;
}

.algo-description .formula {
    color: #ffff00;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    text-align: center;
    padding: 5px;
    background-color: #1a1a1a;
    border-radius: 4px;
}

/* ===== Canvas Section ===== */
.canvas-section {
    margin-bottom: 15px;
}

.canvas-wrapper {
    position: relative;
    margin-bottom: 10px;
}

.canvas-label {
    color: #00ffff;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 4px;
    padding: 4px 8px;
    background-color: #1a1a1a;
    border-radius: 4px 4px 0 0;
    letter-spacing: 1px;
}

.canvas-label.data-label {
    color: #00ffff;
}

.canvas-section canvas {
    display: block;
    background-color: #0d0d0d;
    border: 1px solid #333333;
    border-radius: 0 4px 4px 4px;
}

/* ===== Legend ===== */
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px;
    background-color: #111111;
    border: 1px solid #333333;
    border-radius: 4px;
    margin-bottom: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #aaaaaa;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid transparent;
}

.legend-color.cluster0 {
    background-color: #FF5733;
}

.legend-color.cluster1 {
    background-color: #33FF57;
}

.legend-color.cluster2 {
    background-color: #3357FF;
}

.legend-color.cluster3 {
    background-color: #F333FF;
}

.legend-color.cluster4 {
    background-color: #FFFF33;
}

.legend-color.cluster5 {
    background-color: #33FFFF;
}

.legend-color.cluster6 {
    background-color: #FF33AA;
}

.legend-color.cluster7 {
    background-color: #AAFF33;
}

.legend-color.centroid {
    background-color: transparent;
    border: 2px solid #ffffff;
    position: relative;
}

.legend-color.centroid::before,
.legend-color.centroid::after {
    content: '';
    position: absolute;
    background-color: #ffffff;
}

.legend-color.centroid::before {
    width: 10px;
    height: 2px;
    top: 5px;
    left: 1px;
}

.legend-color.centroid::after {
    width: 2px;
    height: 10px;
    top: 1px;
    left: 5px;
}

/* ===== Info Panel ===== */
.info-panel {
    background-color: #111111;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 12px;
}

.info-panel h3 {
    color: #00ffff;
    font-size: 14px;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #333333;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    background-color: #1a1a1a;
    border-radius: 4px;
}

.info-label {
    color: #888888;
    font-size: 11px;
}

.info-value {
    color: #00ff00;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.info-value.running {
    color: #ffff00;
}

.info-value.converged {
    color: #00ff00;
}

/* ===== Equation Display ===== */
.equation-display {
    text-align: center;
    padding: 10px;
    background-color: #111111;
    border-radius: 4px;
    margin: 10px 0;
}

.equation-display .math {
    color: #ffff00;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* ===== Step Description Panel ===== */
.step-panel {
    background-color: #111111;
    border: 1px solid #444444;
    border-radius: 4px;
    padding: 12px;
    margin-top: 10px;
}

.step-panel h3 {
    color: #00ffff;
    font-size: 14px;
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid #333333;
}

.step-description {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    min-height: 80px;
}

.step-idle {
    color: #888888;
    text-align: center;
    padding: 20px;
}

.step-line {
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    background-color: #1a1a1a;
}

.step-line.outer-loop {
    color: #ffff00;
    background-color: #2a2a00;
    border-left: 3px solid #ffff00;
}

.step-line.inner-loop {
    color: #ffffff;
    margin-left: 20px;
    border-left: 3px solid #00ffff;
}

.step-line.inner-loop.current {
    background-color: #002a2a;
}

.step-line.inner-loop.best {
    color: #00ff00;
    background-color: #002a00;
    border-left: 3px solid #00ff00;
}

.step-line.result {
    color: #ff8800;
    background-color: #2a1a00;
    border-left: 3px solid #ff8800;
    margin-top: 8px;
}

.step-point {
    color: #ffff00;
    font-weight: bold;
}

.step-centroid {
    color: #00ffff;
    font-weight: bold;
}

.step-distance {
    color: #00ff00;
}

.step-best {
    color: #00ff00;
    font-weight: bold;
}

.step-cluster {
    font-weight: bold;
}
