/* ============================================================
   Earnings Review — Styles
   Dark theme by default; light theme overrides at bottom.
   ============================================================ */

/* ---- Container ---- */
.sfd-earnings-wrap {
    color: #c9d1d9;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* ---- Navigation bar ---- */
.sfd-earnings-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
}

.sfd-earnings-quarter-picker,
.sfd-earnings-compare-picker {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.sfd-earnings-nav label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #8b949e;
    font-size: 13px;
}

.sfd-earnings-nav select {
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
}

.sfd-earnings-vs {
    color: #8b949e;
    font-size: 13px;
    font-weight: 600;
}

/* ---- Buttons ---- */
.sfd-btn-primary {
    background: #238636;
    color: #fff;
    border: 1px solid #2ea043;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.sfd-btn-primary:hover { background: #2ea043; }

.sfd-btn-secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}
.sfd-btn-secondary:hover { background: #30363d; }

/* ---- Partial-data status banner ---- */
.sfd-earnings-status-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(210, 153, 34, 0.12);
    border: 1px solid rgba(210, 153, 34, 0.4);
    border-radius: 6px;
    color: #d29922;
    font-size: 13px;
    line-height: 1.5;
}
.sfd-earnings-status-icon { font-style: normal; font-size: 15px; }
.sfd-earnings-sec-link { color: #388bfd; text-decoration: none; white-space: nowrap; }
.sfd-earnings-sec-link:hover { text-decoration: underline; }

/* ---- Raw press release text ---- */
.sfd-earnings-raw-text {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 12px;
    color: #8b949e;
    line-height: 1.6;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
}

/* ---- Loading / status states ---- */
.sfd-earnings-loading,
.sfd-earnings-not-available,
.sfd-earnings-error {
    padding: 24px 0;
    text-align: center;
    color: #8b949e;
    font-style: italic;
}
.sfd-earnings-error { color: #f85149; }

/* ---- Sections ---- */
.sfd-earnings-section {
    margin-bottom: 28px;
    border: 1px solid #30363d;
    border-radius: 6px;
    overflow: hidden;
}

.sfd-earnings-section-title {
    margin: 0;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8b949e;
    background: #161b22;
    border-bottom: 1px solid #30363d;
}

.sfd-earnings-section-body {
    padding: 12px 16px;
    background: #0d1117;
}

/* ---- Tables ---- */
.sfd-earnings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.sfd-earnings-table th,
.sfd-earnings-table td {
    padding: 6px 10px;
    text-align: left;
    border-bottom: 1px solid #21262d;
}

.sfd-earnings-table th {
    color: #8b949e;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #161b22;
}

.sfd-earnings-table tbody tr:last-child td { border-bottom: none; }
.sfd-earnings-table tbody tr:hover td { background: #161b22; }

/* Guidance table — capped width, content wraps */
.sfd-guidance-table {
    max-width: 560px;
    table-layout: fixed;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.sfd-guidance-table .sfd-em-value {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Guidance table — narrow label column, value takes remaining width */
.sfd-guidance-table .sfd-em-label {
    width: 90px;
    min-width: 70px;
    max-width: 90px;
    white-space: normal;
    word-break: break-word;
    vertical-align: top;
}

/* Financial summary table — compact, left-aligned, not full width */
.sfd-financial-table {
    width: auto !important;
    min-width: 360px;
    max-width: 560px;
}

.sfd-em-label { color: #8b949e; width: 150px; white-space: nowrap; }
.sfd-em-value { color: #c9d1d9; font-weight: 600; width: 110px; }
.sfd-em-yoy   { width: 110px; white-space: nowrap; }
.sfd-em-beat  { width: 80px;  white-space: nowrap; }

/* ---- Badges ---- */
.sfd-earnings-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.sfd-badge-positive { background: rgba(35, 134, 54, 0.2); color: #3fb950; }
.sfd-badge-negative { background: rgba(248, 81, 73, 0.2); color: #f85149; }
.sfd-badge-beat     { background: rgba(35, 134, 54, 0.25); color: #56d364; border: 1px solid #2ea043; }
.sfd-badge-miss     { background: rgba(248, 81, 73, 0.25); color: #f85149; border: 1px solid #da3633; }

/* ---- Dynamic sections (key points / transcript) ---- */
.sfd-earnings-dynamic-section { margin-bottom: 16px; }
.sfd-earnings-dynamic-section:last-child { margin-bottom: 0; }

.sfd-earnings-subheading {
    font-size: 13px;
    font-weight: 600;
    color: #c9d1d9;
    margin: 0 0 8px 0;
}

.sfd-earnings-points {
    margin: 0;
    padding-left: 20px;
    color: #8b949e;
}
.sfd-earnings-points li {
    margin-bottom: 4px;
    line-height: 1.5;
}

/* ---- Stock Reaction ---- */
.sfd-earnings-stock-reaction {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 700;
    padding: 8px 0;
}
.sfd-reaction-label { color: #8b949e; font-size: 13px; font-weight: 400; }
.sfd-reaction-up   { color: #3fb950; }
.sfd-reaction-down { color: #f85149; }

/* ---- My Notes ---- */
.sfd-earnings-notes-wrap { }

.sfd-earnings-notes-textarea {
    width: 100%;
    min-height: 80px;
    background: #161b22;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 10px;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 13px;
    resize: vertical;
    box-sizing: border-box;
}
.sfd-earnings-notes-textarea:focus {
    outline: none;
    border-color: #388bfd;
}

.sfd-earnings-notes-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}
.sfd-earnings-notes-status {
    font-size: 12px;
    color: #8b949e;
}

/* ---- Comparison layout ---- */
.sfd-earnings-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.sfd-earnings-col-label {
    font-size: 14px;
    font-weight: 700;
    color: #c9d1d9;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #30363d;
}

@media (max-width: 768px) {
    .sfd-earnings-compare-grid { grid-template-columns: 1fr; }
}

/* ---- Standalone shortcode ticker selector ---- */
.sfd-earnings-ticker-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
}
.sfd-earnings-ticker-selector input {
    background: #0d1117;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    width: 200px;
}

/* ============================================================
   Comparison layout — section-aligned two-column grid
   ============================================================ */
.sfd-earnings-compare-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sfd-compare-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 4px;
    align-items: start;
}

.sfd-compare-header {
    margin-bottom: 8px;
}

.sfd-compare-cell {
    min-width: 0; /* prevent grid blowout */
}

.sfd-compare-cell .sfd-earnings-review {
    /* strip the outer wrapper padding when inside a compare cell */
    padding: 0;
}

.sfd-earnings-col-label {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: #58a6ff;
    border-bottom: 2px solid #58a6ff;
    padding-bottom: 4px;
}

/* Go button */
.sfd-earnings-compare-go {
    margin-left: 8px;
    white-space: nowrap;
}

/* ---- Capital Allocation pivot table ---- */
.sfd-capalloc-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.sfd-capalloc-table {
    width: auto !important;
    min-width: 100%;
    white-space: nowrap;
}

.sfd-capalloc-label {
    color: #8b949e;
    font-weight: 600;
    width: 110px;
    min-width: 110px;
    position: sticky;
    left: 0;
    background: #0d1117;
    z-index: 1;
}

.sfd-capalloc-qhdr {
    text-align: center;
    min-width: 90px;
    font-size: 11px;
    color: #8b949e;
    text-transform: none;
    letter-spacing: 0;
}

.sfd-capalloc-val {
    text-align: center;
    font-size: 13px;
    color: #c9d1d9;
}

html[data-theme="light"] .sfd-capalloc-label {
    background: #fff;
    color: #57606a;
}
html[data-theme="light"] .sfd-capalloc-val { color: #24292f; }

/* ============================================================
   Light theme overrides
   ============================================================ */
html[data-theme="light"] .sfd-earnings-wrap { color: #24292f; }
html[data-theme="light"] .sfd-earnings-col-label { color: #0969da; border-color: #0969da; }
html[data-theme="light"] .sfd-earnings-nav  { background: #f6f8fa; border-color: #d0d7de; }
html[data-theme="light"] .sfd-earnings-nav label { color: #57606a; }
html[data-theme="light"] .sfd-earnings-nav select { background: #fff; color: #24292f; border-color: #d0d7de; }

html[data-theme="light"] .sfd-earnings-section { border-color: #d0d7de; }
html[data-theme="light"] .sfd-earnings-section-title { background: #f6f8fa; border-color: #d0d7de; color: #57606a; }
html[data-theme="light"] .sfd-earnings-section-body  { background: #fff; }

html[data-theme="light"] .sfd-earnings-table th { background: #f6f8fa; color: #57606a; }
html[data-theme="light"] .sfd-earnings-table th,
html[data-theme="light"] .sfd-earnings-table td { border-color: #eaecef; }
html[data-theme="light"] .sfd-earnings-table tbody tr:hover td { background: #f6f8fa; }
html[data-theme="light"] .sfd-em-label   { color: #57606a; }
html[data-theme="light"] .sfd-em-value   { color: #24292f; }

html[data-theme="light"] .sfd-earnings-subheading { color: #24292f; }
html[data-theme="light"] .sfd-earnings-points     { color: #57606a; }
html[data-theme="light"] .sfd-earnings-loading,
html[data-theme="light"] .sfd-earnings-not-available { color: #57606a; }

html[data-theme="light"] .sfd-earnings-notes-textarea {
    background: #f6f8fa; color: #24292f; border-color: #d0d7de;
}
html[data-theme="light"] .sfd-earnings-col-label { color: #24292f; border-color: #d0d7de; }

html[data-theme="light"] .sfd-btn-secondary { background: #f6f8fa; color: #24292f; border-color: #d0d7de; }
html[data-theme="light"] .sfd-btn-secondary:hover { background: #eaecef; }
html[data-theme="light"] .sfd-earnings-ticker-selector input { background: #fff; color: #24292f; border-color: #d0d7de; }
