* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    border: 2px solid #333;
}

.header-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #333;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.logo {
    max-width: 150px;
    height: auto;
}

.mandat-box {
    border: 2px solid #ff8c00;
    padding: 10px;
    text-align: center;
    background: white;
}

.mandat-title {
    font-size: 0.9em;
    font-weight: bold;
    color: #333;
}

.mandat-sepa {
    font-size: 1.2em;
    font-weight: bold;
    color: #333;
    margin-top: 5px;
}

.header-right {
    font-size: 0.75em;
    line-height: 1.4;
    color: #333;
}

.info-text {
    margin-bottom: 10px;
    text-align: justify;
}

.reference-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    margin-bottom: 20px;
    font-size: 0.9em;
    border-bottom: 1px solid #ccc;
}

.ics-line {
    text-align: right;
}

h2 {
    color: #ff8c00;
    font-size: 1em;
    margin-bottom: 15px;
    font-weight: bold;
    text-transform: capitalize;
}

h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.info-box {
    background: #f8f9ff;
    border-left: 4px solid #667eea;
    padding: 20px;
    margin-bottom: 30px;
    border-radius: 5px;
}

.info-box p {
    margin-bottom: 10px;
}

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

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.section {
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border: 1px solid #ddd;
}

.full-width {
    grid-column: 1 / -1;
}

.iban-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
}

.payment-type {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 15px;
}

.payment-type label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: normal;
}

.signature-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.signature-date {
    display: flex;
    align-items: center;
    gap: 10px;
}

.signature-date input[type="date"] {
    max-width: 200px;
}

.signature-date input[type="text"] {
    max-width: 300px;
}

.signature-box {
    display: flex;
    flex-direction: column;
}

.signature-area {
    border: 1px solid #ddd;
    min-height: 80px;
    background: #fafafa;
}

.info-readonly {
    background: white;
    padding: 15px;
    border-radius: 5px;
    border: 1px solid #e0e0e0;
}

.info-readonly p {
    margin-bottom: 8px;
    padding: 5px 0;
}

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

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #555;
}

.required {
    color: #e74c3c;
}

input[type="text"],
select {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

input[type="text"].error {
    border-color: #e74c3c;
}

.help-text {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #888;
}

.error-message {
    color: #e74c3c;
    font-size: 0.9em;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.checkbox-group {
    display: flex;
    align-items: start;
    gap: 10px;
}

.checkbox-group input[type="checkbox"] {
    margin-top: 5px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    font-weight: normal;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.success-box {
    background: #d4edda;
    border: 2px solid #28a745;
    border-radius: 8px;
    padding: 30px;
    margin-top: 30px;
    text-align: center;
}

.success-box h3 {
    color: #28a745;
    margin-bottom: 15px;
}

.success-box p {
    margin-bottom: 20px;
    font-size: 1.1em;
}

.success-box #mandatReference {
    color: #155724;
    font-size: 1.2em;
}

.success-box button {
    margin: 5px;
}

footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
    text-align: center;
    font-size: 0.85em;
    color: #666;
}

footer p {
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    .two-columns {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Loading animation */
.btn-primary.loading {
    position: relative;
    color: transparent;
}

.btn-primary.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Bouton upload signature */
.btn-upload {
    background-color: #3498db;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-upload:hover {
    background-color: #2980b9;
}

#signature-preview img {
    max-width: 200px;
    max-height: 100px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

/* Section Yousign signature électronique */
.yousign-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff5f5 100%);
    border: 2px solid #667eea;
    border-radius: 8px;
}

.yousign-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.yousign-logo {
    width: 32px;
    height: 32px;
}

.yousign-header h3 {
    color: #667eea;
    margin: 0;
    font-size: 1.1em;
}

.yousign-info {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 20px;
    line-height: 1.5;
}

.contact-choice {
    margin-bottom: 20px;
}

.contact-choice-label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.contact-options {
    display: flex;
    gap: 30px;
}

.contact-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
}

.contact-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #667eea;
}

.contact-field {
    max-width: 400px;
}

.contact-field input[type="email"],
.contact-field input[type="tel"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.contact-field input[type="email"]:focus,
.contact-field input[type="tel"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Message de succès signature électronique */
.signature-info {
    font-size: 1em;
    color: #155724;
    margin-bottom: 15px;
    line-height: 1.6;
}

.signature-note {
    font-size: 0.85em;
    color: #666;
    margin-top: 10px;
}

