/**
 * Stock Screener Public Page Styles
 * Header/nav styles are in common.css
 */

:root {
    --accent: #667eea;
    --accent-hover: #5a6fd6;
    --positive: #10b981;
    --negative: #ef4444;
    --warning: #f59e0b;
}

.ih-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Main page */
.ih-screener-page {
    padding-top: 80px; /* Account for fixed header */
}

/* Filter Tabs */
.ih-filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.ih-tab {
    padding: 10px 20px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.ih-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.ih-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.ih-tab.ih-locked {
    opacity: 0.7;
}

.ih-tab .ih-lock {
    margin-left: 4px;
    font-size: 12px;
}

/* Filter Panels */
.ih-filter-panel {
    display: none;
    padding: 16px 0;
}

.ih-filter-panel.active {
    display: block;
}

/* Locked Panel */
.ih-locked-panel {
    text-align: center;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px dashed var(--border-color);
}

.ih-locked-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ih-locked-panel p {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.ih-btn-unlock {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ih-btn-unlock:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(168, 85, 247, 0.3);
}

/* Filter Actions */
.ih-filter-actions {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
}

.ih-filter-actions .ih-filter-group {
    flex: 0 0 auto;
    min-width: 200px;
}

/* Hero */
.ih-screener-hero {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    padding: 60px 0 40px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.ih-screener-hero h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #fff 0%, #a0a0a0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ih-screener-hero p {
    color: var(--text-secondary);
    font-size: 16px;
    max-width: 600px;
    margin: 0 auto;
}

/* Filters */
.ih-screener-filters {
    background: var(--bg-secondary);
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
}

.ih-filter-form {
    width: 100%;
}

.ih-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.ih-filter-group {
    flex: 1;
    min-width: 150px;
}

.ih-filter-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ih-filter-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.ih-filter-group select:focus {
    outline: none;
    border-color: var(--accent);
}

.ih-btn-filter {
    padding: 10px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.ih-btn-filter:hover {
    background: var(--accent-hover);
}

/* Results */
.ih-screener-results {
    padding: 30px 0;
}

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

.ih-results-count {
    color: var(--text-secondary);
    font-size: 14px;
}

.ih-results-limit a {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

.ih-results-limit a:hover {
    text-decoration: underline;
}

/* Table */
.ih-table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.ih-screener-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ih-screener-table th {
    text-align: left;
    padding: 14px 16px;
    background: var(--bg-card);
    color: var(--text-muted);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.ih-screener-table td {
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.ih-screener-table tr:hover td {
    background: var(--bg-card);
}

.ih-ticker {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ih-stock-logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    background: white;
}

.ih-company {
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ih-change.positive {
    color: var(--positive);
}

.ih-change.negative {
    color: var(--negative);
}

.ih-no-results {
    text-align: center;
    padding: 40px !important;
    color: var(--text-muted);
}

/* Pagination */
.ih-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
}

.ih-page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 16px;
    transition: background 0.2s;
}

.ih-page-link:hover {
    background: var(--accent);
}

.ih-page-info {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Stock Detail */
.ih-stock-detail {
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.ih-back-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    margin-bottom: 24px;
    display: inline-block;
}

.ih-back-link:hover {
    text-decoration: underline;
}

.ih-detail-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.ih-detail-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    background: white;
    object-fit: contain;
}

.ih-detail-info {
    flex: 1;
}

.ih-detail-info h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ih-detail-name {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 4px;
}

.ih-detail-sector {
    color: var(--text-muted);
    font-size: 14px;
}

.ih-detail-price {
    text-align: right;
}

.ih-price-big {
    display: block;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ih-price-change {
    font-size: 16px;
    font-weight: 500;
}

.ih-price-change.positive {
    color: var(--positive);
}

.ih-price-change.negative {
    color: var(--negative);
}

/* Metrics Grid */
.ih-detail-metrics {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.ih-detail-metrics h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.ih-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
}

.ih-metric {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ih-metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ih-metric-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ih-metric-value.positive {
    color: var(--positive);
}

.ih-metric-value.negative {
    color: var(--negative);
}

.ih-rsi-oversold {
    color: var(--positive) !important;
}

.ih-rsi-overbought {
    color: var(--negative) !important;
}

.ih-rsi-neutral {
    color: var(--warning) !important;
}

/* Upgrade CTA */
.ih-upgrade-cta {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    margin-bottom: 24px;
}

.ih-lock-icon {
    font-size: 40px;
    margin-bottom: 16px;
}

.ih-upgrade-cta h3 {
    font-size: 20px;
    margin-bottom: 12px;
}

.ih-upgrade-cta p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.ih-btn-upgrade {
    display: inline-block;
    padding: 12px 28px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
}

.ih-btn-upgrade:hover {
    background: var(--accent-hover);
}

/* Company Info */
.ih-detail-company {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.ih-detail-company h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.ih-company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.ih-company-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ih-item-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.ih-item-value {
    font-size: 14px;
    color: var(--text-primary);
}

/* Description */
.ih-detail-description {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.ih-detail-description h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

.ih-detail-description p {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 16px;
}

.ih-website-link {
    color: var(--accent);
    text-decoration: none;
}

.ih-website-link:hover {
    text-decoration: underline;
}

/* CTA Section */
.ih-screener-cta {
    background: linear-gradient(135deg, var(--accent) 0%, #764ba2 100%);
    padding: 60px 0;
    text-align: center;
}

.ih-cta-content h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

.ih-cta-content p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.ih-btn-cta {
    display: inline-block;
    padding: 14px 32px;
    background: white;
    color: var(--accent);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s;
}

.ih-btn-cta:hover {
    transform: translateY(-2px);
}

/* ====== Stock Detail Page ====== */
.ih-stock-detail {
    padding: 40px 0;
    background: var(--bg-primary);
}

.ih-detail-header {
    margin-bottom: 24px;
}

.ih-back-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.2s;
}

.ih-back-link:hover {
    color: var(--text-primary);
}

.ih-detail-hero {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 24px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
}

.ih-detail-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: contain;
    background: #fff;
    padding: 8px;
}

.ih-detail-info {
    flex: 1;
}

.ih-detail-info h2 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.ih-detail-name {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.ih-detail-sector {
    font-size: 14px;
    color: var(--text-muted);
}

.ih-detail-price {
    text-align: right;
}

.ih-price-big {
    font-size: 32px;
    font-weight: 700;
    display: block;
}

.ih-price-change {
    font-size: 16px;
    font-weight: 600;
}

.ih-price-change.positive {
    color: var(--positive);
}

.ih-price-change.negative {
    color: var(--negative);
}

/* TradingView Chart */
.ih-chart-container {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 16px;
    margin-bottom: 24px;
    overflow: hidden;
}

.tradingview-widget-container {
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
}

#tradingview_chart {
    height: 100%;
    width: 100%;
}

@media (max-width: 768px) {
    .tradingview-widget-container {
        height: 300px;
    }
}

/* Detail Metrics Grid */
.ih-detail-metrics {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
}

.ih-detail-metrics h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.ih-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.ih-metric {
    background: var(--bg-secondary);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.ih-metric-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 6px;
}

.ih-metric-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.ih-metric-value.positive {
    color: var(--positive);
}

.ih-metric-value.negative {
    color: var(--negative);
}

/* RSI Colors */
.ih-rsi-oversold {
    color: var(--positive) !important;
}

.ih-rsi-overbought {
    color: var(--negative) !important;
}

.ih-rsi-neutral {
    color: var(--warning);
}

/* Company Info */
.ih-detail-company {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
}

.ih-detail-company h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
}

.ih-company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.ih-company-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ih-item-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ih-item-value {
    font-size: 15px;
    color: var(--text-primary);
}

/* Description */
.ih-detail-description {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    padding: 24px;
    margin-bottom: 24px;
}

.ih-detail-description h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.ih-detail-description p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 15px;
}

.ih-website-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.ih-website-link:hover {
    text-decoration: underline;
}

/* Upgrade CTA */
.ih-upgrade-cta {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(102, 126, 234, 0.05));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    margin-bottom: 24px;
}

.ih-lock-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ih-upgrade-cta h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.ih-upgrade-cta p {
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto 24px;
}

.ih-btn-upgrade {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    padding: 14px 32px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ih-btn-upgrade:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.3);
}

/* Footer */
.ih-footer {
    background: var(--bg-secondary);
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.ih-footer p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    .ih-screener-hero {
        padding: 40px 0 30px;
    }

    .ih-screener-hero h1 {
        font-size: 28px;
    }

    .ih-filter-tabs {
        flex-wrap: wrap;
    }

    .ih-tab {
        padding: 8px 14px;
        font-size: 13px;
    }

    .ih-filter-row {
        flex-direction: column;
    }

    .ih-filter-group {
        min-width: 100%;
    }

    .ih-filter-actions {
        flex-direction: column;
    }

    .ih-filter-actions .ih-filter-group {
        width: 100%;
    }

    .ih-btn-filter {
        width: 100%;
    }

    .ih-detail-hero {
        flex-direction: column;
        text-align: center;
    }

    .ih-detail-price {
        text-align: center;
    }

    .ih-screener-table {
        font-size: 13px;
    }

    .ih-screener-table th,
    .ih-screener-table td {
        padding: 10px 12px;
    }

    .ih-locked-panel {
        padding: 30px 16px;
    }

    .ih-locked-icon {
        font-size: 36px;
    }
}
