/* Base Font */
body {
    font-family: Verdana, Geneva, sans-serif;
}

/* Main Header */
.main-header {
    background-color: #000;
    color: #fff;
    text-align: center;
    padding: 30px 20px;
    margin: 0;
    font-family: "Playwrite NZ", cursive;
    font-optical-sizing: auto;
    font-weight: 200;
    font-style: normal;
}

/* Navigation Links */
.nav-link {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-link:hover {
    background: #218838;
}

.back-link {
    display: inline-block;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.back-link:hover {
    background: #218838;
}

/* Theme Section */
.theme-section {
    margin: 40px 0;
}

.theme-section h2 {
    color: #333;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

/* Theme List Grid */
.theme-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Theme Cards */
.theme-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    background: white;
    transition: box-shadow 0.3s;
}

.theme-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.theme-card h3 {
    margin-top: 0;
    color: #007bff;
}

.theme-card p {
    color: #666;
    margin: 10px 0;
}

.theme-card a {
    display: inline-block;
    margin-top: 15px;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.theme-card a:hover {
    background: #0056b3;
}

/* Partner Logos */
.partner-logos {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.partner-logos img {
    max-width: 80px;
    max-height: 40px;
    object-fit: contain;
}

.theme-header .partner-logos {
    gap: 15px;
}

.theme-header .partner-logos img {
    max-width: 100px;
    max-height: 50px;
}

/* No Themes Message */
.no-themes {
    color: #999;
    font-style: italic;
}

/* Page Introduction */
.page-intro {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.page-intro h2 {
    color: #007bff;
    margin-top: 0;
}

.page-intro-short {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 15px;
}

/* Theme Header */
.theme-header {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.theme-header h2 {
    margin-top: 0;
    color: #007bff;
}

.theme-header p {
    color: #666;
    margin: 10px 0;
}

/* Messages */
.messages {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

.messages li {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.messages .success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.messages .error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.messages .warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.messages .info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Footer */
footer {
    margin-top: 60px;
    padding: 30px 0;
    border-top: 2px solid #ddd;
    background-color: #f8f9fa;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

footer .footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

footer .donation-section {
    margin-bottom: 20px;
}

footer .donation-button {
    display: inline-block;
    padding: 12px 30px;
    background: #28a745;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.3s;
}

footer .donation-button:hover {
    background: #218838;
}

footer nav {
    margin-bottom: 15px;
}

footer nav a {
    margin: 0 15px;
    color: #007bff;
    text-decoration: none;
}

footer nav a:hover {
    text-decoration: underline;
}

footer .copyright {
    color: #666;
    font-size: 14px;
    margin: 0;
}

/* Content Pages */
.content-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.content-intro {
    font-size: 1.1em;
    color: #555;
    margin-bottom: 20px;
}

.content-main {
    line-height: 1.6;
}

.content-placeholder {
    color: #999;
    font-style: italic;
}

/* Theme Detail Page Layout */
.theme-content-wrapper {
    display: flex;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.table-container {
    flex: 1;
    min-width: 0;
}

.forms-sidebar {
    width: 350px;
    flex-shrink: 0;
}

/* Propositions Table */
#propositions-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    table-layout: fixed;
}

#propositions-table thead {
    background-color: #f8f9fa;
}

#propositions-table th {
    padding: 12px;
    text-align: left;
    font-weight: bold;
    color: #333;
    border-bottom: 2px solid #ddd;
}

#propositions-table th:nth-child(1) {
    width: 50%;
}

#propositions-table th:nth-child(2) {
    width: 20%;
}

#propositions-table th:nth-child(3) {
    width: 15%;
}

#propositions-table th:nth-child(4) {
    width: 15%;
}

#propositions-table tbody tr {
    border-bottom: 1px solid #e9ecef;
}

#propositions-table tbody tr:last-child {
    border-bottom: none;
}

#propositions-table tbody tr:hover {
    background-color: #f8f9fa;
}

#propositions-table td {
    padding: 12px;
    vertical-align: middle;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

#propositions-table td:first-child {
    word-break: break-word;
    hyphens: auto;
}

/* Vote Badges */
.vote-cell {
    text-align: center;
}

.vote-badge {
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    border-radius: 50%;
    color: white;
    font-weight: bold;
    text-align: center;
}

.vote-badge:empty {
    display: none;
}

.vote-cell[data-prop-id] .vote-badge:not(:empty) {
    cursor: pointer;
}

/* Vote Colors - Applied via JavaScript */

