/*
🌙 Moon Dev's AI Agent Backtests Dashboard - Premium Design
Built with love by Moon Dev 🚀
*/

:root {
    /* Modern Color Palette */
    --primary: #0066FF;
    --primary-dark: #0052CC;
    --primary-light: #3385FF;
    --secondary: #7C3AED;
    --accent: #10B981;
    --accent-danger: #EF4444;
    --accent-warning: #F59E0B;

    /* Neutrals */
    --bg-primary: #0A0E1A;
    --bg-secondary: #151923;
    --bg-tertiary: #1F2937;
    --bg-card: #1F2937;
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;

    /* Glass Effect */
    --glass-bg: rgba(31, 41, 55, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(0, 102, 255, 0.3);

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #0A0E1A 0%, #1a1f35 50%, #0A0E1A 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    padding: var(--space-xl);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated background effect */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 102, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: backgroundMove 60s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes backgroundMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

/* Copied notification - premium style */
.copied-notification {
    position: fixed;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--accent) 0%, #059669 100%);
    color: white;
    padding: var(--space-lg) var(--space-2xl);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    z-index: 10000;
    transition: top 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    backdrop-filter: blur(10px);
}

.copied-notification.show {
    top: var(--space-xl);
}

/* 🌙 Moon Dev: New Backtests Notification Banner */
.new-backtests-banner {
    margin: 0 0 var(--space-xl) 0;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.15) 0%, rgba(124, 58, 237, 0.15) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(0, 102, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    animation: slideDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.new-backtests-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(0, 102, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

.banner-content {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    cursor: pointer;
    position: relative;
    z-index: 1;
    flex: 1;
    transition: all 0.2s ease;
    padding: var(--space-xs);
    border-radius: var(--radius-md);
}

.banner-content:hover {
    background: rgba(0, 102, 255, 0.1);
}

.banner-icon {
    font-size: 1.5rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.banner-text {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.banner-action {
    color: var(--primary-light);
    font-weight: 600;
    font-size: 0.875rem;
    margin-left: auto;
}

.banner-close {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
}

.banner-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-danger);
    color: var(--accent-danger);
    transform: scale(1.1);
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Header - Premium Style - 🌙 Moon Dev: Compact horizontal layout */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
    padding: var(--space-lg) var(--space-xl);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(0, 102, 255, 0.1), transparent);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    letter-spacing: -0.02em;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    margin: 0;
    text-align: right;
}

/* Stats Grid - Premium Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-2xl);
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

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

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(0, 102, 255, 0.2);
    border-color: rgba(0, 102, 255, 0.3);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

/* Table Container - Premium Glass */
.table-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-2xl);
    position: relative;
}

/* 🌙 Moon Dev: Pause button - styled to match action buttons */
.pause-btn {
    padding: var(--space-sm) var(--space-lg);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: default;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
    background: rgba(245, 158, 11, 0.1);
    color: var(--accent-warning);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    animation: fadeInPause 0.3s ease;
}

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

.pause-btn .pause-icon {
    font-size: 1rem;
    animation: pulse 2s infinite;
}

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

.pause-btn .pause-text {
    font-weight: 600;
    font-size: 0.875rem;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
    gap: var(--space-md);
}

.table-header h2 {
    font-size: 1.75rem;
    color: var(--text-primary);
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.01em;
}

.table-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.selection-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
    font-weight: 500;
}

/* 🌙 Moon Dev: Premium Filter Controls Bar */
.filter-controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
    padding: var(--space-lg) var(--space-xl);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    gap: var(--space-xl);
    position: relative;
    overflow: visible; /* 🌙 Moon Dev: Changed from hidden to show badges */
}

.filter-controls-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0.5;
}

.filter-left, .filter-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.filter-label {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: 0;
}

.filter-label-text {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.premium-filter-input {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 150px;
    font-weight: 500;
}

/* 🌙 Moon Dev: Remove ugly spinner arrows from number inputs */
.premium-filter-input::-webkit-outer-spin-button,
.premium-filter-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.premium-filter-input[type=number] {
    -moz-appearance: textfield;
}

.premium-filter-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

.premium-filter-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(31, 41, 55, 0.8);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1), 0 0 12px rgba(0, 102, 255, 0.2);
    transform: translateY(-1px);
}

.premium-filter-input:hover {
    border-color: rgba(0, 102, 255, 0.3);
}

/* Style the moved DataTables search to match */
#search-container .dataTables_filter {
    margin: 0;
}

#search-container .dataTables_filter label {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: 0;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

