/* Indicator Filter – layout (extends screener-page.css) */

body.indicator-filter-page {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

.indicator-filter-page .screener-toolbar.btn-group {
    width: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}

.indicator-filter-page .screener-toolbar .timeframe-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
}

.indicator-filter-page #indicator-filter-main-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Filter panel */
.if-filter-panel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.if-filter-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.if-filter-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.if-filter-actions #addCondition {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.if-filter-actions #addCondition:hover {
    background: #e2e8f0;
}

.if-filter-actions #applyFilter {
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
}

.if-filter-actions #applyFilter:hover {
    background: #1d4ed8;
}

/* Strategy row */
.if-strategy-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.if-strategy-row .form-control,
.if-strategy-row .form-select {
    flex: 1 1 180px;
    min-width: 140px;
    padding: 8px 12px;
    font-size: 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    background: #fff;
    color: #212529;
}

.if-strategy-row .form-control:focus,
.if-strategy-row .form-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.if-strategy-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.if-strategy-btns .btn {
    padding: 7px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid #ced4da;
    background: #f8f9fa;
    color: #495057;
}

.if-strategy-btns .btn:hover {
    background: #e9ecef;
}

.if-strategy-btns .btn-outline-primary {
    background: transparent;
    color: #2563eb;
    border-color: #2563eb;
}

.if-strategy-btns .btn-outline-danger {
    background: transparent;
    color: #dc3545;
    border-color: #dc3545;
}

#strategyFeedback {
    font-size: 12px;
    color: #64748b;
    margin-top: 4px;
}

/* Results panel – header above scroll table */
.if-results-header {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    color: #f9fafb;
    background: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom: none;
    border-radius: 14px 14px 0 0;
}

.indicator-filter-page .if-results-table-wrap {
    border-radius: 0 0 14px 14px;
    margin-bottom: 14px;
}

/* Results table – mirror screener #indicatorTable */
.indicator-filter-page #resultsTable {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: auto;
    font-size: 12px;
    overflow: visible !important;
}

.indicator-filter-page #resultsTable th,
.indicator-filter-page #resultsTable td {
    display: table-cell !important;
    white-space: nowrap;
    min-width: 68px;
    padding: 8px 6px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
    color: #212529;
    vertical-align: middle;
}

.indicator-filter-page #resultsTable th {
    background: #1f2937;
    color: #f9fafb;
    padding: 10px 8px;
    font-size: 11px;
    font-weight: 700;
    position: sticky;
    top: 0;
    z-index: 4;
    box-shadow: 0 1px 0 #374151;
}

/* Sticky symbol column */
.indicator-filter-page #resultsTable th:first-child,
.indicator-filter-page #resultsTable td:first-child {
    position: sticky;
    left: 0;
    z-index: 3;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.12);
    border-right: 1px solid #334155;
    isolation: isolate;
}

.indicator-filter-page #resultsTable thead th:first-child {
    z-index: 8;
    top: 0;
    left: 0;
    background-color: #1f2937;
}

.indicator-filter-page #resultsTable th:first-child {
    text-align: left;
    padding-left: 12px;
}

.indicator-filter-page #resultsTable td:first-child {
    position: sticky;
    left: 0;
    background-color: #ffffff;
    text-align: left;
    padding-left: 12px;
    font-weight: 600;
}

.indicator-filter-page #resultsTable td:first-child::before {
    content: "";
    position: absolute;
    inset: 0;
    background-color: inherit;
    z-index: -1;
    pointer-events: none;
}

.indicator-filter-page #resultsTable tbody tr:nth-child(even) td:not(:first-child) {
    background: #f9fafb;
}

.indicator-filter-page #resultsTable tbody tr:nth-child(even) td:first-child {
    background-color: #f9fafb;
}

.indicator-filter-page #resultsTable tbody tr:hover td:not(:first-child) {
    background: rgba(37, 99, 235, 0.06);
}

.indicator-filter-page #resultsTable tbody tr:hover td:first-child {
    background-color: #eef4ff;
}

.indicator-filter-page #resultsTable td:first-child a,
.indicator-filter-page #resultsTable td:first-child .symbol-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.indicator-filter-page #resultsTable td:first-child a:hover {
    text-decoration: underline;
}

/* Signal pills – same as screener setSignalCell() */
.indicator-filter-page #resultsTable .signal-pill {
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    display: inline-block;
    white-space: nowrap;
}

.indicator-filter-page #resultsTable .signal-pill.bg-green {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.indicator-filter-page #resultsTable .signal-pill.bg-red {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

.indicator-filter-page #resultsTable .signal-pill.bg-yellow {
    background: rgba(245, 158, 11, 0.2);
    color: #92400e;
}

