/**
 * Earnings Calendar Module Styles
 */

/* ==========================================
   SECTION WRAPPER
   ========================================== */
.earnings-calendar-section {
    margin-bottom: var(--spacing-2xl);
}

.ec-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.ec-controls {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

/* ==========================================
   SUMMARY CARDS
   ========================================== */
.ec-summary-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.ec-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    text-align: center;
}

.ec-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-xs);
}

.ec-stat-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ec-stat-value.positive { color: var(--status-positive); }
.ec-stat-value.negative { color: var(--status-negative); }

.ec-stat-detail {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================
   CALENDAR NAVIGATION
   ========================================== */
.ec-cal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.ec-cal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ec-cal-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.ec-cal-nav-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.ec-cal-nav-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

/* ==========================================
   MONTHLY CALENDAR GRID
   ========================================== */
.ec-calendar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
}

.ec-day-header {
    background: var(--bg-tertiary);
    padding: 6px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.ec-day-cell {
    background: var(--bg-card);
    padding: 6px;
    min-height: 70px;
    position: relative;
}

.ec-day-cell.today {
    background: var(--bg-card-hover);
    box-shadow: inset 0 0 0 2px var(--color-primary);
}

.ec-day-cell.outside {
    background: var(--bg-primary);
    opacity: 0.4;
}

.ec-day-number {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    font-weight: 500;
}

.ec-day-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}

.ec-ticker-badge {
    font-size: 0.6rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    padding: 1px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    white-space: nowrap;
}

.ec-ticker-badge:hover {
    filter: brightness(1.3);
    transform: scale(1.05);
}

.ec-ticker-badge.has-actual {
    border-bottom: 2px solid rgba(255,255,255,0.3);
}

/* ==========================================
   WEEKLY VIEW
   ========================================== */
.ec-week-view {
    margin-bottom: var(--spacing-lg);
}

.ec-week-row {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    padding: var(--spacing-sm) 0;
    gap: var(--spacing-md);
    align-items: flex-start;
}

.ec-week-row:last-child {
    border-bottom: none;
}

.ec-week-date {
    width: 100px;
    flex-shrink: 0;
    font-size: 0.8rem;
    color: var(--text-muted);
    padding-top: 2px;
}

.ec-week-date.today {
    color: var(--color-primary);
    font-weight: 600;
}

.ec-week-stocks {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ec-week-stock {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.75rem;
    padding: 3px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s ease;
}

.ec-week-stock:hover {
    background: var(--bg-tertiary);
}

.ec-week-ticker {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    min-width: 50px;
}

.ec-week-company {
    color: var(--text-secondary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ec-week-est {
    color: var(--text-muted);
    white-space: nowrap;
}

.ec-week-actual {
    font-weight: 500;
    white-space: nowrap;
}

.ec-week-actual.beat { color: var(--status-positive); }
.ec-week-actual.miss { color: var(--status-negative); }

.ec-week-empty {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-style: italic;
    padding: 3px 6px;
}

/* ==========================================
   HISTORICAL REACTIONS TABLE
   ========================================== */
.ec-hist-container {
    margin-top: var(--spacing-lg);
}

.ec-hist-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.ec-hist-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.ec-hist-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.ec-hist-table thead th {
    text-align: left;
    padding: 8px 10px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.7rem;
    border-bottom: 2px solid var(--border-color);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.ec-hist-table thead th:hover {
    color: var(--text-primary);
}

.ec-hist-table thead th.sort-asc::after { content: ' \u25B2'; font-size: 0.6rem; }
.ec-hist-table thead th.sort-desc::after { content: ' \u25BC'; font-size: 0.6rem; }

.ec-hist-table thead th.numeric {
    text-align: right;
}

.ec-hist-table tbody tr {
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    cursor: pointer;
    transition: background 0.15s ease;
}

.ec-hist-table tbody tr:hover {
    background: var(--bg-card-hover);
}

.ec-hist-table td {
    padding: 7px 10px;
    color: var(--text-secondary);
}

.ec-hist-table td.numeric {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
}

.ec-hist-table .ec-ticker-col {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

/* Heat map cells for T+1/T+5 */
.ec-hist-table td.ec-heat-pos-1 { background: rgba(34, 197, 94, 0.08); color: var(--status-positive); }
.ec-hist-table td.ec-heat-pos-2 { background: rgba(34, 197, 94, 0.15); color: var(--status-positive); }
.ec-hist-table td.ec-heat-pos-3 { background: rgba(34, 197, 94, 0.25); color: var(--status-positive); }
.ec-hist-table td.ec-heat-neg-1 { background: rgba(239, 68, 68, 0.08); color: var(--status-negative); }
.ec-hist-table td.ec-heat-neg-2 { background: rgba(239, 68, 68, 0.15); color: var(--status-negative); }
.ec-hist-table td.ec-heat-neg-3 { background: rgba(239, 68, 68, 0.25); color: var(--status-negative); }

.ec-surprise-beat { color: var(--status-positive); font-weight: 500; }
.ec-surprise-miss { color: var(--status-negative); font-weight: 500; }

/* Loading state */
.ec-loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.ec-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: ec-spin 0.8s linear infinite;
    margin-right: var(--spacing-sm);
    vertical-align: middle;
}

@keyframes ec-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================
   TOOLTIP
   ========================================== */
.ec-tooltip {
    position: fixed;
    z-index: 10000;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.75rem;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: none;
    max-width: 250px;
}

.ec-tooltip-ticker {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}

.ec-tooltip-company {
    color: var(--text-secondary);
    margin-top: 2px;
}

.ec-tooltip-data {
    margin-top: 4px;
    color: var(--text-muted);
}

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 900px) {
    .ec-summary-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 600px) {
    .ec-summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .ec-calendar-grid {
        font-size: 0.65rem;
    }
    .ec-day-cell {
        min-height: 50px;
        padding: 4px;
    }
}
