/* Analysis Tab Styles - Clean Version Without Upload Functionality */

/* Page Header */
.page-header-text {
    text-align: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.page-title-text {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

/* Analysis Content */
.analysis-content {
    max-width: 1600px; /* Match Insights tab width */
    margin: 0 auto;
    padding: 0 1rem;
    overflow: visible; /* Remove horizontal scroll, let page handle scrolling */
}

/* Product Tabs */
.product-tabs-wrapper {
    margin-bottom: 2rem;
    width: 100%;
    max-width: 1600px; /* Match Insights tab width */
    position: relative;
    z-index: 5;
}

.product-tab-nav {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    border-bottom: 2px solid #e5e7eb;
    width: 100%;
    max-width: 1600px; /* Match Insights tab width */
    position: relative;
    z-index: 6;
}

.product-tab-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2rem; /* Match Insights tab width */
    background: none;
    border: none;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
    margin-bottom: -1px;
    position: relative;
    min-width: 150px; /* Reduced for 4 tabs */
    z-index: 7;
    flex: 1;
    width: 25%; /* 4 tabs = 25% each */
}

.product-tab-btn:hover {
    background-color: #f3f4f6;
    color: #374151;
}

.product-tab-btn.active {
    background-color: #374151; /* darker header */
    color: #ffffff;
    border-bottom: 2px solid #374151;
    z-index: 8;
}

.italy-market-share-tabs .product-tab-nav {
    justify-content: flex-start;
}

.italy-market-share-tabs .product-tab-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    padding: 0.85rem 1.5rem;
}

.product-tab-btn .material-icons {
    font-size: 1.25rem;
}

/* Tab Content */
.product-tab-content {
    background: #fff;
    border-radius: 0 12px 12px 12px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #e5e7eb;
    min-height: 600px;
    overflow: hidden; /* Prevent overflow */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    margin-top: -2px;
    max-width: 1600px; /* Match Insights tab width */
    width: 100%;
}

.product-tab-panel {
    display: none; /* keep hidden when not active */
    padding: 2rem 3rem; /* Increased horizontal padding for centering */
    overflow: hidden; /* Prevent overflow */
    position: relative;
    max-width: 100%; /* Ensure content doesn't exceed panel width */
    margin: 0 auto; /* Center the panel content */
    text-align: center; /* Center text content */
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    box-sizing: border-box;
}

/* Override text alignment for chart headers */
.product-tab-panel .unified-chart-header {
    text-align: left !important; /* Force left alignment for chart headers */
}

/* Override text alignment for chart title and market info */
.product-tab-panel .unified-chart-title,
.product-tab-panel .unified-chart-title h3,
.product-tab-panel .unified-chart-title p {
    text-align: left !important; /* Force left alignment for all title elements */
}

/* Ensure table cells containing chart headers are left-aligned */
.chart-table-container td:has(.unified-chart-header) {
    text-align: left !important;
}

/* Alternative selector for browsers that don't support :has() */
.chart-table-container td .unified-chart-header {
    text-align: left !important;
}

/* Ensure Market Analysis section is left-aligned */
.general-comments-section {
    text-align: left !important;
}

.general-comments-title {
    text-align: left !important;
}

.general-comments-text {
    text-align: left !important;
    line-height: 1.6; /* Equidistant line spacing */
    margin: 0; /* Remove default margins for even spacing */
}

.general-comments-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.general-comments-list {
    margin: 0;
    padding-left: 20px;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
}

.general-comments-list li {
    margin-bottom: 6px;
}

.general-comments-list li:last-child {
    margin-bottom: 0;
}

/* Ensure table cells containing Market Analysis are left-aligned */
.chart-table-container td:has(.general-comments-section) {
    text-align: left !important;
}

.chart-table-container td .general-comments-section {
    text-align: left !important;
}

.product-tab-panel.active {
    display: block; /* only the active panel is shown */
    overflow: hidden; /* Prevent overflow */
    position: relative;
}

.tab-content-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.tab-content-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.tab-content-header p {
    margin: 0;
    font-size: 1rem;
    color: #666;
}

