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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: #f5f5f5;
    color: #000000;
    line-height: 1.2;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 12px;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 100%;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}


/* Main Layout */
.main-layout {
    display: flex;
    gap: 0;
    min-height: 100vh;
}

/* Config Sidebar */
.config-sidebar {
    width: 300px;
    background: #ffffff;
    border-right: 1px solid #000000;
    padding: 12px;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    color: #000000;
    border-bottom: 1px solid #000000;
    padding-bottom: 6px;
}

/* Form Styles */
.form-group {
    margin-bottom: 6px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000000;
}

input[type="text"],
input[type="date"],
input[type="number"],
select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #000000;
    border-radius: 0;
    font-size: 11px;
    background: #ffffff;
    color: #000000;
    font-family: inherit;
}

input:focus,
select:focus {
    outline: none;
    border-color: #000000;
    background: #fafafa;
}

.input-with-search {
    display: flex;
    gap: 6px;
}

.input-with-search input {
    flex: 1;
}

.search-btn {
    padding: 6px 12px;
    background: #000000;
    color: #ffffff;
    border: 1px solid #000000;
    border-radius: 0;
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background 0.2s;
    font-family: inherit;
}

.search-btn:hover {
    background: #333333;
}

.suggestions {
    margin-top: 3px;
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #000000;
    border-radius: 0;
    display: none;
    background: #ffffff;
}

.suggestion-item {
    padding: 6px 8px;
    cursor: pointer;
    font-size: 11px;
    border-bottom: 1px solid #e5e5e5;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.help-text {
    display: block;
    margin-top: 3px;
    font-size: 9px;
    color: #666666;
    line-height: 1.4;
}

.help-note {
    margin-top: 6px;
    padding: 8px;
    background: #fff9e6;
    border-left: 3px solid #ffa500;
    font-size: 9px;
    color: #666666;
    line-height: 1.5;
    border-radius: 2px;
}

.help-note strong {
    color: #000000;
    font-weight: 600;
}

.help-note .highlight-true,
.help-note .highlight-false {
    font-weight: 700;
}

.condition-explanation {
    margin-top: 4px;
    border: 1px solid #e5e5e5;
    background: #ffffff;
    display: none;
}

.condition-explanation.active {
    display: block;
}

.explanation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background: #f9f9f9;
    border-bottom: 1px solid #e5e5e5;
    cursor: pointer;
}

.explanation-header:hover {
    background: #f5f5f5;
}

.explanation-title {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #000000;
}

.explanation-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 10px;
    color: #000000;
    line-height: 1;
    transition: transform 0.2s;
}

.explanation-toggle:hover {
    opacity: 0.7;
}

.toggle-arrow {
    display: inline-block;
    font-size: 8px;
    transition: transform 0.2s;
}

.condition-explanation.expanded .toggle-arrow {
    transform: rotate(0deg);
}

.condition-explanation:not(.expanded) .toggle-arrow {
    transform: rotate(-90deg);
}

.condition-explanation.expanded .toggle-arrow {
    display: inline-block;
}

.condition-explanation:not(.expanded) .toggle-arrow {
    display: inline-block;
}

.explanation-content {
    padding: 8px;
    font-size: 9px;
    color: #666666;
    line-height: 1.5;
}

.condition-explanation:not(.expanded) .explanation-content {
    display: none;
}
    padding: 6px;
    background: #f9f9f9;
    border-left: 2px solid #000000;
    font-size: 9px;
    line-height: 1.4;
    color: #333333;
    min-height: 16px;
    display: none;
}

.condition-explanation.active {
    display: block;
}

.condition-explanation .explanation-title {
    font-weight: 600;
    margin-bottom: 2px;
    color: #000000;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.condition-explanation .explanation-text {
    color: #555555;
}

/* Indicators */
.indicators-container {
    margin-bottom: 8px;
    min-height: 30px;
}

.indicator-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px;
    margin-bottom: 4px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 0;
}

.indicator-name {
    font-weight: 500;
    font-size: 10px;
    margin-bottom: 2px;
}

.indicator-params {
    font-size: 9px;
    color: #666666;
}

