/**
 * ========================================
 * MODAL RECHERCHE - Formulaire de recherche personnalise
 * ========================================
 * Couleurs agence: #FF1B8D (pink) et #7B2CBF (violet)
 * ========================================
 */

:root {
    --rech-primary: #FF1B8D;
    --rech-secondary: #7B2CBF;
    --rech-gradient: linear-gradient(135deg, #FF1B8D 0%, #7B2CBF 100%);
    --rech-success: #10b981;
    --rech-error: #ef4444;
    --rech-warning: #f59e0b;
    --rech-gray-100: #f3f4f6;
    --rech-gray-200: #e5e7eb;
    --rech-gray-600: #4b5563;
    --rech-gray-800: #1f2937;
    --rech-transition: all 0.3s ease;
}

/* ========== OVERLAY ========== */
.modal-recherche-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: var(--rech-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

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

/* ========== CONTAINER ========== */
.modal-recherche-container {
    background: white;
    border-radius: 24px;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: var(--rech-transition);
}

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

/* ========== HEADER ========== */
.modal-recherche-header {
    background: var(--rech-gradient);
    padding: 25px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
}

.modal-recherche-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
}

.modal-recherche-header h2 i {
    font-size: 1.6rem;
}

.modal-recherche-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: var(--rech-transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-recherche-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ========== BODY ========== */
.modal-recherche-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* ========== PROGRESS STEPS ========== */
.rech-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.rech-step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.4;
    transition: var(--rech-transition);
}

.rech-step.active {
    opacity: 1;
}

.rech-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--rech-gray-200);
    color: var(--rech-gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--rech-transition);
}

.rech-step.active .rech-step-circle {
    background: var(--rech-gradient);
    color: white;
}

.rech-step.completed .rech-step-circle {
    background: var(--rech-success);
    color: white;
}

.rech-step-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rech-gray-600);
}

.rech-step-line {
    width: 40px;
    height: 3px;
    background: var(--rech-gray-200);
    border-radius: 2px;
}

.rech-step-line.completed {
    background: var(--rech-success);
}

/* ========== PHASES ========== */
.rech-phase {
    display: none;
    animation: fadeIn 0.3s ease;
}

.rech-phase.active {
    display: block;
}

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

.rech-section {
    margin-bottom: 25px;
}

.rech-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--rech-gray-800);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rech-section-title i {
    color: var(--rech-primary);
}

/* ========== TYPE DE BIEN ========== */
.rech-types-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.rech-type-card {
    background: var(--rech-gray-100);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 15px 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--rech-transition);
}

.rech-type-card:hover {
    border-color: var(--rech-primary);
    background: rgba(255, 27, 141, 0.05);
}

.rech-type-card.selected {
    border-color: var(--rech-primary);
    background: rgba(255, 27, 141, 0.1);
}

.rech-type-card.selected::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: var(--rech-success);
    color: white;
    border-radius: 50%;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rech-type-card {
    position: relative;
}

.rech-type-icon {
    font-size: 1.8rem;
    margin-bottom: 5px;
    display: block;
}

.rech-type-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rech-gray-800);
}

/* ========== SECTEURS ========== */
.rech-sectors-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.rech-sector-card {
    background: var(--rech-gray-100);
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 12px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--rech-transition);
}

.rech-sector-card:hover {
    border-color: var(--rech-primary);
}

.rech-sector-card.selected {
    border-color: var(--rech-primary);
    background: rgba(255, 27, 141, 0.1);
}

.rech-sector-icon {
    font-size: 1.4rem;
}

.rech-sector-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--rech-gray-800);
}

/* ========== VILLES ========== */
.rech-cities-container {
    max-height: 200px;
    overflow-y: auto;
    padding: 15px;
    background: var(--rech-gray-100);
    border-radius: 12px;
}

.rech-cities-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rech-city-btn {
    background: white;
    border: 2px solid var(--rech-gray-200);
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--rech-transition);
}

.rech-city-btn:hover {
    border-color: var(--rech-primary);
}

.rech-city-btn.selected {
    background: var(--rech-gradient);
    color: white;
    border-color: transparent;
}

/* ========== BUDGET ========== */
.rech-budget-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.rech-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rech-input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rech-gray-600);
}

.rech-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--rech-gray-200);
    border-radius: 10px;
    font-size: 1rem;
    transition: var(--rech-transition);
}

.rech-input:focus {
    outline: none;
    border-color: var(--rech-primary);
}

.rech-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--rech-gray-200);
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: var(--rech-transition);
}

