/* Market Scanner Styles */

/* Research Subtabs */
.research-subtabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.research-subtab-btn {
    padding: 8px 16px;
    background: #e5e7eb;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: #374151;
}

.research-subtab-btn:hover {
    background: #d1d5db;
}

.research-subtab-btn.active {
    background: #10b981 !important;
    color: #ffffff !important;
    border-color: #4b5563 !important;
    border-width: 2px;
}

/* Deep Research Toggle */
.deep-research-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
    color: #374151;
    margin-left: 8px;
}

.deep-research-toggle:hover {
    background: #e5e7eb;
}

.deep-research-toggle input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.deep-research-toggle input[type="checkbox"]:checked + span {
    color: #059669;
    font-weight: 600;
}

.research-subtab-content {
    display: none;
}

.research-subtab-content.active {
    display: block;
    height: calc(100vh - 180px); /* Full height minus header + tabs */
}

/* Research Agent subtab needs flex layout to keep controls at bottom */
#researchAgentSubtab.research-subtab-content.active {
    display: flex;
    flex-direction: column;
}

/* Scanner Container */
.scanner-container {
    padding: 16px;
    overflow-y: auto;
    background: var(--bg-primary);
    height: 100%;
}

/* Scanner Cards */
.scanner-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.scanner-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.scanner-card:hover {
    border-color: #10b981;
    transform: translateY(-1px);
}

.scanner-card.active {
    border-color: #10b981;
    background: #10b981;
    color: white;
}

.scanner-icon {
    font-size: 1.8em;
    margin-bottom: 6px;
}

.scanner-name {
    font-weight: 600;
    margin-bottom: 3px;
    font-size: 13px;
}

.scanner-description {
    font-size: 11px;
    color: var(--text-secondary);
}

.scanner-card.active .scanner-description {
    color: rgba(255, 255, 255, 0.9);
}

/* Scanner Config */
.scanner-config {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 20px;
}

.config-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.config-group {
    flex: 0 0 200px;
    min-width: 200px;
}

.config-group-small {
    flex: 0 0 200px;
    min-width: 200px;
}

.config-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-primary);
}

.config-group select,
.config-group input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
}

/* Market select column - wider */
#marketInputGroup {
    flex: 0 0 300px;
    min-width: 300px;
}

/* Market select - wider and taller */
#marketSelect {
    min-width: 300px;
    height: 140px;
}

.config-group select:focus,
.config-group input:focus {
    outline: none;
    border-color: #10b981;
}

/* Scan Button */
.scan-button {
    background: #10b981;
    color: white;
    border: none;
    padding: 6px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
}

.scan-button:hover {
    background: #059669;
}

.scan-button:disabled {
    background: #6b7280;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Progress */
.scanner-progress {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    display: none;
}

.scanner-progress.active {
    display: block;
}

#progressText {
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--text-primary);
}

.progress-bar {
    width: 100%;
    height: 24px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #10b981;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 12px;
}

/* Results */
.scanner-results {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
}

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

.results-header h3 {
    margin: 0;
    font-size: 15px;
    color: var(--text-primary);
}

#resultsCount {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
}

.results-table-container {
    overflow-x: auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
}

.results-table th,
.results-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
}

.results-table th {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
}

.results-table td {
    color: var(--text-primary);
}

.results-table tr:hover {
    background: var(--bg-hover);
}

.score-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 12px;
}

.score-high {
    background: #10b981;
    color: white;
}

.score-medium {
    background: #f59e0b;
    color: white;
}

.score-low {
    background: #6b7280;
    color: white;
}

.signal-bullish {
    color: #10b981;
    font-weight: 600;
}

.signal-bearish {
    color: #ef4444;
    font-weight: 600;
}

.signal-neutral {
    color: #f59e0b;
    font-weight: 600;
}

/* Cancel Button */
.cancel-button {
    background: #ef4444;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.cancel-button:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Clear Button */
.clear-button {
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.clear-button:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

/* Button disabled state */
.scan-button:disabled,
.cancel-button:disabled,
.clear-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.scan-button:disabled:hover,
.cancel-button:disabled:hover,
.clear-button:disabled:hover {
    transform: none;
}


/* Advanced Scanners - Compact Design */
.advanced-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 16px;
}

.advanced-header h2 {
    margin: 0;
    font-size: 20px;
}

.advanced-header p {
    margin: 4px 0 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.advanced-config {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.config-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-item label {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.config-item input,
.config-item select {
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
}

.advanced-scanner-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.advanced-scanner-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 10px;
    transition: all 0.2s;
}

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

.scanner-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.scanner-emoji {
    font-size: 18px;
}

.scanner-title h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #111827;
}

.scanner-desc {
    font-size: 11px;
    color: #6b7280;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.scanner-mini-params {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 8px;
}

.scanner-mini-params input,
.scanner-mini-params select {
    padding: 5px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 11px;
}

.scanner-mini-params input::placeholder {
    color: #9ca3af;
    font-size: 10px;
}

.scan-btn-mini {
    width: 100%;
    padding: 6px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.scan-btn-mini:hover {
    background: #059669;
    transform: translateY(-1px);
}

.scan-btn-mini:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.advanced-results {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
}

.results-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.results-header-compact h3 {
    margin: 0;
    font-size: 16px;
    color: #111827;
}

.btn-icon {
    padding: 6px 10px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #e5e7eb;
}

.progress-bar-compact {
    background: #f3f4f6;
    border-radius: 6px;
    height: 28px;
    position: relative;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-compact .progress-fill {
    background: linear-gradient(90deg, #10b981, #059669);
    height: 100%;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-bar-compact .progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    font-weight: 600;
    color: #374151;
}

.results-table-compact {
    overflow-x: auto;
}

/* Scan info message */
.scan-info-message {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 4px;
    font-size: 13px;
    color: #1565c0;
    font-weight: 500;
}

.results-table-compact table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.results-table-compact th {
    background: #f9fafb;
    padding: 10px 8px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.results-table-compact td {
    padding: 10px 8px;
    border-bottom: 1px solid #f3f4f6;
}

.results-table-compact tr:hover {
    background: #f9fafb;
}

.results-table-compact .score-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #10b981;
    color: white;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11px;
}

.results-table-compact .signal-bullish_divergence,
.results-table-compact .signal-accumulation,
.results-table-compact .signal-squeeze_candidate,
.results-table-compact .signal-earnings_upcoming {
    color: #10b981;
    font-weight: 600;
    font-size: 11px;
}

.results-table-compact .signal-bearish_divergence,
.results-table-compact .signal-distribution {
    color: #ef4444;
    font-weight: 600;
    font-size: 11px;
}

.results-table-compact .reason-cell {
    max-width: 250px;
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: #9ca3af;
    font-size: 13px;
}
