/* Graph Theory Explorer Styles - Dark Theme */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;
    --node-unvisited: #3b82f6;
    --node-visiting: #f59e0b;
    --node-visited: #10b981;
    --node-path: #ef4444;
    --node-source: #8b5cf6;
    --node-target: #ec4899;
    --edge-default: #6b7280;
    --edge-highlight: #f59e0b;
    --edge-path: #ef4444;
    --edge-mst: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2rem;
    text-align: center;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    gap: 0;
}

/* Control Panel */
.control-panel {
    width: 320px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
}

.panel-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

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

.panel-section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group {
    margin-bottom: 0.75rem;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
}

.control-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.control-group input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Buttons */
.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

button {
    padding: 0.6rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

button:hover:not(:disabled) {
    background: var(--border-color);
    transform: translateY(-1px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

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

.preset-btn {
    font-size: 0.8rem;
    padding: 0.5rem;
}

.run-btn {
    flex: 1;
    background: var(--accent-blue);
    border-color: var(--accent-blue);
}

.run-btn:hover:not(:disabled) {
    background: #2563eb;
}

.step-btn {
    flex: 1;
    background: var(--accent-purple);
    border-color: var(--accent-purple);
}

.step-btn:hover:not(:disabled) {
    background: #7c3aed;
}

.reset-btn {
    flex: 1;
    background: var(--accent-red);
    border-color: var(--accent-red);
}

.reset-btn:hover:not(:disabled) {
    background: #dc2626;
}

.action-btn {
    width: 100%;
    background: var(--bg-tertiary);
}

/* Select */
select {
    width: 100%;
    padding: 0.6rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--accent-blue);
}

/* Statistics */
.stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.stat-value {
    color: var(--accent-cyan);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Algorithm Info */
.algorithm-info {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-height: 150px;
    overflow-y: auto;
}

.algorithm-info h4 {
    color: var(--accent-blue);
    margin-bottom: 0.5rem;
}

.algorithm-info p {
    color: var(--text-secondary);
}

/* Algorithm Output */
.algorithm-output {
    background: var(--bg-tertiary);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    max-height: 200px;
    overflow-y: auto;
}

.algorithm-output p {
    color: var(--text-muted);
}

.algorithm-output .output-line {
    padding: 0.25rem 0;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.algorithm-output .output-line:last-child {
    border-bottom: none;
}

.algorithm-output .step-number {
    color: var(--accent-blue);
    font-weight: 600;
    margin-right: 0.5rem;
}

.algorithm-output .highlight {
    color: var(--accent-yellow);
    font-weight: 600;
}

.algorithm-output .success {
    color: var(--accent-green);
}

.algorithm-output .error {
    color: var(--accent-red);
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
}

#graphCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

.canvas-controls {
    position: absolute;
    bottom: 60px;
    right: 20px;
    display: flex;
    gap: 0.5rem;
}

.canvas-controls button {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.canvas-info {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 1.5rem;
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.info-item strong {
    color: var(--text-secondary);
}

/* Footer */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Legend */
.legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

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

/* Responsive */
@media (max-width: 1024px) {
    .main-content {
        flex-direction: column;
    }

    .control-panel {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .canvas-container {
        min-height: 500px;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .button-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .canvas-info {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
}

/* Animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animating {
    animation: pulse 1s ease-in-out infinite;
}