.rech-select:focus {
    outline: none;
    border-color: var(--rech-primary);
}

/* ========== TEXTAREA ========== */
.rech-textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid var(--rech-gray-200);
    border-radius: 12px;
    font-size: 1rem;
    min-height: 100px;
    resize: vertical;
    transition: var(--rech-transition);
}

.rech-textarea:focus {
    outline: none;
    border-color: var(--rech-primary);
}

/* ========== COORDONNEES ========== */
.rech-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

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

/* ========== RADIO BUTTONS ========== */
.rech-radio-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.rech-radio-btn {
    flex: 1;
    min-width: 100px;
    padding: 12px 15px;
    background: var(--rech-gray-100);
    border: 2px solid transparent;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: var(--rech-transition);
    font-size: 0.9rem;
    font-weight: 600;
}

.rech-radio-btn:hover {
    border-color: var(--rech-primary);
}

.rech-radio-btn.selected {
    border-color: var(--rech-primary);
    background: rgba(255, 27, 141, 0.1);
    color: var(--rech-primary);
}

.rech-radio-btn input {
    display: none;
}

/* ========== SECTIONS CONDITIONNELLES ========== */
.rech-conditional {
    display: none;
    margin-top: 15px;
    padding: 20px;
    background: var(--rech-gray-100);
    border-radius: 12px;
    animation: slideDown 0.3s ease;
}

.rech-conditional.show {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

/* ========== FOOTER ========== */
.modal-recherche-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--rech-gray-200);
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.rech-btn {
    padding: 14px 28px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--rech-transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.rech-btn-prev {
    background: var(--rech-gray-200);
    color: var(--rech-gray-800);
    border: none;
}

.rech-btn-prev:hover {
    background: var(--rech-gray-600);
    color: white;
}

.rech-btn-next {
    background: var(--rech-gradient);
    color: white;
    border: none;
    box-shadow: 0 8px 25px rgba(255, 27, 141, 0.3);
}

.rech-btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(255, 27, 141, 0.4);
}

.rech-btn-submit {
    background: var(--rech-success);
    color: white;
    border: none;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.rech-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(16, 185, 129, 0.4);
}

/* ========== SUCCESS STATE ========== */
.rech-success-container {
    text-align: center;
    padding: 40px 20px;
}

.rech-success-icon {
    width: 80px;
    height: 80px;
    background: var(--rech-success);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.rech-success-icon i {
    font-size: 2.5rem;
    color: white;
}

.rech-success-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--rech-gray-800);
    margin-bottom: 15px;
}

.rech-success-text {
    color: var(--rech-gray-600);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.rech-reference-box {
    background: rgba(255, 27, 141, 0.1);
    border: 2px solid var(--rech-primary);
    border-radius: 12px;
    padding: 15px 25px;
    display: inline-block;
    margin-bottom: 25px;
}

.rech-reference-label {
    font-size: 0.85rem;
    color: var(--rech-gray-600);
    margin-bottom: 5px;
}

.rech-reference-code {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--rech-primary);
    letter-spacing: 1px;
}

.rech-btn-close {
    background: var(--rech-gradient);
    color: white;
    border: none;
    padding: 14px 35px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--rech-transition);
}

.rech-btn-close:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 27, 141, 0.3);
}

/* ========== LOADING ========== */
.rech-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
}

.rech-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--rech-gray-200);
    border-top: 4px solid var(--rech-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rech-loading-text {
    color: var(--rech-gray-600);
    font-size: 1rem;
    font-weight: 500;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .modal-recherche-container {
        max-height: 95vh;
        border-radius: 20px;
    }

    .modal-recherche-header {
        padding: 20px;
    }

    .modal-recherche-header h2 {
        font-size: 1.2rem;
    }

    .modal-recherche-body {
        padding: 20px;
    }

    .rech-types-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .rech-sectors-grid {
        grid-template-columns: 1fr;
    }

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

    .rech-progress {
        flex-wrap: wrap;
        gap: 10px;
    }

    .rech-step-label {
        display: none;
    }

    .rech-step-line {
        width: 25px;
    }

    .modal-recherche-footer {
        padding: 15px 20px;
        flex-direction: column;
    }

    .rech-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .modal-recherche-overlay {
        padding: 10px;
    }

    .rech-types-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .rech-type-card {
        padding: 12px 8px;
    }

    .rech-type-icon {
        font-size: 1.5rem;
    }

    .rech-type-label {
        font-size: 0.75rem;
    }
}
