/* Gold Union - Formulaire Signature */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f0f4f8;
    color: #333;
    line-height: 1.6;
}

/* Header */
.header {
    background-color: #f0f4f8;
    text-align: center;
    padding: 1.5rem;
}

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

.tagline {
    color: white;
    font-size: 0.9rem;
    opacity: 0.9;
    margin-top: 0.5rem;
}

/* Form Container */
.form-container {
    max-width: 700px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.form-section {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.form-section h2 {
    color: #1a365d;
    border-bottom: 3px solid #1a365d;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

/* Loading */
.form-loading {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.loader-large {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #1a365d;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

/* Rate limit warning */
.rate-limit-warning {
    display: none;
    background: #fed7d7;
    color: #742a2a;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
}

.rate-limit-warning.show {
    display: block;
}

/* Form error */
.form-error {
    text-align: center;
    padding: 2rem;
    background: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: 8px;
}

.form-error button {
    margin-top: 1rem;
    padding: 0.5rem 1rem;
    background: #1a365d;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Error Messages */
.error-message {
    display: none;
    color: #c53030;
    font-size: 0.85rem;
    margin-top: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: #fff5f5;
    border-left: 3px solid #c53030;
    border-radius: 0 4px 4px 0;
}

.form-group.error .error-message {
    display: block;
}

.form-group.error input,
.form-group.error textarea {
    border-color: #c53030;
    background-color: #fff5f5;
}

.form-group.error input:focus,
.form-group.error textarea:focus {
    box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.15);
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #1a365d;
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"] {
    width: 100%;
    max-width: 350px;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #1a365d;
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form-group input[readonly] {
    background-color: #f7fafc;
    cursor: not-allowed;
}

/* SigWeb Status */
.sigweb-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    background: #f7fafc;
    margin-bottom: 1rem;
}

.sigweb-status .status-icon {
    font-size: 1.5rem;
}

.sigweb-status.status-connected {
    background: #c6f6d5;
    color: #22543d;
}

.sigweb-status.status-disconnected {
    background: #fed7d7;
    color: #742a2a;
}

.sigweb-status.status-fallback {
    background: #fefcbf;
    color: #744210;
}

.sigweb-status.status-capturing {
    background: #bee3f8;
    color: #2a4365;
}

.sigweb-status.status-error {
    background: #fed7d7;
    color: #742a2a;
}

/* Signature Area */
.signature-area {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    background: #fafafa;
}

#signatureCanvas {
    display: block;
    width: 100%;
    max-width: 500px;
    height: 150px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    background: white;
    cursor: crosshair;
}

.signature-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Procedure Box */
.procedure-box {
    background: #f7fafc;
    border-left: 4px solid #1a365d;
    padding: 1rem 1.5rem;
    border-radius: 0 8px 8px 0;
}

.procedure-box ol {
    margin-left: 1.25rem;
    margin-bottom: 1rem;
}

.procedure-box li {
    margin-bottom: 0.5rem;
}

.procedure-note {
    font-size: 0.9rem;
    color: #718096;
    font-style: italic;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #1a365d;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #2c5282;
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover:not(:disabled) {
    background: #cbd5e0;
}

.btn-success {
    background: #38a169;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #2f855a;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Form Actions */
.form-actions {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.btn-loader {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-loader::before {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Notification */
.notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
    z-index: 1000;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

.notification.success {
    background: #38a169;
    color: white;
}

.notification.error {
    background: #e53e3e;
    color: white;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        margin: 1rem auto;
    }

    .form-card {
        padding: 1.5rem;
    }

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

    .signature-actions .btn {
        width: 100%;
    }

    #signatureCanvas {
        height: 120px;
    }
}