/*
 * MHA Flow - Production CSS
 * Complete styling matching mha_ui_complete.py Streamlit design
 * Includes animations, gradients, cards, and professional UI elements
 */

/* ============================================= */
/* 1. FONTS & ANIMATIONS                        */
/* ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Keyframe animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

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

html {
    scroll-behavior: smooth;
}

body {
    animation: fadeIn 0.5s ease-in;
    background-color: #f8f9fa;
}

/* ============================================= */
/* 2. HEADER & BRANDING                         */
/* ============================================= */

.main-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    animation: fadeIn 0.8s ease-in;
    position: relative;
    overflow: hidden;
}

.main-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

.main-header h1 {
    color: #ffffff;
    margin: 0;
    font-size: 2.8rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.main-header p {
    color: #f0f0f0;
    margin: 0.5rem 0 0 0;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

.page-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 10px;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.page-header h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
}

.page-header p {
    margin: 0.5rem 0 0 0;
    font-size: 1rem;
    opacity: 0.95;
}

/* ============================================= */
/* 3. STATISTICS CARDS                          */
/* ============================================= */

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    animation: fadeIn 0.8s ease-in;
    position: relative;
    overflow: hidden;
    color: white;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.stat-card:hover::before {
    left: 100%;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.4);
}

.stat-card-icon {
    font-size: 2.8em;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.stat-card-value {
    font-size: 2.2em;
    font-weight: 700;
    color: white;
    margin: 0.5rem 0;
}

.stat-card-label {
    color: #f0f0f0;
    font-size: 0.95rem;
    font-weight: 500;
}

.metric-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 2rem;
    border-radius: 15px;
    color: white;
    text-align: center;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-number {
    font-size: 3rem;
    font-weight: 800;
    margin: 0;
}

.metric-label {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* ============================================= */
/* 4. INFO CARDS                                */
/* ============================================= */

.info-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    animation: slideIn 0.6s ease-out;
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    border-color: #667eea;
}

.info-card h4 {
    color: #333;
    margin-bottom: 1.2rem;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
    font-size: 1.3rem;
    font-weight: 600;
}

.info-card ol, .info-card ul {
    padding-left: 20px;
    color: #555;
    line-height: 1.8;
}

.info-card li {
    margin-bottom: 0.8rem;
    transition: color 0.2s;
}

.info-card li:hover {
    color: #667eea;
}

.step-box {
    display: flex;
    align-items: center;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.8rem;
    border-left: 3px solid #667eea;
    transition: background-color 0.3s;
}

.step-box:hover {
    background: rgba(102, 126, 234, 0.2);
}

.step-box-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: #667eea;
    margin-right: 1rem;
    min-width: 20px;
    text-align: center;
}

.step-box-text {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Colored info boxes */
.info-box {
    background: #e3f2fd;
    border-left: 5px solid #2196f3;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    color: #0c5460;
}

.success-box {
    background: #e8f5e9;
    border-left: 5px solid #4caf50;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    color: #155724;
}

.warning-box {
    background: #fff3e0;
    border-left: 5px solid #ff9800;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 1rem 0;
    color: #856404;
}

.disclaimer-box {
    background: #ffebee;
    border: 2px solid #f44336;
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
    color: #721c24;
}

/* Recent activity */
.recent-activity-item {
    font-size: 0.95rem;
    color: #666;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 5px;
    transition: all 0.2s;
}

.recent-activity-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    transform: translateX(5px);
}

/* ============================================= */
/* 5. ALGORITHM CARDS                           */
/* ============================================= */

.algorithm-card {
    background: white;
    border-left: 4px solid #667eea;
    border-radius: 10px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    animation: slideIn 0.5s ease-out;
}

.algorithm-card:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

.algorithm-card-pending {
    border-left-color: #888;
    opacity: 0.7;
}

.algorithm-card-running {
    border-left-color: #ffa500;
    background: linear-gradient(135deg, #fff9f0 0%, #fff5e6 100%);
    animation: pulse 2s ease-in-out infinite;
}

.algorithm-card-completed {
    border-left-color: #43e97b;
    background: linear-gradient(135deg, #f0fff4 0%, #e6f9ef 100%);
}

.algorithm-card-failed {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, #fff0f0 0%, #ffe6e6 100%);
}

.algorithm-card h5 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-weight: 600;
}

.algorithm-card p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.algorithm-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.5rem;
}