#search-container .dataTables_filter input {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 250px;
    font-weight: 500;
    margin: 0;
}

#search-container .dataTables_filter input::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

#search-container .dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(31, 41, 55, 0.8);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1), 0 0 12px rgba(0, 102, 255, 0.2);
    transform: translateY(-1px);
}

#search-container .dataTables_filter input:hover {
    border-color: rgba(0, 102, 255, 0.3);
}

/* 🌙 Moon Dev: Filter Badge for Folder Filtering */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: rgba(0, 102, 255, 0.15);
    border: 1px solid rgba(0, 102, 255, 0.3);
    border-radius: var(--radius-md);
    color: var(--primary-light);
    font-size: 0.875rem;
    font-weight: 600;
    animation: slideInBadge 0.3s ease;
}

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

.filter-badge-icon {
    font-size: 1rem;
}

.filter-badge-text {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-badge-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.filter-badge-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.1);
}

#selection-count {
    color: var(--primary-light);
    font-weight: 700;
}

/* Buttons - Premium Style */
.action-btn,
.refresh-btn {
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.02em;
}

.action-btn {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

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

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

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    color: var(--primary-light);
}

.refresh-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 102, 255, 0.4);
}

.refresh-btn:active {
    transform: translateY(0);
}

/* Table Styles - Premium DataTable */
table.dataTable {
    width: 100% !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

table.dataTable thead th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 2px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 10;
}

table.dataTable thead th:first-child {
    border-top-left-radius: var(--radius-md);
}

table.dataTable thead th:last-child {
    border-top-right-radius: var(--radius-md);
}

table.dataTable tbody tr {
    background: var(--bg-card);
    transition: all 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

table.dataTable tbody tr:hover {
    background: rgba(0, 102, 255, 0.1);
    transform: scale(1.01);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.15);
}

table.dataTable tbody tr.selected {
    background: rgba(0, 102, 255, 0.2) !important;
    box-shadow: inset 3px 0 0 var(--primary);
}

table.dataTable tbody td {
    padding: var(--space-md) var(--space-lg);
    color: var(--text-primary);
    border: none;
}

/* Strategy column - premium tooltip - 🌙 Moon Dev: Widened from 120px to 160px */
table.dataTable tbody td.has-tooltip {
    position: relative;
    cursor: pointer;
    color: var(--primary-light);
    font-weight: 600;
    max-width: 160px;
    min-width: 160px;
    width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color 0.2s ease;
}

table.dataTable tbody td.has-tooltip:hover {
    color: var(--accent);
}

table.dataTable thead th:first-child {
    max-width: 160px;
    min-width: 160px;
    width: 160px;
}

table.dataTable tbody td.has-tooltip::after {
    content: attr(data-filepath);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    background: linear-gradient(135deg, #1F2937 0%, #111827 100%);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    font-size: 0.75rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--glass-border);
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
}

table.dataTable tbody td.has-tooltip:hover::after {
    opacity: 1;
    transform: translateY(0);
}

/* Numeric columns - right aligned with color coding */
table.dataTable tbody td.dt-right {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

table.dataTable tbody td.positive {
    color: var(--accent);
}

table.dataTable tbody td.negative {
    color: var(--accent-danger);
}

/* DataTable Controls - 🌙 Moon Dev: Layout for top and bottom areas */
.dataTables_wrapper .top {
    display: none; /* 🌙 Moon Dev: Hide default top area, we use custom filter bar now */
}

.dataTables_wrapper .bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-lg);
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* 🌙 Moon Dev: Make length selector and pagination controls align nicely at bottom */
.dataTables_wrapper .dataTables_length {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.dataTables_wrapper .dataTables_info {
    flex-shrink: 0;
}

.dataTables_wrapper .dataTables_paginate {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    margin: 0 var(--space-sm);
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_filter input {
    width: 250px;
}

.dataTables_wrapper .dataTables_length select:focus,
.dataTables_wrapper .dataTables_filter input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary) !important;
    padding: var(--space-xs) var(--space-md);
    margin: 0 2px;
    transition: all 0.2s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
    transform: translateY(-1px);
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white !important;
}

/* Modal Styles - Premium - 🌙 Moon Dev */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 1;
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl), 0 0 40px rgba(0, 102, 255, 0.2);
    border: 1px solid var(--glass-border);
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 🌙 Moon Dev: Larger modals for folder manager and backtest creation */
.modal-content.modal-large {
    max-width: 800px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: var(--space-xl);
    border-bottom: 2px solid transparent;
    background: linear-gradient(90deg, var(--primary), var(--secondary)) bottom / 100% 2px no-repeat;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    padding: var(--space-xl);
}

