/* Retail Trade Strategy Styles */
.retail-strategy-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.retail-strategy-header {
    text-align: center;
    margin-bottom: 20px;
}

.retail-strategy-header h3 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 20px;
}

.retail-strategy-header p {
    color: #7f8c8d;
    margin: 0;
    font-size: 13px;
}

/* Strategy count tooltip */
.strategy-count-tooltip {
    color: #3498db;
    font-weight: 600;
    cursor: help;
    border-bottom: 1px dotted #3498db;
    position: relative;
}

.strategy-count-tooltip:hover {
    color: #2980b9;
}

/* Strategy Selection Panel */
.strategy-selection-container {
    margin-top: 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.strategy-selection-header {
    padding: 12px 16px;
    background: #f8f9fa;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
    user-select: none;
}

.strategy-selection-header:hover {
    background: #e9ecef;
}

.toggle-icon {
    transition: transform 0.3s;
    font-size: 12px;
}

.strategy-selection-header.expanded .toggle-icon {
    transform: rotate(180deg);
}

.strategy-selection-panel {
    padding: 16px;
    background: white;
    border-top: 1px solid #ddd;
}

.strategy-groups {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.strategy-group {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    background: #fafafa;
}

.strategy-group-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #ddd;
}

.strategy-group-header label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.strategy-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.strategy-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 0;
    margin: 0;
}

.strategy-list label:hover {
    color: #3498db;
}

.strategy-checkbox, .group-toggle {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

@media (max-width: 1024px) {
    .strategy-groups {
        grid-template-columns: 1fr;
    }
}

/* Enhanced tooltip styling */
.strategy-count-tooltip[title] {
    position: relative;
}

.strategy-count-tooltip:hover::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 8px;
    padding: 12px 16px;
    background: #2c3e50;
    color: white;
    border-radius: 8px;
    font-size: 12px;
    white-space: pre-line;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    min-width: 400px;
    max-width: 500px;
    text-align: left;
    line-height: 1.6;
    font-weight: normal;
}

.strategy-count-tooltip:hover::before {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 100%;
    margin-top: 2px;
    border: 6px solid transparent;
    border-bottom-color: #2c3e50;
    z-index: 1001;
}

.retail-strategy-input {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.input-row {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
}

.symbol-input-wrapper {
    display: flex;
    gap: 5px;
    align-items: center;
}

.symbol-input-wrapper input {
    flex: 1;
}

.search-company-btn {
    padding: 10px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.search-company-btn:hover {
    background: #2980b9;
}

.company-search-box {
    margin-top: 5px;
    animation: slideDown 0.2s ease;
    position: relative;
}

.company-search-box input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #3498db;
    border-radius: 6px;
    font-size: 14px;
}

.company-search-box .symbol-dropdown {
    position: relative;
    top: 5px;
    left: 0;
    right: 0;
}

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

.input-group label {
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
}

.input-group input {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
}

.input-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.symbol-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    left: 50%;
    transform: translateX(-50%);
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 400px;
    width: 100%;
    display: none;
}

.symbol-option {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.symbol-option:last-child {
    border-bottom: none;
}

.symbol-option:hover {
    background: #f8f9fa;
}

.symbol-option strong {
    color: #2c3e50;
    font-size: 13px;
}

.retail-strategy-input button {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.retail-strategy-input button:hover {
    background: #2980b9;
}

.strategy-results-header {
    margin-bottom: 15px;
}

.strategy-results-header h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.market-context {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #7f8c8d;
}

.market-context span {
    padding: 3px 10px;
    background: #ecf0f1;
    border-radius: 4px;
}

.economic-context {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #7f8c8d;
    margin-top: 8px;
}

.economic-context span {
    padding: 3px 10px;
    background: #fff3cd;
    border-radius: 4px;
}

.regime-volatile {
    color: #dc3545;
    font-weight: bold;
}

.regime-trending {
    color: #28a745;
    font-weight: bold;
}

.regime-neutral {
    color: #6c757d;
    font-weight: bold;
}

.strategy-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 15px;
}

.strategy-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    transition: all 0.3s;
}

.strategy-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.strategy-card.high {
    border-color: #27ae60;
}

.strategy-card.medium {
    border-color: #f39c12;
}

.strategy-card.low {
    border-color: #e74c3c;
}

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

.strategy-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.medal {
    font-size: 20px;
}

.strategy-title h5 {
    margin: 0;
    font-size: 16px;
}

.strategy-score {
    font-size: 20px;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 6px;
}

.strategy-score .score-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
}