.badge-swarm {
    background: #e3f2fd;
    color: #1976d2;
}

.badge-evolutionary {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-physics {
    background: #e8f5e9;
    color: #388e3c;
}

.badge-hybrid {
    background: #fff3e0;
    color: #f57c00;
}

/* ============================================= */
/* 6. BUTTONS                                   */
/* ============================================= */

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    padding: 0.6rem 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-secondary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    border: none;
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e04555 0%, #d875e3 100%);
    box-shadow: 0 6px 20px rgba(245, 87, 108, 0.4);
}

/* ============================================= */
/* 7. FORMS                                     */
/* ============================================= */

.form-control, .form-select {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    outline: none;
}

.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

/* ============================================= */
/* 8. TABS                                      */
/* ============================================= */

.nav-tabs {
    border-bottom: 2px solid #e0e0e0;
    gap: 8px;
}

.nav-tabs .nav-link {
    background-color: rgba(102, 126, 234, 0.1);
    border-radius: 8px 8px 0 0;
    padding: 10px 20px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    color: #667eea;
}

.nav-tabs .nav-link:hover {
    background-color: rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.nav-tabs .nav-link.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.tab-content {
    padding-top: 1.5rem;
}

/* ============================================= */
/* 9. CARDS & CONTAINERS                        */
/* ============================================= */

.card {
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.dataset-card {
    border-left: 4px solid #667eea;
    padding: 1.5rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.dataset-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    border-color: #667eea !important;
}

.dataset-card h5 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-weight: 600;
}

.dataset-card p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* Task Cards */
.task-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    height: 100%;
}

.task-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
    border-color: #667eea !important;
}

.task-icon {
    font-size: 3rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.border-3 {
    border-width: 3px !important;
}

/* Algorithm badges for AI recommendations */
#recommendedAlgorithms .badge {
    margin: 0.25rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ============================================= */
/* 10. TABLES                                   */
/* ============================================= */

.table {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.table thead th {
    border: none;
    font-weight: 600;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

/* ============================================= */
/* 11. PROGRESS BAR                             */
/* ============================================= */

.progress {
    height: 1.5rem;
    border-radius: 10px;
    background-color: rgba(102, 126, 234, 0.2);
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* ============================================= */
/* 12. BADGES & LABELS                          */
/* ============================================= */

.step-indicator {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    text-align: center;
    line-height: 35px;
    font-weight: 700;
    margin-right: 10px;
    box-shadow: 0 4px 10px rgba(102, 126, 234, 0.4);
}

.user-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 25px;
    display: inline-block;
    font-weight: 600;
    margin: 0.5rem 0;
}

/* ============================================= */
/* 13. ALERTS                                   */
/* ============================================= */

.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.5rem;
    animation: slideIn 0.4s ease-out;
}

.alert-success {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
}

.alert-danger {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
}

.alert-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1565c0;
}

/* ============================================= */
/* 14. SPINNER & LOADING                        */
/* ============================================= */

.spinner-emoji {
    display: inline-block;
    animation: spin 2s linear infinite;
}

.spinner-border {
    animation: spin 1s linear infinite;
}

/* ============================================= */
/* 15. NAVIGATION                               */
/* ============================================= */

.navbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: white !important;
}

.navbar-nav .nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 0.5rem 1rem;
    border-radius: 6px;
}

.navbar-nav .nav-link:hover {
    color: white !important;
    background: rgba(255,255,255,0.1);
}

.navbar-nav .nav-link.active {
    background: rgba(255,255,255,0.2);
    color: white !important;
}

/* ============================================= */
/* 16. RESPONSIVE DESIGN                        */
/* ============================================= */

@media (max-width: 768px) {
    .main-header h1 {
        font-size: 2rem;
    }
    
    .main-header p {
        font-size: 0.95rem;
    }
    
    .stat-card-value {
        font-size: 1.8em;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .metric-number {
        font-size: 2rem;
    }
}

/* ============================================= */
/* 17. UTILITIES                                */
/* ============================================= */

.text-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-lg {
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.rounded-lg {
    border-radius: 12px;
}

/* Chart containers */
.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
}
