/* Earnings Calendar Styles */

:root {
    --primary-color: #3b82f6;
    --secondary-color: #667eea;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', sans-serif;
    background-color: #fafafa;
    color: var(--text-primary);
}

#app-container {
    padding: 2rem 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Calendar Header */
.calendar-header {
    margin-bottom: 1.5rem;
}

.calendar-title {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
    font-weight: 400;
}

.calendar-subtitle {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.9rem;
}

/* Navigation Controls */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#date-range {
    color: #374151;
    padding: 0.5rem 0;
    margin-right: 0.5rem;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 2rem;
}

.day-column {
    background: var(--bg-white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.day-header {
    background: #f8fafc;
    color: #64748b;
    padding: 12px;
    text-align: center;
    margin-bottom: 0;
    font-weight: 500;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.day-header.today {
    background: var(--primary-color);
    color: white;
}

.day-name {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.day-header.today .day-name {
    color: rgba(255,255,255,0.9);
}

.day-number {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
    color: #1f2937;
}

.day-header.today .day-number {
    color: white;
}

.earnings-container {
    padding: 12px;
    min-height: 200px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    align-content: start;
}

.loading-skeleton {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #9ca3af;
    font-size: 14px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Earnings Card */
.earnings-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 8px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    height: 110px;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: 0;
}

.earnings-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.12);
    border-color: #cbd5e1;
}

.earnings-card img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    margin-bottom: 8px;
}

.earnings-card .ticker {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    letter-spacing: 0.02em;
}

.no-earnings {
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 14px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px dashed #e5e7eb;
    font-weight: 500;
}

/* Company Details View */
#company-header {
    padding: 20px 0;
}

.company-title {
    display: block;
    font-size: 2.25rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-align: center;
}

.stock-badge {
    background: #d4edda;
    color: #155724;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
    letter-spacing: 0.5px;
}

.company-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 15px auto;
    display: block;
}

/* Price Display */
#price-display {
    display: flex;
    justify-content: center;
    align-items: stretch;
    gap: 0;
    background: white;
    padding: 30px 60px;
    border-radius: 0;
    border: 1px solid #e5e7eb;
    border-left: none;
    border-right: none;
    max-width: 100%;
    margin: 0 auto 30px;
}

.price-section {
    text-align: center;
    padding: 0 50px;
    flex: 1;
}

.price-section:first-child {
    border-right: 1px solid #e5e7eb;
}

.price-value {
    margin: 0 0 10px 0;
    font-size: 3.5rem;
    color: #374151;
    font-weight: 600;
    line-height: 1;
}

