/*
==============================================
PROFESSIONAL SECTORS PAGE STYLES
Enhanced with refined design elements
==============================================
*/

/* Page Header */
.page-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: white;
    padding: 3.5rem 0 3rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.page-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

.page-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.875rem;
    position: relative;
    z-index: 1;
    letter-spacing: -0.025em;
}

.page-header p {
    font-size: 1.0625rem;
    opacity: 0.9;
    margin-bottom: 0;
    position: relative;
    z-index: 1;
    font-weight: 400;
}

/* Sector Navigation */
.sectors-overview {
    background: #f8fafc;
    padding: 2.25rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.sector-nav {
    display: flex;
    gap: 0.875rem;
    overflow-x: auto;
    padding-bottom: 0.75rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

.sector-nav::-webkit-scrollbar {
    height: 6px;
}

.sector-nav::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.sector-nav::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.sector-nav::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.sector-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    padding: 1.125rem 1.25rem;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    min-width: 145px;
    text-decoration: none;
    color: #475569;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.sector-nav-item:hover {
    border-color: #3b82f6;
    background: #f0f9ff;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.sector-nav-item.active {
    border-color: #2563eb;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.sector-icon {
    font-size: 1.875rem;
    line-height: 1;
}

.sector-nav-item span {
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
    letter-spacing: 0.01em;
}

/* Sector Content */
.sector-content {
    padding: 3rem 0;
    min-height: 60vh;
}

/* Sector Overview Grid */
.sector-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.75rem;
    margin-top: 2rem;
}

.sector-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sector-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-5px);
}

.sector-card a {
    display: block;
    padding: 1.75rem 1.75rem 2rem;
    text-decoration: none;
    color: inherit;
}

.sector-card-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1;
}

.sector-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.75rem;
    letter-spacing: -0.015em;
}

.sector-quarter-badge {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 0.375rem 0.875rem;
    border-radius: 14px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    letter-spacing: 0.01em;
}