.tab-content-body {
    min-height: auto;
    overflow: visible;
    padding-bottom: 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center; /* Center content horizontally */
    margin: 0 auto; /* Center the content body */
    max-width: 100%; /* Ensure it doesn't exceed parent width */
}

/* Italy Market Outlook Header */
.italy-eu-header {
    width: 100%;
    text-align: left;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.italy-eu-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
}

.italy-eu-header p {
    font-size: 1rem;
    color: #6b7280;
    margin: 0;
}

.italy-market-outlook-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* CPA Chart Container for Category 2 */
.cpa-chart-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cpa-chart-container .chart-container-full {
    width: 100%;
    max-width: 100%;
    min-height: 420px;
    position: relative;
    padding: 1.5rem;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    box-sizing: border-box;
    overflow: hidden;
}

.cpa-chart-container .chart-container-full canvas {
    display: block;
    width: 100% !important;
    height: min(480px, 55vh) !important;
    max-height: 520px;
    border-radius: 12px;
}

.cpa-chart-container .chart-header {
    margin-bottom: 1rem;
    width: 100%;
}

.cpa-chart-container .time-filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.projection-legend {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 12px;
    color: #6b7280;
    margin-top: 0.25rem;
    margin-left: auto;
    align-items: flex-end;
    text-align: right;
}

.projection-legend span {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.line-indicator {
    display: inline-block;
    width: 28px;
    border-bottom: 2px solid #6b7280;
}

.line-indicator.solid {
    border-bottom-style: solid;
}

.line-indicator.dashed {
    border-bottom-style: dashed;
}

.line-indicator.dotted {
    border-bottom-style: dotted;
}

.market-share-pages {
    margin-top: 32px;
}

.share-page-toggle {
    display: inline-flex;
    gap: 8px;
    margin-bottom: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 4px;
    background: #f9fafb;
}

.share-toggle-btn {
    border: none;
    background: transparent;
    padding: 6px 16px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #4b5563;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.share-toggle-btn.active {
    background: #10b981;
    color: #ffffff;
}

.share-page {
    display: none;
}

.share-page.active {
    display: block;
}

.series-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    font-size: 12px;
    color: #374151;
}

.series-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.series-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

/* Italy Market Outlook Product Share overrides - Match UK style */
.italy-product-share-tabs .chart-container-full {
    width: 100%;
    max-width: 100%;
    padding: 20px;
    padding-bottom: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: visible;
    position: relative;
    min-height: 600px;
    max-height: 720px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.italy-product-share-tabs .chart-container-full canvas {
    width: 100% !important;
    max-width: 100%;
    display: block;
    margin: 16px 0;
    box-sizing: border-box;
    flex-shrink: 0;
    height: 420px !important;
    min-height: 420px;
    max-height: 450px;
}

.italy-product-share-tabs .chart-header {
    margin-bottom: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    flex-shrink: 0;
    display: block !important;
    visibility: visible !important;
}

.italy-product-share-tabs .chart-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
}

.italy-product-share-tabs .chart-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
    flex-shrink: 0;
    display: block !important;
    visibility: visible !important;
}

.italy-product-share-tabs .projection-legend {
    margin-left: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 0.35rem;
}

.italy-product-share-tabs .projection-legend span {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.italy-market-share-tabs .projection-legend {
    margin-left: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
    gap: 0.35rem;
}

.italy-market-share-tabs .projection-legend span {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.italy-product-share-tabs .time-filter-buttons {
    flex-wrap: wrap;
    width: auto;
    max-width: 100%;
}

.italy-product-share-tabs .chart-data-table {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.italy-product-share-tabs .chart-data-table-wrapper {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
}

/* Ensure segment buttons (Residential/Non-Residential) are visible */
#cpaChildFiltersTab2 {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.5rem;
}

#cpaChildFiltersTab2 .time-filter-btn {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: transparent;
    color: #10b981;
    cursor: pointer;
    transition: all 0.2s ease;
}

#cpaChildFiltersTab2 .time-filter-btn:hover {
    background: #f3f4f6;
}

#cpaChildFiltersTab2 .time-filter-btn.active {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