.remove-indicator {
    background: #ff4444;
    color: #ffffff;
    border: none;
    padding: 4px 8px;
    border-radius: 0;
    cursor: pointer;
    font-size: 9px;
    transition: opacity 0.2s;
    font-family: inherit;
}

.remove-indicator:hover {
    opacity: 0.8;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border: none;
    border-radius: 0;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    font-family: inherit;
}

.btn-primary {
    background: #000000;
    color: #ffffff;
    margin-top: 8px;
}

.btn-primary:hover {
    background: #333333;
}

.btn-secondary {
    background: #f5f5f5;
    color: #000000;
    border: 1px solid #000000;
    margin-top: 6px;
}

.btn-secondary:hover {
    background: #e5e5e5;
}

/* Modal button container - override full width for buttons in modals */
.modal-content .btn-primary,
.modal-content .btn-secondary {
    width: auto;
    margin-top: 0;
}

.modal-content .btn-primary {
    margin-top: 0;
}

.modal-content .btn-secondary {
    margin-top: 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
}

.advanced-settings {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #e5e5e5;
}

/* Strategy Examples */
.strategy-examples {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #e5e5e5;
}

.examples-title {
    font-size: 10px;
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000000;
}

.example-card {
    padding: 6px;
    margin-bottom: 4px;
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
}

.example-card:hover {
    background: #ffffff;
    border-color: #000000;
}

.example-name {
    font-weight: 600;
    font-size: 10px;
    margin-bottom: 2px;
    color: #000000;
}

.example-description {
    font-size: 9px;
    color: #666666;
    line-height: 1.3;
}

/* Content Area */
.content-area {
    flex: 1;
    background: #ffffff;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.leaderboard-section {
    padding: 6px;
}

.analytics-section {
    padding: 6px;
    border-top: 1px solid #000000;
    margin-top: 6px;
}

.analytics-placeholder {
    text-align: center;
    padding: 20px;
    color: #999999;
    font-size: 11px;
}

/* Leaderboard Cards */

.leaderboard-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.result-card {
    background: #ffffff;
    border: 1px solid #000000;
    padding: 10px;
    transition: border-color 0.2s;
}

.result-card:hover {
    border-color: #333333;
}

.result-card.top-ranked {
    border-left: 3px solid #00aa00;
    background: #f0f8f0;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e5e5e5;
}

.card-rank {
    font-size: 18px;
    font-weight: 700;
    color: #000000;
    min-width: 30px;
}

.card-title {
    flex: 1;
}

.model-name {
    font-weight: 600;
    font-size: 13px;
    color: #000000;
    margin-bottom: 2px;
}

.model-strategy {
    font-size: 10px;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.card-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-item.full-width {
    grid-column: 1 / -1;
}

.metric-label {
    font-size: 9px;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 3px;
    font-weight: 600;
    line-height: 1.2;
}

.metric-value {
    font-size: 16px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    line-height: 1.3;
}

.value-positive {
    color: #00aa00;
}

.value-negative {
    color: #aa0000;
}

.value-neutral {
    color: #000000;
}

.empty-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #999999;
    font-size: 11px;
}

/* Analytics Section */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 6px;
}

.chart-container {
    background: #ffffff;
    border: 1px solid #000000;
    border-radius: 0;
}

.chart-title {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 8px;
    color: #000000;
    border-bottom: 1px solid #000000;
    background: #ffffff;
}

.chart-container canvas {
    padding: 8px;
}


.detailed-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    background: #000000;
    border: 1px solid #000000;
    margin-top: 6px;
}

.detailed-stats-grid .stat-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    background: #ffffff;
    font-size: 9px;
}

.detailed-stats-grid .stat-label {
    color: #666666;
    font-weight: 500;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.3px;
}

.detailed-stats-grid .stat-value {
    font-weight: 600;
    color: #000000;
    font-family: 'Courier New', monospace;
}

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

.modal-content {
    background-color: #ffffff;
    margin: 10% auto;
    padding: 20px;
    border: 2px solid #000000;
    width: 90%;
    max-width: 400px;
    position: relative;
}

.close {
    position: absolute;
    right: 12px;
    top: 12px;
    font-size: 24px;
    font-weight: bold;
    color: #000000;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #666666;
}