.modal-footer {
    padding: var(--space-xl);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

/* Form Elements - Premium */
input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

/* Select dropdown styling */
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239CA3AF' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-md) center;
    padding-right: calc(var(--space-xl) + var(--space-md));
}

select:hover {
    border-color: rgba(0, 102, 255, 0.3);
}

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-sm);
}

textarea {
    min-height: 200px;
    resize: vertical;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    line-height: 1.6;
}

label {
    display: block;
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 102, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary);
}

/* Folder List - 🌙 Moon Dev: Premium scrollbar */
.folders-list {
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-xs);
}

.folders-list::-webkit-scrollbar {
    width: 8px;
}

.folders-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.folders-list::-webkit-scrollbar-thumb {
    background: rgba(0, 102, 255, 0.3);
    border-radius: var(--radius-sm);
}

.folders-list::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 102, 255, 0.5);
}

.folder-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) var(--space-lg);
    background: rgba(31, 41, 55, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.folder-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.folder-item:hover {
    background: rgba(31, 41, 55, 0.8);
    border-color: rgba(0, 102, 255, 0.3);
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.15);
}

.folder-item:hover::before {
    transform: scaleY(1);
}

.folder-name {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 1rem;
    transition: color 0.2s ease;
}

.folder-name::before {
    content: '📁';
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

/* 🌙 Moon Dev: Make entire folder item clickable */
.folder-item-clickable {
    cursor: pointer;
}

.folder-item-clickable:hover .folder-name {
    color: var(--primary-light);
}

.folder-item-clickable:hover .folder-name::before {
    transform: scale(1.1);
}

/* 🌙 Moon Dev: No folders message */
.no-folders {
    text-align: center;
    color: var(--text-secondary);
    padding: var(--space-2xl);
    font-size: 0.95rem;
    line-height: 1.6;
}

.folder-count {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: var(--space-sm);
    background: rgba(0, 102, 255, 0.1);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.folder-actions {
    display: flex;
    gap: var(--space-sm);
}

.btn-icon {
    background: rgba(31, 41, 55, 0.5);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.25rem;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: rgba(0, 102, 255, 0.15);
    border-color: var(--primary);
    color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 102, 255, 0.2);
}

.btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--accent-danger);
    color: var(--accent-danger);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.2);
}

/* Loading Bar - Premium */
.loading-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: var(--space-lg);
    z-index: 9998;
    box-shadow: var(--shadow-xl);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.loading-bar.show {
    transform: translateY(0);
}

.loading-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.loading-bar-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
}

.loading-bar-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.loading-bar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.loading-bar-progress {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.loading-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmerBar 2s infinite;
}

@keyframes shimmerBar {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.loading-bar-message {
    margin-top: var(--space-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Scrollbar - Premium */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    border: 2px solid var(--bg-secondary);
    transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: var(--space-md);
    }

    header h1 {
        font-size: 1.75rem;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: var(--space-md);
    }

    .stat-value {
        font-size: 1.75rem;
    }

    .table-container {
        padding: var(--space-md);
        overflow-x: auto;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-actions {
        width: 100%;
        justify-content: stretch;
    }

    .action-btn,
    .refresh-btn {
        flex: 1;
    }

    /* 🌙 Moon Dev: Stack filter controls on mobile */
    .filter-controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-md);
    }

    .filter-left, .filter-right {
        width: 100%;
        justify-content: space-between;
    }

    .premium-filter-input,
    #search-container .dataTables_filter input {
        width: auto;
        flex: 1;
    }

    .modal-content {
        width: 95%;
        margin: var(--space-md);
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }

    .action-btn,
    .refresh-btn,
    .loading-bar,
    .modal {
        display: none !important;
    }
}

/* ============================================================================
   🌙 MOON DEV DATA PORTAL STYLES
   ============================================================================ */

/* Navigation - Already defined above, keeping for reference */
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
    z-index: 2;
}

.nav-brand {
    flex-shrink: 0;
}

.nav-brand h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin: 0;
}

.nav-links {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-light);
    background: rgba(0, 102, 255, 0.1);
}

.nav-link.active {
    color: var(--primary-light);
    background: rgba(0, 102, 255, 0.15);
}

.nav-link.active::after {
    transform: scaleX(1);
}

