/* ============================================================================
   Company Dashboard — company-dashboard.css
   
   All colors derived from the existing FinancialAnalysis site palette:
     Sidebar gradient start:  #052767 (rgb 5,39,103)
     Primary action:          #1b6ec2 (btn-primary)
     Link color:              #006bb7
     Top bar background:      #f7f7f7
     Top bar border:          #d6d5d5
     Bootstrap success:       #28a745
     Bootstrap danger:        #dc3545
   
   See Design Document Section 5 for rationale.
   ============================================================================ */

/* ---------------------------------------------------------------------------
   Zone A — Search Bar
   --------------------------------------------------------------------------- */
.cd-search-wrapper {
    position: relative;
    max-width: 600px;
    margin-bottom: 1.25rem;
}

.cd-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
    border: 1px solid #d6d5d5;
    border-radius: 4px;
    outline: none;
    font-family: 'Helvetica Neue', Arial, sans-serif;
}

.cd-search-input:focus {
    border-color: #1b6ec2;
    box-shadow: 0 0 0 2px rgba(27, 110, 194, 0.2);
}

.cd-search-input::placeholder {
    color: #999;
}

.cd-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #ffffff;
    border: 1px solid #d6d5d5;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.cd-autocomplete-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.cd-autocomplete-item:last-child {
    border-bottom: none;
}

.cd-autocomplete-item:hover,
.cd-autocomplete-item.active {
    background-color: #e8eef4;
}

.cd-autocomplete-item .cd-company-name {
    font-weight: 600;
    color: #333;
}

.cd-autocomplete-item .cd-company-meta {
    font-size: 0.8rem;
    color: #777;
    margin-top: 2px;
}

/* ---------------------------------------------------------------------------
   Zone B — Company Header Card
   --------------------------------------------------------------------------- */
.cd-header-card {
    border: 1px solid #d6d5d5;
    border-radius: 6px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.cd-header-card .card-body {
    padding: 1rem 1.25rem;
}

.cd-company-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #052767;
    margin: 0 0 0.25rem 0;
}

.cd-company-ticker {
    font-size: 0.95rem;
    color: #1b6ec2;
    font-weight: 600;
}

.cd-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem 1.5rem;
    margin-top: 0.75rem;
}

.cd-detail-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cd-detail-value {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

.cd-filing-summary {
    text-align: right;
}

.cd-filing-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: #052767;
}

.cd-filing-label {
    font-size: 0.8rem;
    color: #888;
}

/* ---------------------------------------------------------------------------
   Zone C — Price Strip
   --------------------------------------------------------------------------- */
.cd-price-strip {
    background: #f7f7f7;
    border: 1px solid #d6d5d5;
    border-radius: 6px;
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.cd-price-main {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.cd-price-change {
    font-size: 0.95rem;
    font-weight: 600;
}

.cd-price-change.positive {
    color: #28a745;
}

.cd-price-change.negative {
    color: #dc3545;
}

.cd-price-label {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cd-price-value {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

/* 52-week range bar */
.cd-range-bar-container {
    flex: 0 0 160px;
}

.cd-range-bar {
    height: 6px;
    background: #ddd;
    border-radius: 3px;
    position: relative;
    margin-top: 4px;
}

.cd-range-bar-fill {
    position: absolute;
    top: -3px;
    width: 12px;
    height: 12px;
    background: #1b6ec2;
    border-radius: 50%;
    transform: translateX(-50%);
}

.cd-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: #888;
    margin-top: 2px;
}

/* ---------------------------------------------------------------------------
   Zone D — Financial Tabs
   --------------------------------------------------------------------------- */
.cd-tabs .nav-tabs {
    border-bottom: 2px solid #d6d5d5;
}

.cd-tabs .nav-tabs .nav-link {
    color: #555;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}

.cd-tabs .nav-tabs .nav-link:hover {
    color: #006bb7;
    border-bottom-color: #006bb7;
}

.cd-tabs .nav-tabs .nav-link.active {
    color: #1b6ec2;
    font-weight: 600;
    border-bottom-color: #1b6ec2;
    background: transparent;
}

.cd-tab-content {
    padding-top: 1rem;
}

/* ---------------------------------------------------------------------------
   Financial Table
   --------------------------------------------------------------------------- */
.cd-fin-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.85rem;
}

.cd-fin-table thead th {
    background: #052767;
    color: #ffffff;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    text-align: right;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.cd-fin-table thead th:first-child {
    text-align: left;
    min-width: 220px;
}

.cd-fin-table tbody td {
    padding: 0.35rem 0.75rem;
    text-align: right;
    border-bottom: 1px solid #eee;
    white-space: nowrap;
}

.cd-fin-table tbody td:first-child {
    text-align: left;
    color: #333;
}

/* Alternating row stripes — same gray as top bar */
.cd-fin-table tbody tr:nth-child(even) {
    background: #f7f7f7;
}

/* Subtotal / highlight rows */
.cd-fin-table tbody tr.cd-subtotal td {
    background: #e8eef4;
    font-weight: 700;
}

/* Negative values in red */
.cd-fin-table .cd-negative {
    color: #dc3545;
}

/* Per-share and percentage rows — slightly muted */
.cd-fin-table .cd-secondary {
    color: #555;
    font-style: italic;
}

/* Estimate columns (future Phase 2) */
.cd-fin-table thead th.cd-estimate {
    background: #052767;
    font-style: italic;
}

.cd-fin-table tbody td.cd-estimate {
    background: #fefce8;
    font-style: italic;
}

/* ---------------------------------------------------------------------------
   Responsive: horizontal scroll with sticky label column
   --------------------------------------------------------------------------- */
.cd-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
    .cd-fin-table thead th:first-child,
    .cd-fin-table tbody td:first-child {
        position: sticky;
        left: 0;
        z-index: 1;
        background: inherit;
    }

    .cd-fin-table thead th:first-child {
        background: #052767;
    }

    .cd-price-strip {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .cd-range-bar-container {
        flex: 0 0 auto;
        width: 100%;
    }

    .cd-detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ---------------------------------------------------------------------------
   Loading / Empty States
   --------------------------------------------------------------------------- */
.cd-loading {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.cd-loading .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    color: #1b6ec2;
}

.cd-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
}

.cd-empty-state h3 {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.cd-error {
    color: #dc3545;
    padding: 1rem;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    background: #fff5f5;
    margin: 1rem 0;
}
