/* Video RAG Bot Styles */

:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Tabs */
.main-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.main-tab-btn {
    background: none;
    border: none;
    padding: 15px 25px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.main-tab-btn:hover {
    color: var(--primary-color);
    background-color: rgba(37, 99, 235, 0.05);
}

.main-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.main-tab-content {
    display: none;
}

.main-tab-content.active {
    display: block;
}

/* Search Section */
.search-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.search-tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 4px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--card-bg);
    color: var(--primary-color);
    box-shadow: var(--shadow);
}

.video-filter {
    margin-bottom: 20px;
    text-align: center;
}

.video-filter label {
    font-weight: 500;
    color: var(--text-primary);
}

.video-filter select {
    margin-left: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.search-panel {
    display: none;
}

.search-panel.active {
    display: block;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    justify-content: center;
}

.time-input {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    width: 120px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.time-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto;
}

.search-btn:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.search-options {
    text-align: center;
    margin-top: 20px;
}

.search-options label {
    font-weight: 500;
    color: var(--text-primary);
}

.search-options select {
    margin-left: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
}

/* Download Section */
.download-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.download-section h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
}

.download-section p {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 25px;
}

.download-form {
    max-width: 600px;
    margin: 0 auto;
}

.download-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 20px;
}

.download-options label {
    font-weight: 500;
    color: var(--text-primary);
}

.download-options select {
    margin-left: 10px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
}

.download-status {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
}

.download-status h3 {
    text-align: center;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    width: 0%;
    transition: width 0.3s ease;
}

#status-message {
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Video Management */
.manage-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.manage-section h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 20px;
}

.refresh-btn {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto 25px;
}

.refresh-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

.video-list {
    display: grid;
    gap: 20px;
}

.video-card {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.video-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.video-title {
    color: var(--primary-color);
    font-size: 1.2rem;
    margin: 0;
    flex: 1;
    margin-right: 10px;
}

.delete-btn {
    background: var(--danger-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.delete-btn:hover {
    background: #dc2626;
}

.video-info p {
    margin: 5px 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.video-info strong {
    color: var(--text-primary);
}

.video-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.video-link {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.video-link:hover {
    background: var(--secondary-color);
}

.search-in-video-btn {
    background: var(--warning-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-in-video-btn:hover {
    background: #d97706;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    background: var(--card-bg);
    border-radius: 12px;
    margin-bottom: 30px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-left-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none;
}

/* Results */
.results-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.results-section h2 {
    color: var(--primary-color);
    text-align: center;
    margin-bottom: 25px;
}

.video-group {
    margin-bottom: 30px;
}

.video-group-title {
    color: var(--text-primary);
    font-size: 1.3rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.video-group-results {
    display: grid;
    gap: 20px;
}

.result-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.result-thumbnail {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.result-details {
    flex: 1;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.result-time {
    font-weight: 600;
    color: var(--primary-color);
}

.result-score {
    background: var(--success-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.result-video {
    color: var(--text-primary);
    font-weight: 500;
    margin: 8px 0;
}

.result-id {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 8px 0;
}

.watch-link {
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-block;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.watch-link:hover {
    background: var(--secondary-color);
}

/* Statistics */
.stats-section {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.stats-section h3 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
}

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 600;
}

/* Messages */
.no-results, .no-videos, .error {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.error {
    color: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .main-tabs {
        flex-direction: column;
        border-bottom: none;
    }
    
    .main-tab-btn {
        border-bottom: none;
        border-left: 3px solid transparent;
        text-align: left;
    }
    
    .main-tab-btn.active {
        border-left-color: var(--primary-color);
        border-bottom-color: transparent;
    }
    
    .search-tabs {
        flex-direction: column;
    }
    
    .time-inputs {
        flex-direction: column;
        gap: 10px;
    }
    
    .download-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .result-item {
        flex-direction: column;
    }
    
    .result-thumbnail {
        width: 100%;
        height: 200px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .video-actions {
        flex-direction: column;
    }
}