/* Sticky Forms */
.forms-sidebar {
    position: sticky;
    top: 20px;
    align-self: flex-start;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.form-box {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.form-box h3 {
    margin-top: 0;
    color: #333;
    font-size: 1.2em;
    margin-bottom: 15px;
}

.form-box form p {
    margin-bottom: 15px;
}

.form-box form label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-box form input[type="text"],
.form-box form input[type="email"],
.form-box form textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.form-box form textarea {
    resize: vertical;
    min-height: 80px;
}

.form-box form button {
    width: 100%;
    padding: 10px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.form-box form button:hover {
    background: #0056b3;
}

#char-counter {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    margin-bottom: 10px;
}

/* Mobile Action Buttons */
.mobile-action-buttons {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    gap: 10px;
    flex-direction: column;
    align-items: center;
}

.mobile-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: center;
}

.mobile-btn span {
    font-size: 18px;
    font-weight: bold;
}

.mobile-btn:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.mobile-btn:active {
    transform: scale(0.95);
}

/* Form Box Header */
.form-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.form-box-header h3 {
    margin: 0;
}

.close-form-btn {
    display: none;
    background: none;
    border: none;
    font-size: 28px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    transition: color 0.3s;
}

.close-form-btn:hover {
    color: #333;
}

/* Overlay pour mobile */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

.mobile-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 768px) {
    /* Afficher les boutons mobiles */
    .mobile-action-buttons {
        display: flex;
    }

    /* Layout mobile */
    .theme-content-wrapper {
        flex-direction: column;
        padding: 0 10px 140px 10px;
    }

    /* Table responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #propositions-table {
        font-size: 14px;
    }

    #propositions-table th,
    #propositions-table td {
        padding: 8px;
    }

    /* Formulaires en panneau coulissant */
    .forms-sidebar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 90%;
        max-width: 400px;
        height: 100vh;
        background: white;
        z-index: 999;
        overflow-y: auto;
        transition: right 0.3s ease-in-out;
        padding: 20px;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .forms-sidebar.active {
        right: 0;
    }

    .form-box {
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 30px;
    }

    .form-box:not(.active-form) {
        display: none;
    }

    .close-form-btn {
        display: block;
    }

    .form-box-header {
        padding-bottom: 15px;
        border-bottom: 2px solid #007bff;
        margin-bottom: 20px;
    }

    .form-box-header h3 {
        color: #007bff;
        font-size: 1.3em;
    }

    /* Formulaires mobile - inputs */
    .forms-sidebar input[type="text"],
    .forms-sidebar input[type="email"],
    .forms-sidebar textarea {
        font-size: 16px;
        padding: 10px 12px;
    }

    .forms-sidebar button[type="submit"] {
        font-size: 16px;
        padding: 12px 20px;
    }

    /* Ajuster les header pour mobile */
    .theme-header {
        padding: 15px;
        margin-bottom: 20px;
    }

    .theme-header h2 {
        font-size: 1.3em;
    }

    /* Vote badges plus petits sur mobile */
    .vote-badge {
        width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: 13px;
    }

    /* Largeurs de colonnes ajustées pour mobile */
    #propositions-table th:nth-child(1) {
        width: 45%;
    }

    #propositions-table th:nth-child(2) {
        width: 20%;
    }

    #propositions-table th:nth-child(3) {
        width: 15%;
    }

    #propositions-table th:nth-child(4) {
        width: 20%;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .theme-content-wrapper {
        flex-direction: column;
    }

    .forms-sidebar {
        width: 100%;
        position: static;
        max-height: none;
    }
}

/* Responsive général - Mobile */
@media (max-width: 768px) {
    /* Header principal */
    .main-header {
        padding: 20px 15px;
        font-size: 1.5em;
    }

    /* Navigation */
    .nav-link,
    .back-link {
        display: block;
        margin: 10px 15px;
        text-align: center;
    }

    /* Theme List */
    .theme-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .theme-section {
        margin: 20px 0;
    }

    .theme-section h2 {
        font-size: 1.3em;
        padding: 0 15px;
    }

    /* Page intro */
    .page-intro {
        padding: 15px;
        margin: 0 10px 20px;
    }

    .page-intro h2 {
        font-size: 1.2em;
    }

    /* Content container */
    .content-container {
        padding: 15px;
    }

    /* Footer */
    footer {
        padding: 20px 0;
        margin-top: 40px;
    }

    footer nav {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    footer nav a {
        margin: 0;
        display: block;
        padding: 8px 0;
    }

    footer .donation-button {
        display: block;
        max-width: 250px;
        margin: 0 auto;
    }

    footer .copyright {
        font-size: 12px;
        padding: 0 15px;
    }

    /* Messages */
    .messages {
        margin: 15px 10px;
    }

    .messages li {
        font-size: 14px;
    }

    /* Partner logos */
    .partner-logos {
        justify-content: center;
    }

    .partner-logos img {
        max-width: 60px;
        max-height: 35px;
    }
}

/* Champ sexe pour le thème Les femmes */
.sexe-field {
    margin: 15px 0;
}

.sexe-label {
    display: block;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
}

.sexe-options {
    display: flex;
    margin-top: 15px;
    gap: 20px;
}

.sexe-option {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.sexe-option input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

.sexe-option input[type="radio"]:checked + span {
    font-weight: bold;
}