.price-change {
    margin: 0 0 8px 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.price-change.positive {
    color: #10b981;
}

.price-change.negative {
    color: #ef4444;
}

.price-status {
    margin: 0;
    color: #6b7280;
    font-size: 13px;
    font-weight: 400;
}

.premarket-icon {
    display: inline-block;
    margin-right: 4px;
}

/* Tabs */
.details-tabs {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 14px 28px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

.tab-btn:hover {
    background: #fef3c7;
    border-color: #fbbf24;
}

.tab-btn.active {
    background: #fbbf24;
    color: white;
    border-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(251, 191, 36, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Upcoming Earnings Card */
.upcoming-earnings-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 28px;
    margin: 24px 0;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    color: white;
    max-width: 480px;
}

.upcoming-earnings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.upcoming-earnings-header h3 {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.days-badge {
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.upcoming-earnings-date {
    margin: 0 0 24px 0;
    opacity: 0.9;
    font-size: 16px;
}

.earnings-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.metric-box {
    background: rgba(255,255,255,0.15);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.metric-label {
    font-size: 14px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.metric-value {
    font-size: 20px;
    font-weight: 700;
}

/* Historical Earnings */
.quarter-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.quarter-section h3 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.performance-badges {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.metric-item {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 6px;
}

.metric-item label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 500;
}

.metric-item .value {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-item .delta {
    font-size: 14px;
    margin-top: 5px;
}

.metric-item .delta.positive {
    color: var(--success-color);
}

.metric-item .delta.negative {
    color: var(--danger-color);
}

/* New Section 2 Styles */
.quarter-section-new {
    background: white;
    padding: 30px;
    border-radius: 8px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.quarter-title {
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.quarter-date {
    color: var(--text-primary);
    font-size: 14px;
    margin-bottom: 25px;
}

.earnings-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

.earnings-column {
    display: flex;
    flex-direction: column;
}

.beat-badge {
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 15px;
    margin-bottom: 20px;
    text-align: left;
}

.beat-success {
    background-color: #d1f4e0;
    color: #0f5132;
}

.beat-danger {
    background-color: #f8d7da;
    color: #842029;
}

.earnings-data {
    display: flex;
    flex-direction: column;
}

.data-label {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.data-value {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 400;
    margin-bottom: 5px;
}

.data-value-large {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 8px;
}

.data-change {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
}

.data-change.positive {
    color: var(--success-color);
}

.data-change.negative {
    color: var(--danger-color);
}

.data-change .arrow {
    font-size: 14px;
}

/* Responsive adjustments for new Section 2 */
@media (max-width: 768px) {
    .earnings-columns {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Chart Container */
.chart-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border: 1px solid var(--border-color);
}

/* AI Summary */
.ai-summary-content {
    font-family: sans-serif;
    font-size: 17px;
    text-align: justify;
    text-indent: 36px;
    line-height: 29px;
    color: inherit;
    background: white;
    padding: 30px;
    border-radius: 8px;
    margin: 20px 0;
}

.ai-summary-content h2 {
    font-size: 1.75rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    padding: 0;
}

.ai-summary-content ul, .ai-summary-content ol {
    margin: 15px 0;
    padding-left: 40px;
}

.ai-summary-content li {
    margin: 10px 0;
}

/* Raw Transcript */
.transcript-container {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    max-height: 600px;
    overflow-y: auto;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #212529;
    white-space: pre-wrap;
}

/* Expandable Section */
.expandable-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
    overflow: hidden;
}

.expandable-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-light);
    transition: background 0.3s;
}

.expandable-header:hover {
    background: #e5e7eb;
}

.expandable-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.expandable-icon {
    transition: transform 0.3s;
}

.expandable-icon.open {
    transform: rotate(180deg);
}

.expandable-content {
    padding: 20px;
    display: none;
}

.expandable-content.open {
    display: block;
}

/* Responsive Design */
@media (max-width: 992px) {
    .calendar-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .details-tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    #price-display {
        flex-direction: column;
        gap: 20px;
    }
}

@media (max-width: 576px) {
    .calendar-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== AI SUMMARY STYLES ==================== */

.ai-summary-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.ai-summary-content h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-color);
}

.ai-summary-content h4 {
    color: var(--primary-color);
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.summary-text {
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 1rem;
}

.summary-text p {
    margin-bottom: 1rem;
    text-align: justify;
}

.summary-text b {
    color: var(--text-primary);
    font-weight: 600;
}

/* Historical Earnings Section */
#historical-earnings-section {
    margin-top: 2rem;
}

#historical-earnings-section h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#historical-earnings-section h4 {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

#historical-quarters-list .card {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: all 0.3s ease;
}

#historical-quarters-list .card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-color);
}

#historical-quarters-list .card-header {
    background-color: var(--bg-light);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
}

#historical-quarters-list .btn-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 1rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

#historical-quarters-list .btn-link:hover {
    color: var(--primary-color);
}

#historical-quarters-list .card-body {
    padding: 1.5rem;
}

/* Loading States */
.spinner-border {
    width: 2rem;
    height: 2rem;
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15rem;
}

/* Alert Styles */
.alert {
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}

.alert-danger {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.alert-info {
    background-color: #eff6ff;
    border-color: #bfdbfe;
    color: #1e40af;
}

.alert-heading {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Responsive adjustments for AI summary */
@media (max-width: 768px) {
    .ai-summary-content {
        padding: 1.5rem;
    }

    .ai-summary-content h3 {
        font-size: 1.25rem;
    }

    .ai-summary-content h4 {
        font-size: 1.1rem;
    }

    .summary-text {
        font-size: 0.95rem;
    }
}