/* Chart wrapper for responsive fitting */
.chart-responsive-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* Responsive chart container - fits within tab boundaries */
.chart-table-container {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    margin: 0 auto 2rem auto; /* Center the container */
    box-shadow: none;
    overflow: hidden; /* Prevent overflow */
    position: relative;
    width: 100%;
    max-width: 100%; /* Ensure it doesn't exceed parent width */
    table-layout: fixed;
    display: table;
    box-sizing: border-box;
}

/* Ensure all contents within chart-table-container are responsive */
.chart-table-container * {
    max-width: 100%;
    box-sizing: border-box;
}

/* Chart row responsive behavior */
.chart-table-container .chart-row {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

/* Chart columns responsive behavior */
.chart-table-container .chart-empty-column,
.chart-table-container .category-column {
    flex: 1;
    min-width: 0; /* Allow shrinking */
    max-width: 100%;
    overflow: hidden;
}

/* Market table responsive behavior */
.chart-table-container .market-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    overflow: hidden;
}

.chart-table-container .market-table th,
.chart-table-container .market-table td {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* Allow text wrapping */
    word-wrap: break-word;
    line-height: 1.2; /* Tighter line spacing for wrapped text */
}

.unified-chart-header {
    display: flex;
    justify-content: flex-start; /* Left align content */
    align-items: flex-start; /* Align to top */
    margin-bottom: 2rem;
    text-align: left; /* Ensure text is left-aligned */
}

.unified-chart-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    text-align: left; /* Ensure title is left-aligned */
}

.unified-chart-title h3 {
    margin: 0 0 0.5rem 0; /* Add spacing between title and market info */
    text-align: left; /* Ensure h3 is left-aligned */
}

.unified-chart-title p {
    margin: 0; /* Remove default margin */
    text-align: left; /* Ensure paragraph is left-aligned */
    font-size: 1rem;
    color: #6b7280;
    font-weight: normal; /* Ensure text is not bold */
}

/* Ensure market size text is not bold */
.unified-chart-title div {
    font-weight: normal !important; /* Force normal font weight */
}

/* Ensure fullscreen market info is not bold */
.fullscreen-market-info {
    font-weight: normal !important; /* Force normal font weight */
}

.copy-chart-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}

.copy-chart-btn:hover {
    background: #45a049;
}

.copy-chart-btn:disabled {
    background: #9ca3af;
    cursor: pointer; /* Keep pointer cursor even when disabled */
}

.unified-chart-body {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    height: clamp(280px, 48vw, 620px);
    padding: 1rem 0;
}

.category-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.column-body {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.column-segment {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    cursor: default;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-sizing: border-box;
}

.column-segment:hover {
    filter: brightness(1.1);
    z-index: 10;
    transform: translateY(-8px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(255, 255, 255, 0.5);
    border: 3px solid #FFD700 !important;
}

.column-segment.highlighted {
    filter: brightness(1.2) !important;
    z-index: 20 !important;
    transform: translateY(-12px) !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.8) !important;
    border: 4px solid #FFD700 !important;
    transition: all 0.3s ease !important;
}

.segment-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
    color: white !important;
    font-weight: normal;
    width: 100%;
    justify-content: flex-end;
    height: 100%;
    box-sizing: border-box;
    min-height: 30px;
}

