/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #ff0000;
    --secondary: #282828;
    --accent: #f7b801;
    --success: #00d084;
    --danger: #ff4444;
    --text-primary: #0f0f0f;
    --text-secondary: #606060;
    --bg-primary: #ffffff;
    --bg-secondary: #f9f9f9;
    --border: #e5e5e5;
    --shadow: rgba(0, 0, 0, 0.1);
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px var(--shadow);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo i {
    font-size: 32px;
    color: var(--primary);
}

.logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Navigation */
.main-nav {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 65px;
    z-index: 99;
}

.nav-tabs {
    display: flex;
    list-style: none;
    gap: 8px;
    overflow-x: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Main Content */
.main-content {
    padding: 32px 0;
    min-height: calc(100vh - 200px);
}

.tab-content {
    display: none;
}

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

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px var(--shadow);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-info h3 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-info p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Section Card */
.section-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.section-header h2 {
    font-size: 24px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-header h2 i {
    color: var(--primary);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #cc0000;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #1a1a1a;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-primary);
    font-size: 14px;
    cursor: pointer;
    min-width: 150px;
}

/* Chart Container */
.chart-container {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px var(--shadow);
}

.chart-container h2 {
    margin-bottom: 24px;
    font-size: 20px;
}

/* Outliers List */
.outliers-list {
    display: grid;
    gap: 16px;
}

.outlier-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: grid;
    grid-template-columns: 180px 1fr auto;
    gap: 20px;
    transition: all 0.3s;
    align-items: start;
}

.outlier-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    border-color: var(--primary);
}

.outlier-thumbnail {
    width: 180px;
    height: 101px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
}

.outlier-info {
    flex: 1;
}

.outlier-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1.4;
}

.outlier-title:hover {
    color: var(--primary);
}

.outlier-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.outlier-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.outlier-stats {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.stat-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stat-badge.outlier {
    background: #fff3e0;
    color: #e65100;
}

.stat-badge.velocity {
    background: #e3f2fd;
    color: #1565c0;
}

.outlier-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.outlier-score {
    font-size: 28px;
    font-weight: 800;
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    background: linear-gradient(135deg, #f7b801, #ff6b35);
    color: white;
    min-width: 80px;
}

.outlier-score.mega {
    background: linear-gradient(135deg, #ff0000, #ff6b35);
}

/* Channels Container */
.channels-container {
    display: grid;
    gap: 32px;
}

.tier-group {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    background: var(--bg-secondary);
}

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

.tier-header h3 {
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tier-badge {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.tier-badge.tier-1 { background: #ffebee; color: #c62828; }
.tier-badge.tier-2 { background: #fff3e0; color: #e65100; }
.tier-badge.tier-3 { background: #e3f2fd; color: #1565c0; }
.tier-badge.tier-4 { background: #f3e5f5; color: #6a1b9a; }

.channel-grid {
    display: grid;
    gap: 16px;
}

.channel-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.channel-card:hover {
    box-shadow: 0 4px 12px var(--shadow);
    border-color: var(--primary);
}

.channel-info {
    flex: 1;
}

.channel-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.channel-name a {
    color: var(--text-primary);
    text-decoration: none;
}

.channel-name a:hover {
    color: var(--primary);
}

.channel-details {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.channel-description {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.channel-stats {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 12px;
}

.channel-actions {
    display: flex;
    gap: 8px;
}

.icon-btn {
    padding: 8px;
    border: none;
    border-radius: 6px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
}

/* Research Workflow */
.research-workflow {
    display: grid;
    gap: 24px;
}

.workflow-step {
    display: grid;
    grid-template-columns: 60px 1fr;
    gap: 20px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 2px solid var(--border);
}

.step-number {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff6b35);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
}

.step-content h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.step-content p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.research-content {
    margin-top: 16px;
}

.info-box {
    background: #e3f2fd;
    border-left: 4px solid #1565c0;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
}

.info-box h4 {
    margin-bottom: 12px;
    color: #1565c0;
}

.info-box ol {
    margin-left: 20px;
}

.info-box ol li {
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Alert Settings */
.alert-settings {
    display: grid;
    gap: 24px;
    max-width: 600px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.setting-group label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-group input[type="number"] {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    max-width: 100px;
}

.alert-log {
    margin-top: 40px;
}

.alert-log h3 {
    margin-bottom: 16px;
}

.alert-list {
    display: grid;
    gap: 12px;
}

.alert-item {
    padding: 16px;
    border-left: 4px solid var(--accent);
    background: #fffbf0;
    border-radius: 8px;
}

.alert-item.new {
    border-left-color: var(--primary);
    background: #ffebee;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 16px var(--shadow);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid #1565c0;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .outlier-card {
        grid-template-columns: 1fr;
    }
    
    .outlier-thumbnail {
        width: 100%;
        height: auto;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .workflow-step {
        grid-template-columns: 1fr;
    }
    
    .step-number {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 8px;
    color: var(--text-primary);
}
