/* Backtest Queue & Results Styling */

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-image-slice: 1;
    animation: fadeIn 0.4s ease-out;
}

.page-header h2 {
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* Status Badges */
.status-badge {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

/* Cards */
.card {
    border: none;
    border-radius: 0.5rem;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.1) !important;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem 0.5rem 0 0 !important;
    padding: 0.75rem 1rem;
}

.card-header.bg-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
}

.card-header.bg-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%) !important;
}

.card-header.bg-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
}

/* Form Controls */
.form-control, .form-select {
    border: 1px solid #e0e0e0;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

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

textarea.form-control {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #63408b 100%);
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(102, 126, 234, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #0e8078 0%, #2fcc67 100%);
    transform: translateY(-1px);
}

/* Tables */
.table {
    font-size: 0.9rem;
    border-radius: 0.5rem;
    overflow: hidden;
}

.table thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #495057;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    border-bottom: 3px solid #dee2e6;
    padding: 1rem 0.75rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
    border-left-color: #667eea;
    transform: scale(1.005);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.table tbody td {
    vertical-align: middle;
    padding: 0.875rem 0.75rem;
}

.table-success {
    background-color: rgba(40, 167, 69, 0.08) !important;
    border-left: 3px solid #28a745;
}

.table-danger {
    background-color: rgba(220, 53, 69, 0.08) !important;
    border-left: 3px solid #dc3545;
}

/* Progress Bars */
.progress {
    height: 1.75rem;
    border-radius: 1rem;
    background-color: #e9ecef;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.progress-bar {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    font-weight: 700;
    font-size: 0.75rem;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: progress-stripes 1s linear infinite;
}

@keyframes progress-stripes {
    0% { background-position: 1rem 0; }
    100% { background-position: 0 0; }
}

/* PnL Cells */
.pnl-pos {
    color: #28a745;
    font-weight: 600;
}

.pnl-neg {
    color: #dc3545;
    font-weight: 600;
}

/* Statistics Cards */
.stats-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

.stats-card:hover::before {
    transform: scaleX(1);
}

.stats-card h6 {
    color: #6c757d;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
}

.stats-card h3 {
    font-size: 2.25rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stats-card small {
    color: #6c757d;
    font-size: 0.8rem;
    display: block;
    margin-top: 0.5rem;
}

/* Job Cards */
.job-card {
    border-left: 4px solid #667eea;
    margin-bottom: 0.5rem;
}

.job-card.pending {
    border-left-color: #6c757d;
}

.job-card.running {
    border-left-color: #ffc107;
}

.job-card.done {
    border-left-color: #28a745;
}

.job-card.failed {
    border-left-color: #dc3545;
}

/* Badge Styles */
.badge {
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.2s ease;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.badge:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge.text-bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.badge.text-bg-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
}

.badge.text-bg-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%) !important;
}

.badge.text-bg-warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
    color: white !important;
}

.badge.text-bg-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

.badge.text-bg-secondary {
    background: linear-gradient(135deg, #868e96 0%, #6c757d 100%) !important;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 1rem;
    margin: 1rem 0;
}

.empty-state > div:first-child {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.6;
    animation: float 3s ease-in-out infinite;
}

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

.empty-state p {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state small {
    font-size: 0.875rem;
    color: #868e96;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header h2 {
        margin-bottom: 0;
        font-size: 1.5rem;
    }

    .stats-card {
        padding: 1rem;
    }

    .stats-card h3 {
        font-size: 1.75rem;
    }

    .table {
        font-size: 0.8rem;
    }

    .table thead th {
        padding: 0.5rem 0.35rem;
        font-size: 0.7rem;
    }

    .table tbody td {
        padding: 0.5rem 0.35rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }

    .empty-state {
        padding: 2rem 1rem;
    }

    .empty-state > div:first-child {
        font-size: 3rem;
    }
}

@media (max-width: 576px) {
    .card-body {
        padding: 1rem;
    }

    .form-control, .form-select {
        font-size: 0.9rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Auto-refresh indicator */
.refresh-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: none;
}

.refresh-indicator.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Code Block */
pre {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border: 1px solid #4a5568;
    border-radius: 0.75rem;
    padding: 1.25rem;
    overflow-x: auto;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

pre code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    color: #e2e8f0;
    line-height: 1.6;
}

.dsl-view {
    position: relative;
}

.dsl-view::before {
    content: 'DSL';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(102, 126, 234, 0.2);
    color: #e2e8f0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Small improvements */
.form-text {
    font-size: 0.8rem;
    color: #6c757d;
}

.card-body.p-0 {
    overflow: hidden;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Operation Cards (for Dashboard) */
.operation-card {
    position: relative;
    overflow: hidden;
}

.operation-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.operation-card:hover::after {
    opacity: 1;
}

.operation-card .card-header.bg-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.operation-card .card-header.bg-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
}

.operation-card .card-header.bg-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    background: white;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border-radius: 0 0 0.75rem 0.75rem;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.autocomplete-dropdown .dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.autocomplete-dropdown .dropdown-item:hover {
    background: linear-gradient(90deg, #f8f9fa 0%, #e9ecef 100%);
    border-left-color: #667eea;
    padding-left: 1.25rem;
}

/* Pagination */
.pagination .page-link {
    border-radius: 0.5rem;
    margin: 0 0.25rem;
    border: none;
    background: white;
    color: #667eea;
    font-weight: 600;
    transition: all 0.2s ease;
}

.pagination .page-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* Alert enhancements */
.alert {
    border-radius: 0.75rem;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: linear-gradient(135deg, rgba(17, 153, 142, 0.1) 0%, rgba(56, 239, 125, 0.1) 100%);
    color: #0e8078;
    border-left: 4px solid #11998e;
}

.alert-info {
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%);
    color: #3d8cd9;
    border-left: 4px solid #4facfe;
}

.alert-warning {
    background: linear-gradient(135deg, rgba(240, 147, 251, 0.1) 0%, rgba(245, 87, 108, 0.1) 100%);
    color: #c93d5c;
    border-left: 4px solid #f093fb;
}

/* Spinner/Loading animations */
.spinner-border {
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* Toast notifications */
.toast {
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
}

.toast-header {
    border-radius: 0.75rem 0.75rem 0 0;
    font-weight: 600;
}