.modal-content h3 {
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 1200px) {
    .config-sidebar {
        width: 260px;
    }
    
    .leaderboard-cards {
        grid-template-columns: 1fr;
    }
    
    .charts-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-layout {
        flex-direction: column;
    }
    
    .config-sidebar {
        width: 100%;
        height: auto;
        max-height: none;
        border-right: none;
        border-bottom: 1px solid #000000;
        padding: 8px;
    }
    
    .leaderboard-section,
    .analytics-section {
        padding: 4px;
    }
    
    .sort-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .leaderboard-cards {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .result-card {
        padding: 6px;
    }
    
    .card-metrics {
        gap: 4px 6px;
    }
    
    .charts-row {
        grid-template-columns: 1fr;
        gap: 4px;
        margin-bottom: 4px;
    }
    
    .detailed-stats-grid {
        grid-template-columns: 1fr;
        margin-top: 4px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .input-with-search {
        flex-direction: column;
        gap: 4px;
    }
    
    .search-btn {
        width: 100%;
    }
    
    .chart-container canvas {
        padding: 6px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 11px;
    }
    
    .config-sidebar {
        padding: 6px;
    }
    
    .sidebar-title {
        margin-bottom: 8px;
        padding-bottom: 4px;
    }
    
    .form-group {
        margin-bottom: 4px;
    }
    
    .leaderboard-section,
    .analytics-section {
        padding: 4px;
    }
    
    
    .leaderboard-cards {
        gap: 4px;
    }
    
    .result-card {
        padding: 6px;
    }
    
    .card-rank {
        font-size: 12px;
        min-width: 20px;
    }
    
    .model-name {
        font-size: 10px;
    }
    
    .metric-label {
        font-size: 6px;
    }
    
    .metric-value {
        font-size: 10px;
    }
    
    .chart-title {
        padding: 4px 6px;
        font-size: 8px;
    }
    
    .chart-container canvas {
        padding: 4px;
    }
    
    .detailed-stats-grid .stat-item {
        padding: 4px 6px;
        font-size: 8px;
    }
}

/* Trades Section - One trade per line */
.trades-section {
    margin-top: 16px;
    background: #ffffff;
    border: 1px solid #000000;
    padding: 8px;
}

.trades-content {
    max-height: 500px;
    overflow-y: auto;
}

.trades-table {
    width: 100%;
}

.trades-header {
    display: grid;
    grid-template-columns: 0.8fr 1.3fr 1.3fr 0.7fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr;
    gap: 8px;
    padding: 8px 6px;
    border-bottom: 2px solid #000000;
    font-weight: 700;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f5f5f5;
    position: sticky;
    top: 0;
    z-index: 10;
}

.trades-header.hide-type {
    grid-template-columns: 1.3fr 1.3fr 0.7fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr;
}

.trade-row {
    display: grid;
    grid-template-columns: 0.8fr 1.3fr 1.3fr 0.7fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr;
    gap: 8px;
    padding: 8px 6px;
    border-bottom: 1px solid #e0e0e0;
    font-size: 10px;
    min-height: 32px;
    align-items: center;
}

.trade-row.hide-type {
    grid-template-columns: 1.3fr 1.3fr 0.7fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr 0.9fr;
}

.trade-col-type.hidden {
    display: none;
}

.trade-row:hover {
    background: #f9f9f9;
}

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

.trade-col-type {
    text-align: center;
    font-weight: 700;
    font-size: 10px;
}


.type-long {
    color: #00aa00;
}

.type-long strong {
    color: #00aa00;
}

.type-short {
    color: #aa0000;
}

.type-short strong {
    color: #aa0000;
}

.trade-col-date {
    color: #666666;
    font-size: 9px;
}

.trade-col-number {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-size: 10px;
}

.trade-col-number.value-positive {
    color: #00aa00;
}

.trade-col-number.value-negative {
    color: #cc0000;
}

@media (max-width: 768px) {
    .trades-header,
    .trade-row {
        grid-template-columns: 0.8fr 1fr 1fr;
        gap: 4px;
        font-size: 8px;
    }
    
    .trades-header > div:nth-child(n+4),
    .trade-row > div:nth-child(n+4) {
        display: none;
    }
}
