/* ============================================
   MODAL CORRESPONDANT
============================================ */

/* Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(58, 54, 50, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Container */
.modal-container {
    background: var(--color-white, #FFFFFF);
    border-radius: 24px;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px) scale(0.98);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
}

.modal-overlay.active .modal-container {
    transform: translateY(0) scale(1);
}

/* Close button */
.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--color-bg-alt, #FAF8F5);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.modal-close svg {
    stroke: var(--color-earth, #6B5F54);
    stroke-width: 2;
    fill: none;
}

.modal-close:hover {
    background: var(--color-sand, #E8DED2);
    transform: rotate(90deg);
}

/* Header */
.modal-header {
    text-align: center;
    padding: 2.5rem 2rem 1.5rem;
    border-bottom: 1px solid var(--color-sand, #E8DED2);
}

.modal-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--color-olive, #7D8B6F) 0%, var(--color-forest, #4A5640) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
}

.modal-icon svg {
    stroke: white;
    stroke-width: 1.5;
    fill: none;
}

.modal-title {
    font-family: var(--font-display, 'Libre Baskerville', Georgia, serif);
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--color-charcoal, #3A3632);
    margin-bottom: 0.5rem;
}

.modal-subtitle {
    font-size: 0.95rem;
    color: var(--color-earth, #6B5F54);
}

/* Form */
.modal-form {
    padding: 1.5rem 2rem 2rem;
}

.form-section {
    margin-bottom: 1.75rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--color-cream, #F5EDE4);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 1rem;
    padding-bottom: 0;
}

.form-section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-charcoal, #3A3632);
    margin-bottom: 1.25rem;
}

.form-section-number {
    width: 28px;
    height: 28px;
    background: var(--color-olive, #7D8B6F);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-charcoal, #3A3632);
    margin-bottom: 0.4rem;
}

.form-label .required {
    color: #D97B5C;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--color-sand, #E8DED2);
    border-radius: 10px;
    font-family: var(--font-body, 'DM Sans', sans-serif);
    font-size: 0.95rem;
    color: var(--color-charcoal, #3A3632);
    background: var(--color-white, #FFFFFF);
    transition: all 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-olive, #7D8B6F);
    box-shadow: 0 0 0 3px rgba(125, 139, 111, 0.15);
}

.form-input::placeholder {
    color: var(--color-caramel, #B8A99A);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B5F54' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

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

/* Checkbox consent */
.form-consent {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--color-bg-alt, #FAF8F5);
    border-radius: 10px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--color-sand, #E8DED2);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-top: 2px;
}

.checkbox-label input:checked + .checkbox-custom {
    background: var(--color-olive, #7D8B6F);
    border-color: var(--color-olive, #7D8B6F);
}

.checkbox-label input:checked + .checkbox-custom::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-text {
    font-size: 0.85rem;
    color: var(--color-earth, #6B5F54);
    line-height: 1.5;
}

.checkbox-text a {
    color: var(--color-olive, #7D8B6F);
    text-decoration: underline;
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 0.5rem;
}

.form-actions .btn {
    min-width: 140px;
}

.form-actions .btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.form-actions .btn-primary svg {
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Spinner */
.spinner {
    animation: spin 1s linear infinite;
}

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

/* Success state */
.modal-success {
    padding: 3rem 2rem;
    text-align: center;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--color-olive, #7D8B6F) 0%, var(--color-forest, #4A5640) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    animation: scaleIn 0.4s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.success-icon svg {
    stroke: white;
    stroke-width: 2;
    fill: none;
}

.success-title {
    font-family: var(--font-display, 'Libre Baskerville', Georgia, serif);
    font-size: 1.5rem;
    color: var(--color-charcoal, #3A3632);
    margin-bottom: 0.75rem;
}

.success-text {
    font-size: 0.95rem;
    color: var(--color-earth, #6B5F54);
    line-height: 1.7;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Error state */
.form-input.error {
    border-color: #D97B5C;
    background: #FFF8F6;
}

.form-error {
    font-size: 0.8rem;
    color: #D97B5C;
    margin-top: 0.25rem;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--color-charcoal, #3A3632);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-size: 0.9rem;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.error {
    background: #D97B5C;
}

/* Responsive */
@media (max-width: 640px) {
    .modal-container {
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        margin-top: auto;
    }
    
    .modal-header {
        padding: 2rem 1.5rem 1.25rem;
    }
    
    .modal-title {
        font-size: 1.5rem;
    }
    
    .modal-form {
        padding: 1.25rem 1.5rem 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .form-actions .btn {
        width: 100%;
    }
}
