/* Styles for the Topic View */

#topicView {
    padding: 1rem;
    background-color: #f9f9f9;
}

#topicView h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
}

.chart-controls {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.chart-controls label {
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: #555;
    cursor: pointer;
}

.chart-controls input[type="radio"] {
    margin-right: 0.5rem;
    accent-color: #6366f1; /* Highlight radio button with primary color */
}

.chart-controls button {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
    background-color: #6366f1;
    color: white;
    border: 1px solid #6366f1;
}

.chart-controls button:hover {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

.charts-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 20px;
    margin-bottom: 30px; /* Space below charts */
}

.charts-container > div {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    flex: 1; /* Allows flex items to grow and shrink */
    min-width: 450px; /* Minimum width before wrapping */
    max-width: 600px; /* Maximum width to prevent charts from getting too wide */
    height: 400px; /* Fixed height for consistency */
    display: flex; /* Use flex to center canvas if needed */
    justify-content: center;
    align-items: center;
}

canvas {
    max-width: 100%;
    max-height: 100%;
}

/* New styles for the detailed analysis section */
.topic-details-section {
    margin-top: 30px;
    padding: 20px;
    background-color: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: none; /* Hidden by default, shown by JS */
}

.topic-details-title {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 15px;
    text-align: center; /* Center the title */
}

.topic-details-content-container {
    display: flex;
    flex-wrap: wrap; /* Allow columns to wrap on smaller screens */
    gap: 20px; /* Space between columns */
    justify-content: space-between; /* Distribute space between columns */
}

.topic-details-column {
    flex: 1; /* Each column takes equal space */
    min-width: 300px; /* Minimum width for columns before wrapping */
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fdfdfd;
    display: flex; /* Enable flexbox for vertical layout of subsections */
    flex-direction: column; /* Stack subsections vertically */
    gap: 15px; /* Space between top and bottom subsections */
    flex-wrap: wrap; /* Allow subsections to wrap if needed */
    justify-content: space-between; /* Distribute space between subsections */
    align-items: stretch; /* Make subsections equal height */
    /* Removed Temporary diagnostic border */
}

/* Style for the scrollable table container */
.scrollable-table-container {
    max-height: 700px; /* Set a maximum height for the scrollable area */
    overflow-y: auto; /* Enable vertical scrolling when content exceeds max-height */
    border: 1px solid #ddd; /* Optional: Add a border to delineate the scrollable area */
    border-radius: 8px;
    padding: 10px;
    background-color: #fff; /* Ensure background is white for content */
    display: block; /* Ensure it behaves as a block element for max-height to work */
}

/* Basic table styling within the scrollable container */
.topic-petitions-table {
    width: 100%;
    border-collapse: collapse; /* Collapse borders between cells */
}

.topic-petitions-table th,
.topic-petitions-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #eee; /* Light border for rows */
    text-align: left;
}

.topic-petitions-table th {
    background-color: #f2f2f2;
    font-weight: bold;
    position: sticky; /* Make header sticky */
    top: 0; /* Stick to the top of the scrollable container */
    z-index: 1; /* Ensure header is above scrolling content */
}

.topic-petitions-table tbody tr:hover {
    background-color: #f5f5f5; /* Hover effect for rows */
}

.topic-petitions-table a {
    color: #6366f1;
    text-decoration: none;
}

.topic-petitions-table a:hover {
    text-decoration: underline;
}

/* Styles for the new topic subsections */
.topic-subsection {
    background-color: #fdfdfd; /* Slightly different background for subsections */
    padding: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    /* Set to take equal width in the row */
    flex: 1; /* Each subsection takes equal space */
    box-sizing: border-box; /* Include padding and border in the element's total width */
    display: flex;
    flex-direction: column; /* Keep internal content stacked vertically */
    /* Removed Temporary diagnostic border */
}

.topic-subsection h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #555;
    font-size: 1.2rem;
}


/* Responsive adjustments */
@media (max-width: 992px) {
    .charts-container > div {
        min-width: 100%; /* Stack charts vertically on smaller screens */
        height: 350px; /* Adjust height for smaller screens */
    }

    .topic-details-content-container {
        flex-direction: column; /* Stack columns vertically on smaller screens */
    }

    .topic-details-column {
        min-width: 100%; /* Full width on smaller screens */
        flex-direction: column; /* Stack subsections vertically on smaller screens */
    }

    .topic-subsection {
        flex: 0 0 100%; /* Full width for subsections when parent is stacked */
    }
}

@media (max-width: 600px) {
    .chart-controls {
        flex-direction: column;
        align-items: center;
    }

    /* Stack the subsections vertically on very small screens */
    .topic-details-column {
        flex-direction: column;
    }

    .topic-subsection {
        flex: 0 0 100%; /* Full width for subsections on very small screens */
    }
}

#mapDiv {
    height:500px;
    max-height: none;
    max-width: none;;
} 