.competitor-name {
    font-size: 0.75rem;
    line-height: 1.1;
    font-weight: normal;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.competitor-name-small {
    font-size: 0.75rem;
    line-height: 1.1;
    font-weight: normal;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.percentage-value {
    font-size: 0.7rem;
    line-height: 1;
    font-weight: bold;
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    width: 100%;
    text-align: center;
    margin-top: 2px;
}

.category-footer {
    margin-top: 1rem;
    text-align: center;
}

.category-footer h5 {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}

/* Chart and Table Alignment */
.chart-table-container {
    border: none;
    border-collapse: collapse;
    width: auto; /* Allow table to size naturally */
    transition: transform 0.3s ease;
    transform-origin: top center; /* Changed to center for better alignment */
    margin: 0 auto; /* Center the container */
    display: block; /* Ensure proper centering */
    max-width: none; /* Allow expansion to fill available space */
    table-layout: auto; /* Allow natural table sizing */
}

.chart-table-container td {
    border: none;
    padding: 0;
    vertical-align: top;
}

/* Copy Buttons */
.copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #10B981;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    position: relative;
}

.copy-btn:hover {
    background-color: #059669;
    transform: scale(1.05);
}

.copy-btn:active {
    transform: scale(0.95);
    cursor: pointer; /* Keep pointer cursor when pressed */
}

.copy-btn .copy-icon {
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.copy-btn.copied,
.copy-chart-btn.copied,
.copy-table-btn.copied,
.copy-analysis-btn.copied,
.tooltip-copy-btn.copied {
    background-color: #10B981 !important; /* Green background for tick mark */
    color: #ffffff !important;
    background: #10B981 !important; /* Additional background property for compatibility */
}

.copy-btn:disabled {
    background-color: #9ca3af;
    cursor: pointer; /* Keep pointer cursor even when disabled */
}

.fullscreen-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #3B82F6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    margin-left: 8px;
}

.fullscreen-btn:hover {
    background-color: #2563EB;
    transform: scale(1.05);
}

/* Ensure chart row and market table have identical width calculations */
.chart-row {
    display: flex;
    width: 100%;
    height: clamp(280px, 48vw, 620px);
    margin-bottom: 0;
    position: relative;
    overflow: visible;
    transform-origin: top left;
    min-width: max-content;
    box-sizing: border-box;
    /* Ensure chart takes full width of its container */
    flex: 1;
}

.chart-empty-column {
    flex: 0 0 calc(100% / var(--column-count, 5));
    height: 100%;
    box-sizing: border-box;
}

.category-column {
    flex: 0 0 calc(100% / var(--column-count, 5));
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    box-sizing: border-box;
}

.column-body {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Market Table */
.market-table-container {
    margin-top: 0;
    overflow: visible;
}

.market-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    table-layout: fixed;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    transform-origin: top left;
    box-sizing: border-box;
    /* Ensure table takes full width of its container */
    display: table;
}

.market-table th,
.market-table td {
    padding: 0.75rem;
    text-align: center;
    border: 1px solid #e5e7eb;
    width: calc(100% / var(--column-count, 5));
    box-sizing: border-box;
    white-space: normal; /* Allow text wrapping */
    word-wrap: break-word;
    word-break: keep-all; /* Prevent breaking single words */
    line-height: 1.3; /* Slightly tighter line spacing */
    vertical-align: middle; /* Center content vertically */
}

.market-table th {
    background: #006400; /* match ERA/ZOO green */
    font-weight: 600;
    color: #ffffff;
    font-size: 0.9rem;
    position: relative;
    min-height: 2.5rem; /* Ensure minimum height for wrapped text */
}

/* Make long text smaller when it wraps */
.market-table th.long-text {
    font-size: 0.8rem; /* Smaller font for long text */
    line-height: 1.1;
}

.market-table th.very-long-text {
    font-size: 0.7rem; /* Even smaller font for very long text */
    line-height: 1.0;
}

/* Multi-word headers can wrap between words */
.market-table th.multi-word {
    word-break: normal; /* Allow wrapping between words */
    white-space: normal;
}

/* Single word headers should not break */
.market-table th:not(.multi-word) {
    word-break: keep-all; /* Prevent breaking single words */
    white-space: nowrap; /* Don't wrap single words */
}

.market-table th.tooltip-enabled {
    cursor: default;
    position: relative;
}

.market-table th.tooltip-enabled:hover {
    background: #004d00; /* darker green on hover */
}

/* General Comments Section Styles - Integrated into table structure */
.general-comments-section {
    margin-top: 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #006400;
}

.general-comments-title {
    margin: 0 0 12px 0;
    color: #006400;
    font-size: 1.1rem;
    font-weight: 600;
}

.general-comments-text {
    margin: 0;
    color: #374151;
    line-height: 1.6;
    font-size: 0.9rem;
}

.market-table .trend-cell {
    background-color: #fffbea;
}

.trend-icon {
    font-size: 1.4rem;
    vertical-align: middle;
}

.trend-down {
    color: #ef4444;
}

.trend-up {
    color: #10b981;
}

.trend-flat {
    color: #f59e0b;
}

/* Company name tooltip for truncated blocks */
.company-tooltip {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 10000;
}

.company-tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

/* Copy button styling for market analysis - matches other copy buttons */
.copy-analysis-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #10B981;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    position: relative;
}

