/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body Styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography Harmonization */
h1 {
    font-size: 2.2em;
    color: #333;
    margin-bottom: 1.2em;
    border-bottom: 3px solid #d32f2f;
    padding-bottom: 0.3em;
    font-weight: bold;
}

h2 {
    font-size: 1.6em;
    color: #333;
    margin: 1.5em 0 1em 0;
    border-bottom: 2px solid #ccc;
    padding-bottom: 0.2em;
    font-weight: 600;
}

h3 {
    font-size: 1.3em;
    color: #333;
    margin: 1.2em 0 0.8em 0;
    font-weight: 600;
}

p {
    margin-bottom: 1em;
    line-height: 1.7;
    color: #444;
}

ul {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

li {
    margin-bottom: 0.3em;
    line-height: 1.6;
}

/* Links */
a {
    color: #0066cc;
    text-decoration: underline;
    transition: color 0.3s ease;
}

a:hover {
    color: #d32f2f;
    text-decoration: underline;
}

/* Button Styles */
.button {
    display: inline-block;
    background-color: #d32f2f;
    color: white;
    padding: 12px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin: 10px 0;
    transition: all 0.3s ease;
    border: 2px solid #d32f2f;
}

.button:hover {
    background-color: #a52725;
    border-color: #a52725;
    outline: 2px solid #ffd600;
    color: white;
    text-decoration: none;
}

/* Header Styles - Harmonized */
header {
    background-color: #fff;
    color: #000;
    padding: 1rem 0;
    border-bottom: 4px solid #d32f2f;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 2rem;
}

nav ul li {
    margin: 0;
}

/* Navigation links - keep them styled */
nav ul li a {
    color: #333;
    text-decoration: none;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 1.1em;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: block;
}

/* Selection page links - keep them styled */
.rubrique-link,
.chapter-link {
    text-decoration: none;
    color: inherit;
}

nav ul li a:hover {
    background-color: #d32f2f;
    color: #fff;
    outline: 2px solid #ffd600;
    text-decoration: none;
}

/* Main Content Styles */
main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    flex: 1;
    padding-bottom: 50px;
}

/* Footer Styles */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 1.5rem;
    width: 100%;
    font-size: 0.9em;
}

/* Selection Page Specific Styles */
.selection-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.rubriques-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rubrique-container {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 15px;
    transition: transform 0.3s ease;
}

.rubrique-container:hover {
    transform: translateY(-3px);
}

.rubrique-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.rubrique-header {
    transition: background-color 0.3s ease, color 0.3s ease;
    border-radius: 5px;
    padding: 10px;
    cursor: pointer;
}

.rubrique-link:hover .rubrique-header {
    background-color: #d32f2f;
    color: white;
    outline: 2px solid #ffd600;
}

.rubrique-link h2 {
    font-size: 1.5em;
    border-bottom: 2px solid #d32f2f;
    padding-bottom: 10px;
    margin: 0;
}

.no-data {
    color: #aaa;
    background-color: #f0f0f0;
    pointer-events: none;
    cursor: default;
}

.chapters-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chapter-link {
    text-decoration: none;
    color: inherit;
}

.chapter-block {
    padding: 10px;
    background-color: #f8f8f8;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.chapter-block:hover {
    background-color: #d32f2f;
    color: white;
    outline: 2px solid #ffd600;
}

.chapter-block.no-data {
    color: #aaa;
    background-color: #f0f0f0;
    pointer-events: none;
    cursor: default;
}

/* Table Styles - Harmonized and Aligned */
.votes-table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 14px;
    text-align: left;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    background-color: white;
}

/* Ensure both tables have same column widths */
.votes-table th:nth-child(1),
.votes-table td:nth-child(1) {
    width: 8%;
    min-width: 60px;
}

.votes-table th:nth-child(2),
.votes-table td:nth-child(2) {
    width: 20%;
    min-width: 150px;
}

.votes-table th:nth-child(n+3),
.votes-table td:nth-child(n+3) {
    width: auto;
    min-width: 80px;
}

.votes-table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: bold;
    padding: 15px 12px;
    border-bottom: 2px solid #d32f2f;
    position: sticky;
    top: 0;
    text-align: center;
}

.votes-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}

.votes-table tr {
    border-bottom: 1px solid #ddd;
    transition: background-color 0.2s ease;
}

.votes-table td:nth-child(n+3) {
    text-align: center;
}

.votes-table td:nth-child(1) {
    font-weight: bold;
    background-color: #e9ecef;
}

.votes-table td:nth-child(2) {
    font-style: italic;
}

.votes-table th:nth-child(n+3) {
    background-color: #e9ecef;
    text-align: center;
}

.votes-table td,
.votes-table th {
    border: 1px solid #ddd;
}

/* Vote color styles */
.votes-table td.vote-Oui {
    background-color: #d4edda;
    color: #155724;
    font-weight: bold;
}

.votes-table td.vote-Non {
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
}

.votes-table td.vote-Abstention {
    background-color: #fff3cd;
    color: #856404;
    font-weight: bold;
}

.votes-table td.vote-nan {
    background-color: #e2e3e5;
    color: #383d41;
    font-style: italic;
}

/* Specific to votes parti */
#votes-table-parti.votes-table tr {
    background-color: #c2c2d3;
}

.votes-table td.parti-vote-Oui {
    background-color: #d4edda;
    color: #155724;
    font-weight: bold;
}

.votes-table td.parti-vote-Non {
    background-color: #f8d7da;
    color: #721c24;
    font-weight: bold;
}

.votes-table td.parti-vote-Abstention {
    background-color: #fff3cd;
    color: #856404;
    font-weight: bold;
}
.votes-table td.vote-total {
    font-weight: bold;
}

/* title-votes-container */
.title-votes-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1em;
}

/* Toggle section styles */
.toggle-input {
    display: none;
}

.toggle-label {
    display: block;
    background: #c2c2d3;
    color: white;
    padding: 15px 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1em;
    margin: 20px 0 5px 0;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.toggle-label:hover {
    background-color: #5a6268;
    outline: 2px solid #ffd600;
}

.toggle-input:not(:checked)~.parti {
    display: none;
}

.toggle-input:checked~.parti {
    display: block;
}

/* Sort button styles */
.arrange-btn {
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    margin-left: 5px;
    font-size: 0.8em;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
}

.arrange-btn:hover {
    background-color: rgba(255, 214, 0, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }

    nav ul {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }

    h1 {
        font-size: 1.8em;
    }

    h2 {
        font-size: 1.4em;
    }

    .rubrique-container {
        padding: 10px;
    }

    .votes-table {
        font-size: 12px;
    }

    .votes-table th,
    .votes-table td {
        padding: 8px 6px;
    }
}