/* ═══════════════════════════════════════════════════════════════════════════
   EARNINGS - SHARED RULES (every page)

   earnings.css is linked only on /earnings (EarningsIntelligence, see
   Components/PageStylesheets.cs). These are the rules of earnings.css that
   also style other pages - their classes (.empty-state, .modal-overlay,
   .stat-label, .positive, .score-badge, ...) are used outside the earnings
   components - plus its :root variables and all of its @keyframes (keyframe
   names are global). They are byte-for-byte copies, in the same order, and
   this file sits exactly where earnings.css used to (after app.css, before
   screener.css), so every other page renders as before. On /earnings the
   full earnings.css follows right after it, so there the copies here change
   nothing.

   Edit a rule in both files; a test (PageStylesheetTests) fails if a rule here
   is not a verbatim copy of one in earnings.css. A new earnings.css rule that
   should also style another page belongs in both files.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    --earnings-drawer-width: 480px;
}

.regime-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 4px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.regime-badge i {
    font-size: 0.6rem;
    opacity: 0.8;
}

.regime-badge.badge-bullish {
    color: var(--market-bull);
    background: var(--market-bull-soft);
    border-color: rgba(63, 185, 80, 0.3);
}

.regime-badge.badge-bearish {
    color: var(--market-bear);
    background: var(--market-bear-soft);
    border-color: rgba(248, 81, 73, 0.3);
}

.regime-badge.badge-neutral {
    color: var(--text-secondary);
    background: var(--terminal-elevated);
    border-color: var(--terminal-border);
}

.regime-badge.badge-low {
    color: var(--market-bull);
    background: var(--market-bull-soft);
    border-color: rgba(63, 185, 80, 0.3);
}

.regime-badge.badge-high {
    color: var(--accent-warning);
    background: var(--accent-warning-soft);
    border-color: rgba(210, 153, 34, 0.3);
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 0.625rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    pointer-events: none;
}

.search-container input {
    width: 180px;
    padding: 0.375rem 0.625rem 0.375rem 1.75rem;
    border: 1px solid var(--terminal-border);
    border-radius: 6px;
    background: var(--terminal-elevated);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.search-container input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: var(--terminal-card);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

.search-container input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
}

.result-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.01em;
}

.sector-select, .sort-select, .direction-select {
    padding: 0.3rem 0.5rem;
    padding-right: 1.5rem;
    border: 1px solid var(--terminal-border);
    border-radius: 4px;
    background: var(--terminal-elevated);
    color: var(--text-primary);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236e7681' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.25rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
}

.sector-select:hover, .sort-select:hover, .direction-select:hover {
    border-color: var(--text-muted);
}

.sector-select:focus, .sort-select:focus, .direction-select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
}

.table-container {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid var(--terminal-border);
    background: var(--terminal-surface);
}

.col-edge { width: 60px; }

.action-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 14px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.2px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.action-badge.action-strong-buy {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.55);
    color: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.25);
}

.action-badge.action-buy {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.action-badge.action-none {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.25);
    color: #94a3b8;
}

.action-badge.action-short {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.action-badge.action-strong-short {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.55);
    color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.25);
}

@keyframes subtle-pulse-bull {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

@keyframes subtle-pulse-bear {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.9; }
}

.company-logo {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    object-fit: contain;
    background: #fff;
    flex-shrink: 0;
}

.logo-placeholder {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: var(--terminal-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
}

.logo-fallback {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    background: var(--terminal-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.company-name {
    font-size: 0.6rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90px;
}

.expected-move {
    font-weight: 700;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.price-value {
    font-weight: 600;
    font-size: 0.75rem;
    font-family: 'SF Mono', 'Consolas', monospace;
    color: var(--text-primary);
}

@keyframes tes-glow-bull {
    0%, 100% { box-shadow: 0 0 8px rgba(63, 185, 80, 0.2); }
    50% { box-shadow: 0 0 16px rgba(63, 185, 80, 0.35); }
}

@keyframes tes-glow-bear {
    0%, 100% { box-shadow: 0 0 8px rgba(248, 81, 73, 0.2); }
    50% { box-shadow: 0 0 16px rgba(248, 81, 73, 0.35); }
}

@keyframes mini-glow-bull {
    0%, 100% { box-shadow: 0 0 4px rgba(63, 185, 80, 0.2); }
    50% { box-shadow: 0 0 10px rgba(63, 185, 80, 0.4); }
}

@keyframes mini-glow-bear {
    0%, 100% { box-shadow: 0 0 4px rgba(248, 81, 73, 0.2); }
    50% { box-shadow: 0 0 10px rgba(248, 81, 73, 0.4); }
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--terminal-card);
    color: var(--text-primary);
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.detail-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.no-data {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
    margin: 0;
}

.score-breakdown {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
}

.stance-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}

.stance-label {
    letter-spacing: 0.01em;
}

.stance-badge.stance-bullish {
    background: var(--market-bull-soft);
    color: var(--market-bull);
}

.stance-badge.stance-bearish {
    background: var(--market-bear-soft);
    color: var(--market-bear);
}

.stance-badge.stance-bull-reversal {
    background: linear-gradient(135deg, rgba(63, 185, 80, 0.25), rgba(63, 185, 80, 0.15));
    color: var(--market-bull);
    border: 1px solid rgba(63, 185, 80, 0.5);
    box-shadow: 0 0 8px rgba(63, 185, 80, 0.3), inset 0 0 12px rgba(63, 185, 80, 0.1);
    font-weight: 700;
}

.stance-badge.stance-bear-reversal {
    background: linear-gradient(135deg, rgba(248, 81, 73, 0.25), rgba(248, 81, 73, 0.15));
    color: var(--market-bear);
    border: 1px solid rgba(248, 81, 73, 0.5);
    box-shadow: 0 0 8px rgba(248, 81, 73, 0.3), inset 0 0 12px rgba(248, 81, 73, 0.1);
    font-weight: 700;
}

.stance-badge.stance-ranging {
    background: var(--accent-warning-soft);
    color: var(--accent-warning);
}

.stance-badge.stance-weak {
    background: rgba(139, 148, 158, 0.15);
    color: var(--text-secondary);
}

.stance-badge.stance-unknown {
    background: var(--terminal-elevated);
    color: var(--text-muted);
}

.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
}

.score-badge .score-value {
    font-size: 0.8rem;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.score-badge.score-excellent {
    background: var(--market-bull-soft);
    color: var(--market-bull);
}

.score-badge.score-good {
    background: var(--accent-primary-soft);
    color: var(--accent-primary);
}

.score-badge.score-neutral {
    background: var(--accent-warning-soft);
    color: var(--accent-warning);
}

.score-badge.score-poor {
    background: var(--market-bear-soft);
    color: var(--market-bear);
}

.score-badge.score-pending {
    background: var(--terminal-elevated);
    color: var(--text-dim);
    border: 1px dashed var(--terminal-border);
}

.score-badge .tier-label {
    font-size: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    opacity: 0.9;
}

.score-badge.tier-elite .tier-label {
    color: var(--market-bull);
}

.score-badge.tier-high .tier-label {
    color: var(--accent-primary);
}

.score-badge.tier-watch .tier-label {
    color: var(--accent-warning);
}

.score-badge.tier-weak .tier-label {
    color: var(--text-muted);
}

.score-badge.tier-pending .tier-label {
    color: var(--text-dim);
}

@keyframes elite-pulse {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(63, 185, 80, 0.03);
    }
}

.score-badge.tier-elite {
    background: linear-gradient(135deg, var(--market-bull-soft) 0%, rgba(88, 166, 255, 0.1) 100%);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.5rem;
}

.pagination-controls .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    border: 1px solid var(--terminal-border);
    background: var(--terminal-elevated);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pagination-controls .btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pagination-controls .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.loading-state {
    padding: 1.5rem;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.empty-state .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    border: 1px solid var(--accent-primary);
    background: transparent;
    color: var(--accent-primary);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.empty-state .btn:hover {
    background: var(--accent-primary);
    color: #fff;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--terminal-border, #30363d);
    background: linear-gradient(180deg, var(--terminal-surface, #161b22) 0%, var(--terminal-bg, #0d1117) 100%);
    position: relative;
    overflow: hidden;
    min-height: 140px;
}

@keyframes chartPulse {
    0%, 100% { opacity: 0.15; }
    50% { opacity: 0.3; }
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.level-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.spinner-sm {
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.scenario {
    padding: 0.75rem;
    border-radius: 0.375rem;
    background: var(--bg-base);
}

.trade-plan-card {
    padding: 1rem;
    background: var(--bg-elevated);
    border-radius: 0.5rem;
}

.trade-plan-card p {
    margin: 0.75rem 0 0;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-primary);
}

.component-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-base);
    border-radius: 4px;
    overflow: hidden;
}

.direction-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.direction-badge.bullish {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid var(--success);
}

.direction-badge.bearish {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.direction-badge .direction-icon {
    font-size: 1rem;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.history-table th {
    padding: 0.5rem;
    text-align: left;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.history-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.delta.positive { color: var(--earnings-positive); }

.delta.negative { color: var(--earnings-negative); }

.move.positive { color: var(--earnings-positive); }

.move.negative { color: var(--earnings-negative); }

.na {
    color: var(--text-dim);
}

.percentile {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.25rem;
    border-radius: 3px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-weight: 600;
}

.summary-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.summary-stat .stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-stat .stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.summary-stat .stat-value.positive { color: var(--earnings-positive); }

.summary-stat .stat-value.negative { color: var(--earnings-negative); }

.no-data {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem;
}

@media (max-width: 1400px) {
    .regime-badge i {
        display: none;
    }
}

@media (max-width: 992px) {
    .company-name {
        display: none;
    }
}

@media (max-width: 768px) {
    .search-container input {
        width: 140px;
    }
}

@media (max-width: 576px) {
    .company-logo,
    .logo-placeholder,
    .logo-fallback {
        width: 18px;
        height: 18px;
    }
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.upgrade-icon {
    margin-bottom: 1rem;
}

.upgrade-icon i {
    font-size: 3rem;
    color: var(--accent-warning);
    opacity: 0.8;
}

.gauge-track {
    position: relative;
    flex: 1;
    height: 6px;
    background: linear-gradient(to right,
        #f85149 0%,
        rgba(248, 81, 73, 0.5) 25%,
        #21262d 45%,
        #21262d 55%,
        rgba(63, 185, 80, 0.5) 75%,
        #3fb950 100%
    );
    border-radius: 3px;
}

.gauge-labels {
    display: none;
}

.pick-card {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--terminal-card);
    border-radius: 8px;
    border: 1px solid var(--terminal-border-subtle);
    cursor: pointer;
    transition: all 0.2s ease;
}

.pick-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.pick-card.bull-pick {
    border-left: 3px solid var(--market-bull);
}

.pick-card.bull-pick:hover {
    background: var(--market-bull-soft);
    border-color: var(--market-bull);
}

.pick-card.bear-pick {
    border-left: 3px solid var(--market-bear);
}

.pick-card.bear-pick:hover {
    background: var(--market-bear-soft);
    border-color: var(--market-bear);
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 5px rgba(251, 191, 36, 0.3); }
    50% { box-shadow: 0 0 15px rgba(251, 191, 36, 0.5); }
}

.pick-card.agreement {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.05);
}

.pick-card.bull-pick.agreement {
    border-left-color: var(--market-bull);
    border-right: 2px solid rgba(139, 92, 246, 0.3);
}

.pick-card.bear-pick.agreement {
    border-left-color: var(--market-bear);
    border-right: 2px solid rgba(139, 92, 246, 0.3);
}

.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.25rem;
    cursor: help;
}

.grade-badge.grade-a {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.25), rgba(245, 158, 11, 0.35));
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.5);
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.3);
}

.grade-badge.grade-b {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2), rgba(59, 130, 246, 0.3));
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.4);
}

.grade-badge.grade-c {
    background: rgba(156, 163, 175, 0.15);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

.picks-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@keyframes bsc-glow {
    0%, 100% { box-shadow: 0 0 12px rgba(16, 185, 129, 0.12); }
    50% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.28); }
}

@media (max-width: 500px) {
    .picks-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