.copy-analysis-btn:hover {
    background-color: #059669;
    transform: scale(1.05);
}

.copy-analysis-btn:active {
    transform: scale(0.95);
    cursor: pointer; /* Keep pointer cursor when pressed */
}

.copy-analysis-btn .material-icons {
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Info Button Styles */
.info-btn {
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 50% !important;
    width: 20px !important;
    height: 20px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}

.info-btn:hover {
    background: #e5e7eb !important;
    color: #374151 !important;
    border-color: #9ca3af !important;
    transform: scale(1.1) !important;
}

.info-btn:active {
    transform: scale(0.95) !important;
}

.info-btn .material-icons {
    font-size: 14px !important;
    line-height: 1 !important;
    color: #6b7280 !important;
    text-shadow: none !important;
}

/* Header Content Layout */
.header-content {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    width: 100% !important;
}

/* Responsive padding adjustments for centering */
@media (max-width: 1600px) {
    .product-tab-panel {
        padding: 2rem 2.5rem; /* Slightly less padding for medium screens */
    }
}

@media (max-width: 1400px) {
    .product-tab-panel {
        padding: 2rem 2rem; /* Less padding for smaller screens */
    }
}

@media (max-width: 1200px) {
    .product-tab-panel {
        padding: 1.5rem 1.5rem; /* Even less padding for tablets */
    }
}

@media (max-width: 768px) {
    .product-tab-panel {
        padding: 1rem 1rem; /* Minimal padding for mobile */
    }
}

/* Responsive width adjustments for wider tabs */
@media (max-width: 1600px) {
    .analysis-content {
        max-width: 1400px; /* Match Insights responsive behavior */
    }
    
    .product-tabs-wrapper,
    .product-tab-nav,
    .product-tab-content {
        max-width: 1400px; /* Match Insights responsive behavior */
    }
}

@media (max-width: 1400px) {
    .analysis-content {
        max-width: 1200px; /* Match Insights responsive behavior */
    }
    
    .product-tabs-wrapper,
    .product-tab-nav,
    .product-tab-content {
        max-width: 1200px; /* Match Insights responsive behavior */
    }
}

@media (max-width: 1200px) {
    .analysis-content {
        max-width: 1000px; /* Match Insights responsive behavior */
    }
    
    .product-tabs-wrapper,
    .product-tab-nav,
    .product-tab-content {
        max-width: 1000px; /* Match Insights responsive behavior */
    }
}

/* Ensure proper container height for scaled content - Updated for page scrolling */
@media (max-width: 1600px) {
    #analysisHome {
        height: auto; /* Let content determine height */
        min-height: calc(100vh * 1.1);
    }
}

@media (max-width: 1400px) {
    #analysisHome {
        height: auto; /* Let content determine height */
        min-height: calc(100vh * 1.25);
    }
}

@media (max-width: 1200px) {
    #analysisHome {
        height: auto; /* Let content determine height */
        min-height: calc(100vh * 1.43);
    }
}

@media (max-width: 1000px) {
    #analysisHome {
        height: auto; /* Let content determine height */
        min-height: calc(100vh * 1.67);
    }
    
    .market-table th,
    .market-table td {
        padding: 0.45rem;
        font-size: 0.75rem;
        white-space: normal; /* Allow text wrapping */
        word-wrap: break-word;
        word-break: keep-all; /* Prevent breaking single words */
        line-height: 1.2;
    }
    
    .market-table th {
        font-size: 0.7rem; /* Smaller headers */
        padding: 0.35rem;
        min-height: 2.2rem; /* Adjust for smaller screens */
    }
    
    .market-table th.long-text {
        font-size: 0.65rem; /* Even smaller for long text */
    }
    
    .market-table th.very-long-text {
        font-size: 0.6rem; /* Very small for very long text */
    }
    
    .market-table td {
        font-size: 0.65rem; /* Smaller data cells */
        padding: 0.35rem;
    }
}