.strategy-score.high {
    background: #d4edda;
    color: #27ae60;
}

.strategy-score.medium {
    background: #fff3cd;
    color: #f39c12;
}

.strategy-score.low {
    background: #f8d7da;
    color: #e74c3c;
}

.strategy-meta {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

/* Trade Recommendation */
.trade-recommendation {
    margin: 15px 0;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid;
}

.trade-recommendation.strong-buy {
    background: #d4edda;
    border-left-color: #27ae60;
}

.trade-recommendation.buy {
    background: #d4edda;
    border-left-color: #27ae60;
}

.trade-recommendation.moderate {
    background: #fff3cd;
    border-left-color: #f39c12;
}

.trade-recommendation.hold {
    background: #f8f9fa;
    border-left-color: #95a5a6;
}

.trade-recommendation.sell {
    background: #f8d7da;
    border-left-color: #dc3545;
}

.recommendation-section {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.recommendation-section:first-child {
    padding-top: 0;
    margin-top: 0;
}

.recommendation-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.recommendation-section.historical {
    background: rgba(255,255,255,0.5);
    padding: 10px;
    border-radius: 6px;
    margin: 10px 0;
}

.recommendation-section.overall {
    background: rgba(52, 152, 219, 0.1);
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
}

.recommendation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
}

.recommendation-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.historical-return {
    margin-left: auto;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.historical-return.positive {
    background: #d4edda;
    color: #27ae60;
}

.historical-return.negative {
    background: #f8d7da;
    color: #e74c3c;
}

.recommendation-reason {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: #555;
    white-space: pre-line !important;
}

.recommendation-section.overall .recommendation-reason {
    white-space: pre-line !important;
}

.strategy-meta span {
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.confidence.high {
    background: #d4edda;
    color: #27ae60;
}

.confidence.medium {
    background: #fff3cd;
    color: #f39c12;
}

.confidence.low {
    background: #f8d7da;
    color: #e74c3c;
}

.time-horizon {
    background: #e3f2fd;
    color: #2196f3;
}

.strategy-factors {
    margin-bottom: 10px;
}

.edge-factors, .risk-factors {
    margin-bottom: 8px;
}

.edge-factors strong {
    color: #27ae60;
    font-size: 12px;
}

.risk-factors strong {
    color: #e74c3c;
    font-size: 12px;
}

.strategy-factors ul {
    margin: 4px 0 0 0;
    padding-left: 18px;
}

.strategy-factors li {
    font-size: 12px;
    margin: 2px 0;
    color: #555;
}

.trade-plan {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
}

.trade-plan h6 {
    margin: 0 0 8px 0;
    color: #2c3e50;
    font-size: 13px;
}

.trade-plan-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}

.trade-plan-grid div {
    font-size: 12px;
}

.trade-plan-grid strong {
    color: #2c3e50;
}

.trade-notes {
    font-size: 11px;
    color: #7f8c8d;
    margin: 8px 0 0 0;
    font-style: italic;
}

.backtest-btn {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.backtest-btn:hover {
    background: #2980b9;
}

.backtest-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.backtest-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.backtest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.backtest-header h4 {
    margin: 0;
    font-size: 18px;
}

.backtest-period-selector {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    align-items: center;
}

.backtest-period-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    cursor: pointer;
}

.backtest-period-selector label:first-child {
    font-weight: 600;
    cursor: default;
}

.backtest-period-selector input[type="radio"] {
    cursor: pointer;
}

.backtest-body {
    padding: 20px;
}

.backtest-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.backtest-metric {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.metric-label {
    font-size: 12px;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.metric-value {
    font-size: 24px;
    font-weight: bold;
    color: #2c3e50;
}

.metric-value.positive {
    color: #27ae60;
}

.metric-value.negative {
    color: #e74c3c;
}

.backtest-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.backtest-details div {
    margin: 5px 0;
    font-size: 13px;
}

.recent-trades h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
}

.trade-row {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 4px;
    font-size: 12px;
}

.trade-row.win {
    border-left: 3px solid #27ae60;
}

.trade-row.loss {
    border-left: 3px solid #e74c3c;
}

.loading-container {
    text-align: center;
    padding: 40px 20px;
}

.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #e74c3c;
}

.error-message span {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

/* Responsive */
@media (max-width: 768px) {
    .strategy-cards {
        grid-template-columns: 1fr;
    }

    .retail-strategy-input {
        flex-direction: column;
    }

    .retail-strategy-input input {
        width: 100%;
    }
}


/* Badges */
.complexity-badge, .experience-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
    margin-left: 8px;
}

.complexity-badge.low {
    background: #d4edda;
    color: #155724;
}

.complexity-badge.medium {
    background: #fff3cd;
    color: #856404;
}

.complexity-badge.high {
    background: #f8d7da;
    color: #721c24;
}

.experience-badge.beginner {
    background: #cfe2ff;
    color: #084298;
}

.experience-badge.intermediate {
    background: #e7f1ff;
    color: #0a58ca;
}

.experience-badge.advanced {
    background: #d1e7dd;
    color: #0f5132;
}

/* Strategy Insights */
.strategy-insights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 10px 0;
}

.strategy-insights span {
    font-size: 12px;
    color: #2c3e50;
}

/* Best For Section */
.best-for-section {
    padding: 10px;
    background: #e7f3ff;
    border-left: 3px solid #0066cc;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 0.85em;
}

.best-for-section strong {
    display: block;
    margin-bottom: 5px;
    color: #0066cc;
    font-size: 0.95em;
}

.best-for-section ul {
    margin: 0;
    padding-left: 20px;
}

.best-for-section li {
    margin: 3px 0;
}

/* Strategy Insights Panel */
.strategy-insights-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.insights-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.insights-header:hover {
    opacity: 0.9;
}

.insights-header h5 {
    margin: 0;
    font-size: 1em;
}

.toggle-icon {
    font-size: 1.2em;
    transition: transform 0.3s;
}

.insights-content {
    margin-top: 15px;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.insight-card {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 15px;
    border-radius: 6px;
}

.insight-card h6 {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 1em;
}

.insight-card p {
    margin: 10px 0;
    font-size: 0.9em;
    line-height: 1.4;
}

.complexity-level, .experience-level, .learning-level {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.complexity-level.low {
    background: #d4edda;
    color: #155724;
}

.complexity-level.medium {
    background: #fff3cd;
    color: #856404;
}

.complexity-level.high {
    background: #f8d7da;
    color: #721c24;
}

.experience-level.beginner {
    background: #cfe2ff;
    color: #084298;
}

.experience-level.intermediate {
    background: #e7f1ff;
    color: #0a58ca;
}

.experience-level.advanced {
    background: #d1e7dd;
    color: #0f5132;
}

.learning-level {
    background: #e7f1ff;
    color: #0a58ca;
}

.insight-details {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.85em;
}

.insight-details span {
    background: #f8f9fa;
    padding: 4px 8px;
    border-radius: 4px;
}

.next-steps {
    margin-top: 10px;
    font-size: 0.85em;
}

.next-steps strong {
    display: block;
    margin-bottom: 5px;
}

.next-steps ul {
    margin: 0;
    padding-left: 20px;
}

.next-steps li {
    margin: 3px 0;
}

.learning-timeline {
    margin-top: 10px;
}

.timeline-step {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    font-size: 0.85em;
}

.step-number {
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9em;
    flex-shrink: 0;
}

.step-text {
    line-height: 1.3;
}



/* Strategy Groups */
.strategy-group {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.strategy-group-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.remaining-strategies {
    margin-top: 15px;
}


/* Risk Profile Selector */
.risk-profile-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
    background: #f8f9fa;
    border-radius: 6px;
    flex: 1;
    padding-left: 0;
}

.risk-profile-selector > label:first-child {
    margin-right: 0;
    padding-left: 0;
}

.risk-profile-selector label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 13px;
    color: #2c3e50;
    white-space: nowrap;
}

.risk-profile-selector label:first-child {
    font-weight: 600;
    margin-right: 5px;
}

.risk-profile-selector input[type="radio"] {
    cursor: pointer;
}

.input-row .btn-primary {
    padding: 10px 24px;
    font-size: 14px;
    white-space: nowrap;
    height: fit-content;
}


/* Company Search Modal */
.search-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.search-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.search-modal-header h4 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.search-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.search-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input-group input {
    flex: 1;
    padding: 12px;
    border: 2px solid #3498db;
    border-radius: 6px;
    font-size: 14px;
}

.search-input-group button {
    padding: 12px 24px;
    white-space: nowrap;
}

.company-search-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.company-result-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.company-result-item:hover {
    background: #f8f9fa;
    border-color: #3498db;
    transform: translateX(5px);
}

.company-symbol {
    font-weight: 700;
    font-size: 16px;
    color: #3498db;
    min-width: 60px;
}

.company-info {
    flex: 1;
}

.company-name {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 4px;
}

.company-sector {
    font-size: 12px;
    color: #7f8c8d;
}
