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

html, body {
    min-height: 100%;
}

html {
    scrollbar-gutter: stable;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

/* Pages nécessitant overflow hidden (wizard, etc.) - uniquement desktop */
body.no-scroll {
    overflow: hidden;
    height: 100%;
}

/* Page d'accueil visiteur - pas de scroll */
body.home-guest {
    overflow: hidden;
    height: 100vh;
    height: 100svh;
}

/* Mobile: permettre le scroll même pour les pages no-scroll */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    body.no-scroll {
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
    }
}

/* Typography Helpers */
.text-muted {
    color: #999;
    font-style: italic;
}

.text-center {
    text-align: center;
}

/* Markdown Tables */
.md-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
    font-size: 0.95rem;
}

.md-table th,
.md-table td {
    border: 1px solid #3a3a3a;
    padding: 0.5rem 0.65rem;
    text-align: left;
    vertical-align: top;
}

.md-table th {
    background: #2b2b2b;
    color: #f0c674;
    font-weight: 600;
}

.md-table tbody tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.02);
}

/* Table Builder Modal */
.modal-content.modal-table-builder {
    max-width: 900px;
    width: 92%;
}

.modal-content.modal-table-builder .table-builder-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-content.modal-table-builder .table-builder-actions label {
    display: block;
    margin-bottom: 0.4rem;
}

.modal-content.modal-table-builder .table-builder-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.modal-content.modal-table-builder .table-builder-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.modal-content.modal-table-builder .table-builder-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: #ccc;
}

.modal-content.modal-table-builder .table-builder-checkbox input {
    accent-color: #f0c674;
}

.modal-content.modal-table-builder .table-builder-grid {
    background: #1f1f1f;
    border: 1px solid #333;
    border-radius: 10px;
    padding: 0.75rem;
    max-height: 50vh;
    overflow: auto;
}

.modal-content.modal-table-builder .table-builder-grid table {
    width: 100%;
    border-collapse: collapse;
}

.modal-content.modal-table-builder .table-builder-grid th,
.modal-content.modal-table-builder .table-builder-grid td {
    border: 1px solid #3a3a3a;
    padding: 0.35rem;
    background: #1f1f1f;
}

.modal-content.modal-table-builder .table-builder-grid th.is-header {
    background: linear-gradient(135deg, rgba(240, 198, 116, 0.18), rgba(240, 198, 116, 0.05));
    border-color: rgba(240, 198, 116, 0.35);
}

.modal-content.modal-table-builder .table-builder-grid input {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    padding: 0.35rem 0.45rem;
    color: #e0e0e0;
    font-size: 0.9rem;
}

.modal-content.modal-table-builder .table-builder-grid .is-header input {
    font-weight: 600;
    color: #f0c674;
    background: rgba(30, 30, 30, 0.9);
    border-color: rgba(240, 198, 116, 0.4);
}

.modal-content.modal-table-builder .table-builder-index {
    width: 42px;
    text-align: center;
    font-weight: 600;
    color: #b0b0b0;
    background: #202020;
    border-color: #333;
}

/* Buttons */
.btn-primary {
    padding: 0.75rem;
    background-color: #f0c674;
    color: #1a1a1a;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-primary:hover {
    background-color: #d4aa5c;
}

.btn-secondary {
    background-color: #4d4d4d;
    color: #e0e0e0;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #5d5d5d;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

/* Forms */
.auth-form h2 {
    color: #f0c674;
    margin-bottom: 1.5rem;
    text-align: center;
}

.auth-form form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form input {
    padding: 0.75rem;
    background-color: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 1rem;
}

.auth-form input:focus {
    outline: none;
    border-color: #f0c674;
}

.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 0.25rem;
    cursor: pointer;
}

.checkbox-group label {
    font-size: 0.9rem;
    color: #a0a0a0;
    cursor: pointer;
    line-height: 1.4;
}

.auth-switch {
    text-align: center;
    margin-top: 1rem;
    color: #a0a0a0;
}

.auth-switch a {
    color: #f0c674;
    text-decoration: none;
    cursor: pointer;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.auth-form-hidden {
    display: none;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert p {
    margin: 5px 0;
}

.alert p:first-child {
    margin-top: 0;
}

.alert p:last-child {
    margin-bottom: 0;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-success p {
    margin: 0;
    font-weight: bold;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-admin { background-color: #e74c3c; color: white; }
.badge-moderator { background-color: #3498db; color: white; }
.badge-member { background-color: #7f8c8d; color: white; }
.badge-success { background-color: #27ae60; color: white; }
.badge-warning { background-color: #f39c12; color: white; }
.badge-info { background-color: #5d9cec; color: white; }