/* Data Portal Status Bar */
.status-bar {
    background: linear-gradient(135deg, rgba(0, 82, 255, 0.1), rgba(0, 212, 255, 0.1));
    border: 1px solid rgba(0, 82, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-2xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    font-weight: 600;
}

.green-dot {
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    box-shadow: 0 0 10px var(--accent);
}

/* Data Cards Grid */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: var(--space-2xl);
    margin-bottom: var(--space-2xl);
}

@media (max-width: 768px) {
    .data-grid {
        grid-template-columns: 1fr;
    }
}

.data-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.data-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

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

.data-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(0, 102, 255, 0.2);
    border-color: rgba(0, 102, 255, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-xl);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.card-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.card-stats {
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 600;
}

.stat-value {
    font-weight: 600;
    font-family: 'SF Mono', Monaco, monospace;
}

/* Status colors for data portal */
.status-ready {
    color: var(--accent);
}

.status-fetching {
    color: var(--accent-warning);
}

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

.status-pending {
    color: var(--text-muted);
}

/* Download button */
.download-btn {
    display: block;
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    letter-spacing: 0.02em;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 102, 255, 0.4);
}

.download-btn.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: var(--bg-tertiary);
    cursor: not-allowed;
}

/* Info Section */
.info-section {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    margin-bottom: var(--space-2xl);
    box-shadow: var(--shadow-md);
}

.info-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: var(--space-xl);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    color: var(--text-primary);
}

.info-list {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.8;
}

.info-list p {
    margin-bottom: var(--space-md);
}

.info-list strong {
    color: var(--text-primary);
    font-weight: 600;
}

.info-list code {
    background: rgba(0, 0, 0, 0.3);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    color: var(--primary-light);
    font-size: 0.85rem;
}

.code-pre {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 82, 255, 0.2);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    margin: var(--space-md) 0;
    overflow-x: auto;
}

.code-pre code {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
}

/* Expand button */
.expand-btn {
    display: block;
    width: 100%;
    padding: var(--space-md) var(--space-xl);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    text-align: center;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

.expand-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 102, 255, 0.4);
}

/* Code examples */
.code-examples {
    margin-top: var(--space-lg);
}

.code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 82, 255, 0.2);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    transition: all 0.3s ease;
}

.code-block:hover {
    border-color: rgba(0, 82, 255, 0.4);
    background: rgba(0, 0, 0, 0.4);
}

.code-block h4 {
    color: var(--primary-light);
    margin-bottom: var(--space-md);
    font-size: 0.95rem;
    font-weight: 600;
}

.code-block pre {
    margin: 0;
    overflow-x: auto;
}

.code-block code {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    line-height: 1.6;
}

/* Scrollbar for code blocks */
.code-block pre::-webkit-scrollbar {
    height: 8px;
}

.code-block pre::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
}

.code-block pre::-webkit-scrollbar-thumb {
    background: rgba(0, 102, 255, 0.3);
    border-radius: var(--radius-sm);
}

.code-block pre::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 102, 255, 0.5);
}

/* ============================================================================
   🌙 Moon Dev - Test Data Sets Section
   ============================================================================ */

.dataset-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.dataset-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xl);
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.dataset-row:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 102, 255, 0.4);
    box-shadow: 0 8px 24px rgba(0, 102, 255, 0.15);
}

.dataset-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.dataset-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.dataset-description {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

.dataset-size {
    font-size: 0.875rem;
    color: var(--accent-info);
    font-weight: 600;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

.dataset-download-btn {
    padding: var(--space-md) var(--space-2xl);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9375rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.3);
}

.dataset-download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.4);
}

.dataset-download-btn:active {
    transform: translateY(0);
}

/* Responsive design for dataset rows */
@media (max-width: 768px) {
    .dataset-row {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-lg);
    }

    .dataset-download-btn {
        width: 100%;
    }
}

/* ============================================================================
   🌙 Moon Dev - Compact Download Button for Table
   ============================================================================ */

.download-btn-small {
    padding: var(--space-sm) var(--space-lg);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white !important;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.8125rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.25);
}

.download-btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.35);
}

.download-btn-small:active {
    transform: translateY(0);
}

.file-size-placeholder {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ============================================================================
   🌙 Moon Dev - DataTable Text Alignment
   ============================================================================ */

.text-right {
    text-align: right !important;
}

/* Make Download column buttons align properly */
#datasets-table td.text-right {
    text-align: right !important;
    padding-right: var(--space-xl);
}

#datasets-table th.text-right {
    text-align: right !important;
    padding-right: var(--space-xl);
}
