/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background-color: white;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
    border-bottom: 3px solid #5a67d8;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Main content layout */
.main-content {
    display: flex;
    height: calc(100vh - 120px);
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: #f8f9fa;
    border-right: 2px solid #e9ecef;
    overflow-y: auto;
    padding: 20px;
}

/* Algorithm Selector with Dropdowns */
.algorithm-selector {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dropdown-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.dropdown-label {
    font-weight: 600;
    color: #2d3748;
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.dropdown-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background-color: white;
    font-size: 0.9rem;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%234299e1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.dropdown-select:hover {
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.dropdown-select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}

.dropdown-select:disabled {
    background-color: #f7fafc;
    color: #a0aec0;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

.dropdown-select:disabled:hover {
    border-color: #e2e8f0;
    box-shadow: none;
}

/* Algorithm List - direct continuation of dropdown */
.algorithm-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
}

/* Algorithm List Items */
.algorithm-item {
    display: flex;
    align-items: center;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    background-color: transparent;
    border-left: 3px solid transparent;
}

.algorithm-item:hover {
    background-color: #f8f9fa;
    border-left-color: #4299e1;
}

.algorithm-item.active {
    background-color: #f0f7ff;
    border-left-color: #2563eb;
}

.algorithm-thumbnail {
    width: 45px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 10px;
    border: 1px solid #d1d5db;
    flex-shrink: 0;
}

.algorithm-info-item {
    flex: 1;
}

.algorithm-name {
    font-weight: 600;
    color: #374151;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.algorithm-preview {
    font-size: 0.75rem;
    color: #6b7280;
    line-height: 1.3;
}

/* Scrollbar for algorithm list */
.algorithm-list::-webkit-scrollbar {
    width: 6px;
}

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

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

.algorithm-list::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Main content area */
.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.video-container {
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.video-placeholder {
    height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d3748 100%);
    color: #a0aec0;
    text-align: center;
}

.video-placeholder p {
    margin: 5px 0;
    font-size: 1.1rem;
}

#video-frame {
    width: 100%;
    height: 400px;
    border: none;
}

.algorithm-info {
    background-color: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

#algorithm-title {
    color: #2b6cb0;
    margin-bottom: 15px;
    font-size: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.algorithm-steps {
    font-size: 1.1rem;
    line-height: 1.8;
}

.algorithm-steps .steps-content {
    background-color: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #4299e1;
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #2d3748;
    margin-top: 10px;
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.sidebar::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

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

    .sidebar {
        width: 100%;
        height: auto;
        min-height: 300px;
        padding: 15px;
    }

    .dropdown-container {
        padding: 12px;
    }

    .algorithm-list {
        max-height: 400px;
        margin-top: 8px;
        padding-top: 8px;
    }

    .algorithm-item {
        padding: 5px 6px;
    }

    .algorithm-thumbnail {
        width: 40px;
        height: 40px;
    }

    .content {
        padding: 10px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    #video-frame {
        height: 250px;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}