.sector-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.sector-metric {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: #f8fafc;
    border-radius: 7px;
    border: 1px solid #f1f5f9;
    transition: all 0.2s ease;
    min-height: 72px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sector-metric .metric-value {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.3125rem;
    letter-spacing: -0.02em;
}

.sector-metric .metric-label {
    display: block;
    font-size: 0.6875rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    line-height: 1.3;
}

.sector-stats-wrapper {
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.stats-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

.sector-stats {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.stat-item {
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.5rem 0.625rem;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 60px;
    max-width: 75px;
}

.stat-item.beat {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #86efac;
}

.stat-item.met {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #fcd34d;
}

.stat-item.missed {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #fca5a5;
}

.stat-item:hover {
    transform: scale(1.05);
}

.stat-icon {
    font-size: 1.125rem;
    line-height: 1;
}

.stat-value {
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

/* Sector Detail Header */
.sector-detail-header {
    text-align: center;
    margin-bottom: 2.5rem;
    padding: 2.5rem 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 16px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sector-detail-icon {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    line-height: 1;
}

.sector-detail-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.625rem;
    letter-spacing: -0.02em;
}

.sector-detail-subtitle {
    font-size: 0.9375rem;
    color: #64748b;
    margin: 0;
    font-weight: 400;
}

/* Filters Bar */
.sector-filters-bar {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
}

.quarter-selector,
.exchange-selector {
    flex: 1;
    min-width: 210px;
}

.quarter-selector label,
.exchange-selector label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #475569;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
}

.quarter-select-dropdown,
.exchange-select-dropdown {
    width: 100%;
    padding: 0.8125rem 1rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    color: #0f172a;
    background: white;
    transition: all 0.2s ease;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.quarter-select-dropdown:hover,
.exchange-select-dropdown:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.quarter-select-dropdown:focus,
.exchange-select-dropdown:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* Sector Summary */
.sector-summary {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 2.25rem 2rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.sector-summary h3 {
    font-size: 1.375rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 1.75rem;
    letter-spacing: -0.015em;
}

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
}

.summary-metric {
    text-align: center;
    padding: 1.25rem 0.875rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e5e7eb;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.summary-metric:hover {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    border-color: #bfdbfe;
}

.summary-metric .metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.summary-metric .metric-value.positive {
    color: #059669;
}

.summary-metric .metric-value.negative {
    color: #dc2626;
}

.summary-metric .metric-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    letter-spacing: 0.01em;
    line-height: 1.4;
}

/* Company Earnings List */
.company-earnings-list {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 2.25rem 2rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.company-earnings-list h3 {
    font-size: 1.1875rem;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.015em;
}

.download-report-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white !important;
    padding: 0.8125rem 1.625rem;
    border-radius: 8px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    letter-spacing: 0.01em;
}

.download-report-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* Earnings Table */
.company-earnings-table {
    margin-top: 1.75rem;
}

.earnings-table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 1.5fr 1fr 1fr;
    gap: 1rem;
    padding: 1.125rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 0.625rem;
    border: 1px solid #e5e7eb;
}

.earnings-table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1.5fr 1.5fr 1fr 1fr;
    gap: 1rem;
    padding: 1.375rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    align-items: center;
}

.earnings-table-row:hover {
    background: linear-gradient(135deg, #fafbfc 0%, #f8fafc 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.col-company .company-name {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.3125rem;
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
}

.col-company .company-ticker {
    font-size: 0.8125rem;
    color: #64748b;
    font-weight: 500;
}

.col-reported {
    font-size: 0.875rem;
    color: #475569;
    font-weight: 500;
}

.col-revenue .value,
.col-eps .value {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.3125rem;
    font-size: 0.9375rem;
}

.col-revenue .change,
.col-eps .change {
    font-size: 0.8125rem;
    font-weight: 600;
}

.change.positive,
.surprise-value.positive,
.price-change.positive {
    color: #059669;
}

.change.negative,
.surprise-value.negative,
.price-change.negative {
    color: #dc2626;
}

.col-surprise,
.col-reaction {
    font-weight: 600;
    font-size: 0.9375rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.875rem;
    margin-top: 2.25rem;
    padding-top: 2.25rem;
    border-top: 1px solid #e5e7eb;
}

.pagination-btn {
    padding: 0.6875rem 1.375rem;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pagination-btn:hover:not(:disabled) {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-pages {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.page-num,
.page-active {
    padding: 0.5625rem 0.9375rem;
    border-radius: 7px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-num {
    color: #475569;
}

.page-num:hover {
    background: #eff6ff;
    color: #3b82f6;
}

.page-active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.page-ellipsis {
    color: #94a3b8;
    padding: 0 0.375rem;
    font-weight: 600;
}

/* Sector Insights */
.sector-insights {
    margin-top: 3.5rem;
}

.sector-insights h3 {
    font-size: 1.4375rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.015em;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 1.5rem;
}

.insight-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 2rem 1.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.insight-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.1);
    transform: translateY(-3px);
}

.insight-card h4 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.875rem;
    letter-spacing: -0.01em;
}

.insight-card p {
    font-size: 0.9375rem;
    color: #64748b;
    line-height: 1.65;
    margin: 0;
}

/* Related Content */
.related-content {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 3.5rem 0;
    border-top: 1px solid #e5e7eb;
}

.related-content h3 {
    font-size: 1.4375rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 2.25rem;
    text-align: center;
    letter-spacing: -0.015em;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 1.75rem;
}

.related-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 2.25rem 2rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.related-card:hover {
    border-color: #93c5fd;
    transform: translateY(-5px);
    box-shadow: 0 10px 24px rgba(59, 130, 246, 0.12);
}

.related-icon {
    font-size: 2.75rem;
    margin-bottom: 1.125rem;
    line-height: 1;
}

.related-card h4 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.875rem;
    letter-spacing: -0.01em;
}

.related-card p {
    font-size: 0.9375rem;
    color: #64748b;
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9375rem;
}

.related-link:hover {
    color: #2563eb;
    gap: 0.625rem;
}

.related-link::after {
    content: '→';
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.related-link:hover::after {
    transform: translateX(2px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.75rem;
    }

    .sector-overview-grid {
        grid-template-columns: 1fr;
    }

    .earnings-table-header,
    .earnings-table-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .earnings-table-header {
        display: none;
    }

    .earnings-table-row {
        padding: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        margin-bottom: 0.75rem;
    }

    .earnings-table-row > div {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .earnings-table-row > div::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        font-size: 0.8125rem;
        text-transform: uppercase;
    }

    .summary-metrics {
        grid-template-columns: repeat(2, 1fr);
    }

    .sector-metrics {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .sector-filters-bar {
        flex-direction: column;
    }

    .pagination {
        flex-wrap: wrap;
    }
}

/* Loading State */
.company-earnings-list.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.company-earnings-list.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}