@media (max-width: 800px) {
    #analysisHome {
        height: auto; /* Let content determine height */
        min-height: calc(100vh * 2);
    }
    
    .market-table th,
    .market-table td {
        padding: 0.35rem;
        font-size: 0.65rem;
        white-space: normal; /* Allow text wrapping */
        word-wrap: break-word;
        word-break: keep-all; /* Prevent breaking single words */
        line-height: 1.1;
    }
    
    .market-table th {
        font-size: 0.6rem; /* Small headers */
        padding: 0.25rem;
        min-height: 2rem; /* Adjust for smaller screens */
    }
    
    .market-table th.long-text {
        font-size: 0.55rem; /* Even smaller for long text */
    }
    
    .market-table th.very-long-text {
        font-size: 0.5rem; /* Very small for very long text */
    }
    
    .market-table td {
        font-size: 0.55rem; /* Small data cells */
        padding: 0.25rem;
    }
}

@media (max-width: 600px) {
    .market-table th,
    .market-table td {
        padding: 0.25rem;
        font-size: 0.6rem;
        white-space: normal; /* Allow text wrapping */
        word-wrap: break-word;
        word-break: keep-all; /* Prevent breaking single words */
        line-height: 1.0;
    }
    
    .market-table th {
        font-size: 0.55rem; /* Very small headers */
        padding: 0.2rem;
        min-height: 1.8rem; /* Adjust for smaller screens */
    }
    
    .market-table th.long-text {
        font-size: 0.5rem; /* Even smaller for long text */
    }
    
    .market-table th.very-long-text {
        font-size: 0.45rem; /* Very small for very long text */
    }
    
    .market-table td {
        font-size: 0.5rem; /* Very small data cells */
        padding: 0.2rem;
    }
    
    .market-table {
        font-size: 0.5rem; /* Overall table font size */
    }
}

/* Custom Tooltip Styles */
.custom-tooltip {
    position: fixed;
    background: white;
    border: 2px solid #006400; /* ERA/ZOO green border */
    border-radius: 8px;
    padding: 12px 16px;
    padding-top: 40px; /* Add top padding to make room for copy button */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 300px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #374151; /* consistent text color */
    font-weight: 400;
    pointer-events: none; /* Allow chart interactions to pass through */
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tooltip-content {
    flex: 1;
    margin: 0;
}

.tooltip-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #006400; /* ERA/ZOO green */
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    pointer-events: auto; /* Always allow clicks on copy button */
    transition: all 0.2s ease;
    z-index: 1001;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Add shadow for better visibility */
    position: relative;
}

.tooltip-copy-btn .material-icons,
.tooltip-copy-btn .copy-icon {
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.tooltip-copy-btn:hover {
    background: #004d00; /* Darker green on hover */
    transform: scale(1.1);
}

.tooltip-copy-btn:active {
    transform: scale(0.95);
    cursor: pointer; /* Keep pointer cursor when pressed */
}

.custom-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.custom-tooltip.frozen {
    opacity: 1;
    transform: translateY(0);
    box-shadow: 0 6px 20px rgba(0, 100, 64, 0.3); /* Enhanced shadow for frozen state */
    border-width: 3px; /* Thicker border when frozen */
    pointer-events: auto; /* Allow interactions when frozen */
}

.custom-tooltip::before {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #006400; /* green arrow pointing down */
}

.custom-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 21px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 7px solid white; /* white arrow fill */
}

/* Arrow pointing up (when tooltip is below cursor) */
.custom-tooltip.top::before {
    bottom: auto;
    top: -8px;
    border-top: none;
    border-bottom: 8px solid #006400; /* green arrow pointing up */
}

.custom-tooltip.top::after {
    bottom: auto;
    top: -6px;
    border-top: none;
    border-bottom: 7px solid white; /* white arrow fill */
}


