/* ═══════════════════════════════════════════════════
   GÉNÉRATEUR DE LETTRE — Styles Professionnels
   ═══════════════════════════════════════════════════ */

.letter-wizard-wrapper {
    max-width: 900px;
    margin: 40px auto;
    background: var(--c-surface);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md);
    padding: 0;
    overflow: hidden;
}

.wizard-header {
    background: var(--g-header);
    color: #FFFFFF;
    padding: 30px;
    text-align: center;
}

.wizard-header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
}

.wizard-header .subtitle {
    margin-top: 5px;
    opacity: 0.9;
    font-size: 1rem;
}

/* ── BARRE DE PROGRESSION ── */
.progress-container {
    margin-top: 25px;
    background: rgba(255, 255, 255, 0.15);
    height: 10px;
    border-radius: 5px;
    position: relative;
    overflow: visible;
}

.progress-bar {
    background: #F4A261; /* Orange accent */
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px rgba(244, 162, 97, 0.4);
}

.progress-text {
    position: absolute;
    right: 0;
    top: -22px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── DISCLAIMER ── */
.info-box-disclaimer {
    background: #FFF9C4; /* Jaune clair pro */
    border-left: 5px solid #FBC02D;
    color: #5D4037;
    margin: 20px 30px;
    padding: 15px 20px;
    border-radius: var(--r-sm);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ── ÉTAPES & FORMULAIRE ── */
.wizard-step {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease;
}

.wizard-step.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-title {
    margin-bottom: 30px;
    border-bottom: 2px solid var(--c-surface2);
    padding-bottom: 10px;
}

.step-title h2 {
    color: var(--c-accent);
    margin: 0;
    font-size: 1.4rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group.full {
    grid-column: span 2;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--c-text);
}

.form-group .required {
    color: var(--c-error);
}

.field-help {
    font-size: 0.8rem;
    color: var(--c-text-2);
    margin-top: -5px;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    background: var(--c-surface2);
    color: var(--c-text);
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--c-accent);
    outline: none;
    background: var(--c-surface);
}

/* Day chips selector */
.days-selector {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-top: 10px;
}
.day-chip {
    cursor: pointer;
    width: 100%;
}
.day-chip input {
    display: none;
}
.day-chip span {
    display: block;
    padding: 10px 5px;
    background: white;
    border: 2px solid var(--c-border);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.25s ease;
    color: var(--c-text-muted);
    text-align: center;
}
.day-chip input:checked + span {
    background: var(--c-accent);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Responsive jours de passage */
@media (max-width: 600px) {
    .days-selector {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .days-selector .day-chip {
        margin: 0;
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}
.day-chip:hover span {
    border-color: var(--c-accent);
    color: var(--c-accent);
}
.day-chip input:checked:hover span {
    color: white;
}

.bug-report-link {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 15px;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
    transition: all 0.3s ease;
}
.bug-report-link:hover {
    background: #fff0f0;
    border-color: #ffcccc;
    color: #cc0000 !important;
    opacity: 1 !important;
    transform: translateY(-1px);
}

/* ── MOTIFS (Étape 2) ── */
.motif-group {
    margin-bottom: 30px;
    background: var(--c-bg);
    padding: 20px;
    border-radius: var(--r-md);
    border: 1px solid var(--c-border);
}

.motif-group h3 {
    margin-top: 0;
    font-size: 1.1rem;
    color: var(--c-accent);
    border-bottom: 1px solid var(--c-border-hi);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.checkbox-item, .checkbox-label {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    cursor: pointer;
    font-size: 0.95rem;
}

.checkbox-item input, .checkbox-label input {
    margin-top: 4px;
    width: 18px;
    height: 18px;
}

.sub-question {
    margin-left: 30px;
    padding: 15px;
    background: var(--c-surface);
    border: 1px dashed var(--c-border-hi);
    border-radius: var(--r-sm);
    margin-top: 5px;
    display: none;
}

.sub-question.active {
    display: block;
}

.inline-warning {
    color: var(--c-error);
    font-size: 0.85rem;
    font-weight: 600;
    background: var(--c-error-lt);
    padding: 10px;
    border-radius: 4px;
    margin-top: 10px;
}

/* ── TABLEAU TRAJETS (Étape 3) ── */
.trajets-manager {
    background: var(--c-bg);
    padding: 20px;
    border-radius: var(--r-md);
    border: 1px solid var(--c-border);
    margin-bottom: 30px;
}

#add-trajet-btn {
    margin-bottom: 15px;
}

.trajets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.trajets-table th {
    text-align: left;
    padding: 12px;
    background: var(--c-surface2);
    border-bottom: 2px solid var(--c-border);
    white-space: nowrap;
}

.trajets-table td {
    padding: 8px;
    border-bottom: 1px solid var(--c-border);
}

.trajets-table input, .trajets-table select {
    padding: 8px;
    font-size: 0.85rem;
}

.btn-remove {
    background: none;
    border: none;
    color: var(--c-error);
    cursor: pointer;
    font-size: 1.2rem;
}

.total-summary {
    margin-top: 20px;
    text-align: right;
    font-size: 1.25rem;
    color: var(--c-accent);
    font-weight: 700;
}

/* ── SIGNATURE PAD ── */
.signature-wrapper {
    background: #fff;
    border: 2px dashed var(--c-border-hi);
    border-radius: var(--r-md);
    position: relative;
    margin-bottom: 15px;
    touch-action: none;
}

#signature-pad {
    width: 100%;
    height: 200px;
    display: block;
    cursor: crosshair;
}

#clear-signature {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ── WIZARD FOOTER ── */
.wizard-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--c-border);
}

.btn {
    padding: 12px 25px;
    border-radius: var(--r-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-primary { background: var(--c-accent); color: white; }
.btn-primary:hover { background: var(--c-accent-hover); }

.btn-secondary { background: var(--c-surface2); color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover { background: var(--c-border); }

.btn-success { background: var(--c-success); color: white; }
.btn-success:hover { background: #248a52; }

.btn-outline { background: transparent; border: 1.5px solid var(--c-accent); color: var(--c-accent); }

/* ── MODALS ── */
.admin-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0; width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center; justify-content: center;
}

.modal-content {
    background-color: var(--c-surface);
    padding: 30px;
    border-radius: var(--r-lg);
    width: 90%;
}

/* ── ERREURS ── */
.error-msg {
    color: var(--c-error);
    font-size: 0.8rem;
    margin-top: 5px;
    display: block;
}

.form-control.error {
    border-color: var(--c-error);
}

/* ── PRÉVISUALISATION (Étape 5) ── */
.preview-letter-container {
    position: relative;
    background: #f0f2f5;
    padding: 30px;
    border-radius: var(--r-md);
    border: 1px solid var(--c-border);
    margin-bottom: 30px;
}
.preview-paper {
    background: white;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    min-height: 500px;
    padding: 40px;
    border: 1px solid #eee;
}
.preview-textarea {
    width: 100%;
    min-height: 500px;
    border: none;
    outline: none;
    resize: none;
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #333;
    padding: 0;
    margin: 0;
    user-select: none; /* Bloque la sélection standard */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}
.preview-protection-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.protection-msg {
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 15px 25px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.preview-letter-container:focus-within .protection-msg {
    opacity: 0; /* Cacher quand on édite */
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .preview-letter-container { padding: 10px; }
    .preview-paper { padding: 20px; }
    .preview-textarea { font-size: 1rem; }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .form-group.full {
        grid-column: span 1;
    }
    .letter-wizard-wrapper {
        margin: 0;
        border-radius: 0;
    }
    .trajets-table thead { display: none; }
    .trajets-table tr { display: block; margin-bottom: 20px; padding: 15px; background: white; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
    .trajets-table td { display: flex; justify-content: space-between; align-items: center; border: none; padding: 8px 0; }
    .trajets-table td::before {
        content: attr(data-label);
        font-weight: 700;
        font-size: 0.8rem;
        color: var(--c-text-2);
        white-space: nowrap;
        margin-right: 10px;
    }
    .trajets-table td input, .trajets-table td select { width: 60%; }
}

/* ── LIEN SIGNALEMENT BUG ── */
.bug-report-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.85rem;
    color: var(--c-text-2) !important;
    text-decoration: none;
    opacity: 0.6;
    transition: all 0.2s ease;
    padding: 8px 20px;
    border-radius: 20px;
    background: var(--c-surface2);
    border: 1px solid var(--c-border);
}

.bug-report-link:hover {
    opacity: 1;
    color: var(--c-accent) !important;
    background: var(--c-accent-lt);
    border-color: var(--c-accent);
    transform: translateY(-1px);
}
