/* =============================================================
   News Search — news-search.css
   Phase 3.5 Native UI Integration (March 2026)
   All colors from terminal.css variables. Zero hardcoded hex.
   Shared by: index.php, help.php
   ============================================================= */

/* --- Tool Scope ---------------------------------------------- */
.tool-scope {
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
}

/* --- Page Header (matches Dividend Calc / Options Hedger) ---- */
.tool-scope header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}

.tool-scope header h1 {
    font-weight: 300;
    font-size: 2rem;
    color: var(--text-primary);
    margin: 0 0 5px 0;
}

.tool-scope header .subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

/* Help link (pill style, same as Options Hedger) */
.help-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-accent);
    border: 1px solid var(--border);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    background: var(--bg-card);
    white-space: nowrap;
}
.help-link:hover {
    background: var(--text-accent);
    color: var(--bg-body);
    border-color: var(--text-accent);
    text-decoration: none;
}

/* --- Tab Row ------------------------------------------------- */
.tab-row {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.tab-row a {
    padding: 10px 24px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}
.tab-row a:hover {
    color: var(--text-primary);
    text-decoration: none;
}
.tab-row a.active {
    color: var(--text-accent);
    border-bottom-color: var(--text-accent);
}

/* --- Panel Card (main content container) --------------------- */
.panel-card {
    max-width: 900px;
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
}

/* --- Last Updated Bar --------------------------------------- */
.last-updated {
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    margin-bottom: 20px;
}

/* --- Summary Bar -------------------------------------------- */
.summary {
    margin-bottom: 20px;
    font-size: 16px;
    text-align: center;
    color: var(--text-primary);
}

/* --- Result Container --------------------------------------- */
.result-container {
    margin-top: 25px;
}

/* --- Search / Filter ---------------------------------------- */
.filter-container {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-container input[type="text"] {
    padding: 8px;
    background-color: var(--bg-input, var(--bg-body));
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: 14px;
    width: 200px;
    box-sizing: border-box;
    transition: border-color 0.3s;
}
.filter-container input[type="text"]:hover,
.filter-container input[type="text"]:focus {
    border-color: var(--text-accent);
    outline: none;
}
.filter-container button {
    background-color: var(--text-accent);
    color: var(--bg-body);
    border: none;
    padding: 8px 15px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: opacity 0.3s;
}
.filter-container button:hover {
    opacity: 0.85;
}

/* --- Tables ------------------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
}
th, td {
    border-bottom: 1px solid var(--border);
    padding: 10px 8px;
    text-align: left;
    white-space: normal;
}
th {
    background-color: var(--bg-hover, var(--bg-card));
    color: var(--text-accent);
    font-weight: normal;
    font-size: 12px;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 5;
    cursor: pointer;
}
th:hover {
    background-color: var(--border);
}
th:nth-child(1), td:nth-child(1) { width: 10%; }
th:nth-child(2), td:nth-child(2) { width: 20%; }
th:nth-child(3), td:nth-child(3) { width: 10%; text-align: center; }
th:nth-child(4), td:nth-child(4) { width: 15%; text-align: center; }
th:nth-child(5), td:nth-child(5) { width: 45%; }
td {
    color: var(--text-primary);
}
tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.03);
}
tr:nth-child(odd) {
    background-color: transparent;
}
.highlight {
    background-color: color-mix(in srgb, var(--success) 10%, transparent);
    font-weight: bold;
}
.highlight td {
    color: var(--text-primary);
}

/* --- Article expand/collapse -------------------------------- */
.article-list {
    font-size: 0.9em;
    color: var(--text-secondary);
    display: none;
    margin: 5px 0 0 0;
    padding-left: 20px;
}
.article-list ul {
    margin: 0;
    padding-left: 20px;
    list-style-type: disc;
}
.article-list li {
    margin-bottom: 5px;
}
.article-toggle {
    color: var(--text-accent);
    cursor: pointer;
    text-decoration: underline;
}
.article-toggle:hover {
    opacity: 0.8;
}

/* --- Section headings --------------------------------------- */
h2 {
    color: var(--text-primary);
    font-size: 18px;
    margin-top: 25px;
    margin-bottom: 10px;
}

/* --- Links -------------------------------------------------- */
a {
    color: var(--text-accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* --- Loading State ------------------------------------------ */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}
.loading-state .loading-text {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: 20px;
}
.loading-state .loading-subtext {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 10px;
    opacity: 0.6;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--text-accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Error State -------------------------------------------- */
.error-state {
    display: none;
    text-align: center;
    padding: 60px 20px;
}
.error-state .error-icon {
    font-size: 2rem;
    color: var(--text-accent);
    margin-bottom: 15px;
    display: block;
}
.error-state .error-message {
    color: var(--text-secondary);
    font-size: 1rem;
}
.error-state .retry-btn {
    margin-top: 20px;
    background-color: var(--text-accent);
    color: var(--bg-body);
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.error-state .retry-btn:hover {
    opacity: 0.85;
}

/* --- No results --------------------------------------------- */
.no-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px 20px;
    font-size: 1rem;
    display: none;
}

/* --- Help / Strategy Guide Page ----------------------------- */
.guide-content {
    font-size: 1.05rem;
    color: var(--text-secondary);
    padding: 40px;
}

.guide-content h2 {
    color: var(--text-primary);
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
}
.guide-content h2:first-of-type {
    margin-top: 0;
}
.guide-content strong {
    color: var(--text-primary);
}
.guide-content ul {
    margin-bottom: 25px;
    padding-left: 25px;
}
.guide-content li {
    margin-bottom: 10px;
}

/* Highlight / info box (blue left-border) */
.highlight-box {
    background-color: color-mix(in srgb, var(--text-accent) 8%, transparent);
    border-left: 4px solid var(--text-accent);
    padding: 20px;
    margin: 30px 0;
    border-radius: 0 4px 4px 0;
    color: var(--text-primary);
}
.highlight-box .bolt-icon {
    color: var(--text-accent);
    margin-right: 10px;
}

/* Strategy cards */
.strategy-card {
    background-color: color-mix(in srgb, var(--success) 5%, transparent);
    border: 1px solid var(--border);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.strategy-card.investor {
    background-color: color-mix(in srgb, var(--text-accent) 5%, transparent);
    border-color: color-mix(in srgb, var(--text-accent) 20%, transparent);
}

/* Risk / warning card */
.risk-card {
    background-color: color-mix(in srgb, var(--danger) 10%, transparent);
    border: 1px solid var(--danger);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Navigation buttons for help page */
.page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
}
.nav-btn:hover {
    border-color: var(--text-accent);
    color: var(--text-accent);
    text-decoration: none;
}

.guide-footer {
    text-align: center;
    margin-top: 50px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- Responsive (768px) ------------------------------------- */
@media (max-width: 768px) {
    .tool-scope header {
        flex-direction: column;
        gap: 12px;
    }
    .panel-card {
        max-width: 100%;
        padding: 15px;
    }
    .guide-content {
        padding: 20px;
    }
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 20px 0;
    }
    th, td {
        padding: 8px 6px;
    }
    th:nth-child(1), td:nth-child(1) { width: 15%; }
    th:nth-child(2), td:nth-child(2) { width: 25%; }
    th:nth-child(3), td:nth-child(3) { width: 15%; }
    th:nth-child(4), td:nth-child(4) { width: 20%; }
    th:nth-child(5), td:nth-child(5) { width: 25%; }
    .summary {
        font-size: 14px;
    }
    h2 {
        font-size: 16px;
    }
    .filter-container {
        flex-direction: column;
    }
    .filter-container input[type="text"] {
        width: 100%;
    }
    .filter-container button {
        width: 100%;
    }
    .tab-row a {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    .page-nav {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
    .page-nav .nav-btn {
        text-align: center;
        justify-content: center;
    }
}
@media (min-width: 769px) {
    .result-container {
        max-width: 800px;
        margin-left: auto;
        margin-right: auto;
    }
}