.market-table td {
    color: #374151;
    font-size: 0.85rem;
}

.market-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

/* General Comments Section */
.general-comments-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 8px;
    border-left: 4px solid #006400; /* ERA/ZOO green accent */
}

.general-comments-title {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.general-comments-text {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #374151;
}

/* Ensure analysis tabs are NEVER sticky/fixed and scroll out on zoom */
.analysis-content .product-tabs-wrapper,
.analysis-content .product-tab-nav,
.analysis-content .product-tab-btn,
.analysis-content .product-tab-btn.active,
.analysis-content .product-tab-content,
.analysis-content .product-tab-panel {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    will-change: auto !important;
    z-index: auto !important;
}

/* Edge-to-edge alignment: make chart/table table flush with left tab boundary */
/* Removed conflicting padding rules to allow proper centering */

.chart-table-container {
    margin: 0 auto; /* Center the container */
    display: block; /* Ensure proper centering */
    max-width: none; /* Allow expansion to fill available space */
    width: auto; /* Allow table to size naturally */
}

/* Chart Empty Column */
.chart-empty-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}


/* Fullscreen Modal */
.fullscreen-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    overflow-x: hidden; /* prevent horizontal bar on popup */
}

.fullscreen-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-content {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.25rem;
    padding-left: 0.25rem; /* reduce left whitespace */
    width: 95vw;
    height: 95vh;
    overflow-x: hidden; /* hide horizontal scroll in modal */
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    border: 2px solid #e5e7eb;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.fullscreen-chart {
    width: 100%;
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start; /* left align chart in popup */
    padding: 0 10px;             /* 10px horizontal padding */
    overflow-x: hidden;          /* ensure no inner horizontal bar */
}

.fullscreen-chart .chart-row {
    display: flex;
    width: 100%;
    height: 100%;
    min-height: 520px;
    margin-bottom: 0;
    align-items: flex-end;
}