.indicator-filter-page #resultsTable .signal-pill.bg-gray {
    background: rgba(107, 114, 128, 0.2);
    color: #374151;
}

.indicator-filter-page #resultsTable td.cell-tone-bull {
    background: rgba(34, 197, 94, 0.14) !important;
    color: #15803d !important;
}

.indicator-filter-page #resultsTable td.cell-tone-bear {
    background: rgba(239, 68, 68, 0.14) !important;
    color: #b91c1c !important;
}

.indicator-filter-page #resultsTable.loading {
    opacity: 0.55;
    pointer-events: none;
}

/* SEO sections */
.if-seo-section {
    margin-top: 4px;
}

.if-seo-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.if-seo-card h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: #111827;
    margin: 0 0 12px;
}

.if-seo-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #374151;
    margin: 14px 0 6px;
}

.if-seo-card p,
.if-seo-card li {
    font-size: 0.9rem;
    color: #4b5563;
    line-height: 1.55;
}

.if-seo-card a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.if-seo-card a:hover {
    text-decoration: underline;
}

.if-seo-card .if-tip {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: #1e40af;
    font-size: 0.88rem;
}

.if-seo-card .if-note {
    margin-top: 10px;
    font-size: 0.82rem;
    color: #64748b;
}

/* Accordion in SEO */
.indicator-filter-page .accordion-item {
    border: 1px solid #e5e7eb;
    border-radius: 10px !important;
    overflow: hidden;
    margin-bottom: 8px;
    background: #f8fafc;
}

.indicator-filter-page .accordion-button {
    font-size: 0.92rem;
    font-weight: 600;
    background: #f8fafc;
    color: #1f2937;
    box-shadow: none !important;
}

.indicator-filter-page .accordion-button:not(.collapsed) {
    background: #eef2ff;
    color: #1d4ed8;
}

.indicator-filter-page .accordion-body {
    font-size: 0.88rem;
    color: #4b5563;
    background: #fff;
}

/* Desktop: compact values + sticky symbol column (match screener) */
@media (min-width: 1024px) {
    .indicator-filter-page #resultsTable {
        font-size: 10px;
    }

    .indicator-filter-page #resultsTable th,
    .indicator-filter-page #resultsTable td {
        min-width: 50px;
        padding: 4px 2px;
        font-size: 10px;
    }

    .indicator-filter-page #resultsTable th {
        padding: 5px 2px;
        font-size: 9px;
        letter-spacing: -0.02em;
        line-height: 1.2;
    }

    .indicator-filter-page #resultsTable th:first-child,
    .indicator-filter-page #resultsTable td:first-child {
        position: sticky !important;
        left: 0 !important;
        min-width: 88px;
        width: 88px;
        max-width: 88px;
        padding-left: 8px;
        box-shadow: 4px 0 14px rgba(0, 0, 0, 0.22);
    }

    .indicator-filter-page #resultsTable thead th:first-child {
        z-index: 8 !important;
    }

    .indicator-filter-page #resultsTable .signal-pill {
        padding: 1px 4px;
        font-size: 8px;
        border-radius: 4px;
    }

    .indicator-filter-page #resultsTable .symbol-link {
        gap: 4px;
        font-size: 10px;
    }

    .indicator-filter-page #resultsTable .symbol-link img {
        width: 18px;
        height: 18px;
        min-width: 18px;
        padding: 1px;
    }

    .indicator-filter-page #resultsTable .symbol-link span {
        font-size: 10px;
    }

    .indicator-filter-page #resultsTable td:first-child .symbol-link,
    .indicator-filter-page #resultsTable td:first-child a {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

@media (max-width: 768px) {
    .if-filter-panel {
        padding: 12px 14px;
    }

    .if-strategy-row .form-control,
    .if-strategy-row .form-select {
        flex: 1 1 100%;
    }
}

/* Smart filter: per-condition timeframe buttons */
.condition-timeframe {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.condition-timeframe .timeframe-btn,
.condition-timeframe .condition-timeframe-btn {
    padding: 5px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 11px;
    background: #e9ecef;
    color: #495057;
}

.condition-timeframe .timeframe-btn.active[data-timeframe="15m"],
.condition-timeframe .condition-timeframe-btn.active[data-timeframe="15m"] {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.condition-timeframe .timeframe-btn.active[data-timeframe="1h"],
.condition-timeframe .condition-timeframe-btn.active[data-timeframe="1h"] {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.condition-timeframe .timeframe-btn.active[data-timeframe="4h"],
.condition-timeframe .condition-timeframe-btn.active[data-timeframe="4h"] {
    background: #fd7e14;
    color: #fff;
    border-color: #fd7e14;
}

.condition-timeframe .timeframe-btn.active[data-timeframe="1d"],
.condition-timeframe .condition-timeframe-btn.active[data-timeframe="1d"] {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}