.fullscreen-chart .category-column {
    flex: 0 0 calc(100% / var(--column-count, 5));
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.fullscreen-chart .column-body {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fullscreen-chart .chart-empty-column {
    /* In popup, remove the leading spacer column so chart hugs the left */
    display: none !important;
}

.close-fullscreen {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

.close-fullscreen:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Error Messages */
.error-banner {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: fit-content;
    text-align: left;
    justify-content: flex-start;
}

.error-close-btn {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    padding: 0.25rem;
    margin-left: 1rem;
    border-radius: 4px;
}

.error-close-btn:hover {
    background: rgba(220, 38, 38, 0.1);
}

.italy-market-outlook .analysis-header {
    margin-bottom: 1.5rem;
}

.italy-market-outlook .analysis-subtitle {
    color: #6b7280;
    margin: 0.5rem 0 0;
}

.italy-market-outlook-chart {
    margin-top: 1rem;
}

.italy-market-outlook-note {
    margin-top: 1rem;
    font-size: 0.95rem;
    color: #6b7280;
}

.italy-market-outlook .analysis-header {
    text-align: center;
}

.italy-market-outlook .analysis-header h2 {
    margin: 0;
    font-size: 2.2rem;
    color: #3f6212;
    font-weight: 700;
}

.italy-market-outlook .analysis-header p {
    margin: 0.35rem 0 0;
    font-size: 1.1rem;
    color: #6b7280;
}

.italy-market-chart .unified-chart-header {
    display: none;
}

.italy-market-chart .chart-row {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .unified-chart-body {
        gap: 0.5rem;
    }
    
    .category-column {
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    .page-title-text {
        font-size: 2rem;
    }
    
    .product-tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    
    .unified-chart-body {
        height: clamp(240px, 52vw, 480px);
        gap: 0.25rem;
    }
    
    .competitor-name {
        font-size: 0.6rem;
    }
    
    .market-table th,
    .market-table td {
        padding: 0.4rem;
        font-size: 0.7rem;
    }
    
    .market-table th {
        font-size: 0.65rem; /* Even smaller headers */
        padding: 0.3rem;
    }
    
    .market-table td {
        font-size: 0.6rem; /* Smaller data cells */
        padding: 0.3rem;
    }
}

/* When viewport is narrow (including zoomed-in), let the tab border move with content */
@media (max-width: 1400px) {
    .product-tab-content {
        margin-top: 0;
    }
}

/* Natural positioning for tab elements - allows zoom scaling */
.product-tab-content {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    will-change: auto;
}

.product-tab-panel,
.product-tab-panel.active {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    will-change: auto;
}

.chart-row {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    transform: none;
    will-change: auto;
}

/* Fullscreen Modal Styles */
.fullscreen-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: #3B82F6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
}

.fullscreen-btn:hover {
    background-color: #2563EB;
    transform: scale(1.05);
}

.fullscreen-btn:disabled {
    background-color: #9ca3af;
    cursor: pointer;
}

.fullscreen-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
}

.fullscreen-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.fullscreen-content {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    width: 95vw;
    height: 95vh;
    overflow-x: hidden; /* prevent horizontal scrollbar */
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.fullscreen-chart-container {
    flex: 1;
    overflow-x: hidden; /* no horizontal scroll inside */
    overflow-y: auto;
}

.fullscreen-all-charts {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.fullscreen-chart-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fullscreen-chart-title {
    margin: 0;
    font-size: 1.5rem;
    color: #1f2937;
    font-weight: 600;
}

.fullscreen-market-info {
    font-size: 0.9rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.fullscreen-chart-row {
    height: 400px !important; /* Equal height for all charts */
    min-height: 400px;
    max-height: 400px;
}

.fullscreen-single-chart {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    height: 100%;
    justify-content: center;
    align-items: flex-start;      /* left align content */
    padding: 0 10px;              /* 10px horizontal padding */
}

.fullscreen-single-chart .chart-row {
    height: 70vh !important; /* Much larger for single chart */
    min-height: 70vh;
    max-height: 70vh;
    flex: 1;
    width: 100%;
    margin: 0;                   /* left aligned, no auto-centering */
}

.close-fullscreen {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

.close-fullscreen:hover {
    background: #dc2626;
    transform: scale(1.1);
}

@media (max-width: 480px) {
    .product-tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .product-tab-btn .material-icons {
        font-size: 1rem;
    }
    
    .unified-chart-body {
        height: clamp(220px, 56vw, 360px);
    }
    
    .competitor-name {
        font-size: 0.5rem;
    }
    
    .market-table th,
    .market-table td {
        padding: 0.25rem;
        font-size: 0.7rem;
    }
}

/* Responsive chart fitting for smaller screens */
@media (max-width: 1200px) {
    .chart-table-container {
        width: 100%;
        max-width: 100%;
        padding: 0.5rem;
        margin: 0;
    }
    
    .chart-row {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
    }
    
    .chart-empty-column,
    .category-column {
        flex: 0 0 auto;
        min-width: 80px;
        max-width: 120px;
    }
    
    /* Specific adjustments for External Doors section */
    .product-tab-panel[data-tab="External_Doors"] .chart-table-container {
        padding: 0.25rem;
    }
    
    .product-tab-panel[data-tab="External_Doors"] .chart-empty-column,
    .product-tab-panel[data-tab="External_Doors"] .category-column {
        min-width: 70px;
        max-width: 100px;
    }
}

@media (max-width: 768px) {
    .chart-table-container {
        padding: 0.25rem;
    }
    
    .chart-empty-column,
    .category-column {
        min-width: 60px;
        max-width: 100px;
    }
    
    .unified-chart-body {
        height: 200px;
    }
    
    /* Additional adjustments for External Doors on smaller screens */
    .product-tab-panel[data-tab="External_Doors"] .chart-table-container {
        padding: 0.125rem;
    }
    
    .product-tab-panel[data-tab="External_Doors"] .chart-empty-column,
    .product-tab-panel[data-tab="External_Doors"] .category-column {
        min-width: 50px;
        max-width: 80px;
    }
    
    .product-tab-panel[data-tab="External_Doors"] .unified-chart-body {
        height: 180px;
    }
}
