/**
 * RPA Public Listings - Styles
 *
 * Design sobre et professionnel pour RPAaVendre.com
 * Compatible avec la plupart des thèmes WordPress
 */

/* ==========================================
   VARIABLES
   ========================================== */

:root {
    --rpa-primary: #1e3a5f;
    --rpa-secondary: #2d5a87;
    --rpa-accent: #3498db;
    --rpa-success: #27ae60;
    --rpa-warning: #f39c12;
    --rpa-text: #333333;
    --rpa-text-light: #666666;
    --rpa-border: #e0e0e0;
    --rpa-bg-light: #f8f9fa;
    --rpa-bg-card: #ffffff;
    --rpa-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --rpa-radius: 8px;
    --rpa-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ==========================================
   COMMON
   ========================================== */

.rpa-error,
.rpa-empty {
    padding: 2rem;
    text-align: center;
    color: var(--rpa-text-light);
    background: var(--rpa-bg-light);
    border-radius: var(--rpa-radius);
    font-family: var(--rpa-font);
}

/* ==========================================
   LISTINGS GRID (LISTE)
   ========================================== */

.rpa-listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

/* ==========================================
   CARD (LISTE)
   ========================================== */

.rpa-card {
    background: var(--rpa-bg-card);
    border-radius: var(--rpa-radius);
    box-shadow: var(--rpa-shadow);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    font-family: var(--rpa-font);
}

.rpa-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Card Image */
.rpa-card__image {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--rpa-bg-light);
}

.rpa-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.rpa-card__image--placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rpa-text-light);
    font-size: 0.875rem;
}

.rpa-card__ai-notice {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.7rem;
    line-height: 1.3;
    text-align: center;
}

/* Card Content */
.rpa-card__content {
    padding: 1.25rem;
}

.rpa-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.rpa-card__type {
    font-weight: 600;
    color: var(--rpa-primary);
    font-size: 1rem;
}

.rpa-card__badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.rpa-card__badge--new_mandate {
    background: var(--rpa-accent);
    color: #fff;
}

.rpa-card__badge--price_adjustment {
    background: var(--rpa-warning);
    color: #fff;
}

.rpa-card__badge--financeable_opp {
    background: var(--rpa-success);
    color: #fff;
}

.rpa-card__meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
    color: var(--rpa-text-light);
}

.rpa-card__price {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--rpa-primary);
    margin-bottom: 0.75rem;
}

.rpa-card__teaser {
    font-size: 0.875rem;
    color: var(--rpa-text);
    line-height: 1.5;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rpa-card__link {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    background: var(--rpa-primary);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s ease;
}

.rpa-card__link:hover {
    background: var(--rpa-secondary);
    color: #fff !important;
}

/* ==========================================
   DETAIL PAGE
   ========================================== */

.rpa-detail {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
    font-family: var(--rpa-font);
    color: var(--rpa-text);
}

/* Detail Header */
.rpa-detail__header {
    background: var(--rpa-primary);
    color: #fff;
    padding: 2rem;
    border-radius: var(--rpa-radius);
    margin-bottom: 2rem;
}

.rpa-detail__type-badge {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.rpa-detail__type {
    font-size: 1.5rem;
    font-weight: 700;
}

.rpa-detail__status {
    padding: 0.375rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.rpa-detail__status--new_mandate {
    background: var(--rpa-accent);
}

.rpa-detail__status--price_adjustment {
    background: var(--rpa-warning);
}

.rpa-detail__status--financeable_opp {
    background: var(--rpa-success);
}

.rpa-detail__location {
    margin-bottom: 0.5rem;
}

.rpa-detail__region {
    font-weight: 600;
    margin-right: 0.5rem;
}

.rpa-detail__proximity {
    opacity: 0.9;
}

.rpa-detail__capacity {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Detail Image */
.rpa-detail__image-section {
    text-align: center;
}

.rpa-detail__image {
    max-width: 100%;
    border-radius: var(--rpa-radius);
    box-shadow: var(--rpa-shadow);
}

.rpa-detail__ai-notice {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--rpa-text-light);
    font-style: italic;
    white-space: pre-line;
}

/* Detail Teaser */
.rpa-detail__teaser {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--rpa-text);
    padding: 1.5rem;
    background: var(--rpa-bg-light);
    border-left: 4px solid var(--rpa-accent);
    border-radius: 0 var(--rpa-radius) var(--rpa-radius) 0;
}

/* Detail Sections */
.rpa-detail__section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--rpa-border);
}

.rpa-detail__section h2 {
    font-size: 1.25rem;
    color: var(--rpa-primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--rpa-accent);
    display: inline-block;
}

/* Definition List */
.rpa-detail__list {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 0.75rem 1.5rem;
}

.rpa-detail__list dt {
    font-weight: 600;
    color: var(--rpa-text-light);
}

.rpa-detail__list dd {
    margin: 0;
    color: var(--rpa-text);
}

/* Financial Section */
.rpa-detail__financial-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.rpa-detail__financial-item {
    background: var(--rpa-bg-light);
    padding: 1rem;
    border-radius: var(--rpa-radius);
    text-align: center;
}

.rpa-detail__financial-item--highlight {
    background: var(--rpa-primary);
    color: #fff;
}

.rpa-detail__financial-item--highlight .rpa-detail__financial-label {
    color: rgba(255, 255, 255, 0.8);
}

.rpa-detail__financial-label {
    display: block;
    font-size: 0.8rem;
    color: var(--rpa-text-light);
    margin-bottom: 0.25rem;
}

.rpa-detail__financial-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.rpa-detail__financial-year {
    font-size: 0.875rem;
    color: var(--rpa-text-light);
    margin-bottom: 0.5rem;
}

.rpa-detail__disclaimer {
    font-size: 0.8rem;
    color: var(--rpa-text-light);
    font-style: italic;
    padding: 1rem;
    background: #fff3cd;
    border-radius: var(--rpa-radius);
}

/* Elements (Favorable/Limiting) */
.rpa-detail__elements {
    margin-top: 1.5rem;
}

.rpa-detail__elements h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.rpa-detail__elements ul {
    margin: 0;
    padding-left: 1.25rem;
}

.rpa-detail__elements li {
    margin-bottom: 0.375rem;
}

.rpa-detail__elements--favorable h3 {
    color: var(--rpa-success);
}

.rpa-detail__elements--limiting h3 {
    color: var(--rpa-warning);
}

/* CTA */
.rpa-detail__cta {
    text-align: center;
    padding: 2rem;
    margin: 2rem 0;
    background: var(--rpa-bg-light);
    border-radius: var(--rpa-radius);
}

.rpa-detail__cta-button {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--rpa-success);
    color: #fff !important;
    text-decoration: none !important;
    border-radius: var(--rpa-radius);
    font-size: 1.125rem;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.2s ease;
}

.rpa-detail__cta-button:hover {
    background: #219a52;
    color: #fff !important;
    transform: translateY(-2px);
}

/* Favorite Button */
.rpa-detail__favorite-button {
    display: inline-block;
    margin-top: 0.75rem;
    padding: 0.625rem 1.5rem;
    background: transparent;
    color: var(--rpa-primary);
    border: 2px solid var(--rpa-primary);
    border-radius: var(--rpa-radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    font-family: var(--rpa-font);
}

.rpa-detail__favorite-button:hover {
    background: var(--rpa-primary);
    color: #fff;
}

/* ==========================================
   POPUP FAVORIS (Firebase Auth Modal)
   ========================================== */

.rpa-favorite-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.rpa-favorite-popup {
    position: relative;
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    font-family: var(--rpa-font);
    animation: rpaFadeIn 0.2s ease;
}

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

.rpa-favorite-popup__close {
    position: absolute;
    top: 0.75rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--rpa-text-light);
    cursor: pointer;
    line-height: 1;
}

.rpa-favorite-popup__close:hover {
    color: var(--rpa-text);
}

.rpa-favorite-popup__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--rpa-primary);
    margin: 0 0 0.25rem;
}

.rpa-favorite-popup__subtitle {
    font-size: 0.875rem;
    color: var(--rpa-text-light);
    margin: 0 0 1.5rem;
}

.rpa-favorite-popup__field {
    margin-bottom: 1rem;
}

.rpa-favorite-popup__field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--rpa-text);
    margin-bottom: 0.25rem;
}

.rpa-favorite-popup__field input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--rpa-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: var(--rpa-font);
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.rpa-favorite-popup__field input:focus {
    outline: none;
    border-color: var(--rpa-accent);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.rpa-favorite-popup__error {
    background: #fef2f2;
    color: #dc2626;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.rpa-favorite-popup__submit {
    width: 100%;
    padding: 0.75rem;
    background: var(--rpa-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--rpa-font);
    transition: background 0.2s;
}

.rpa-favorite-popup__submit:hover {
    background: var(--rpa-secondary);
}

.rpa-favorite-popup__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.rpa-favorite-popup__links {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.rpa-favorite-popup__links a {
    color: var(--rpa-accent);
    text-decoration: none;
}

.rpa-favorite-popup__links a:hover {
    text-decoration: underline;
}

.rpa-favorite-popup__sep {
    color: var(--rpa-border);
    margin: 0 0.5rem;
}

.rpa-favorite-popup__success,
.rpa-favorite-popup__reset-ok {
    text-align: center;
    padding: 1.5rem 0;
    font-size: 1rem;
    color: var(--rpa-success);
    font-weight: 600;
}

.rpa-favorite-popup__success small,
.rpa-favorite-popup__reset-ok small {
    font-weight: 400;
    color: var(--rpa-text-light);
    font-size: 0.85rem;
}

.rpa-favorite-popup__success a,
.rpa-favorite-popup__reset-ok a {
    color: var(--rpa-accent);
    text-decoration: none;
}

.rpa-favorite-popup__success a:hover,
.rpa-favorite-popup__reset-ok a:hover {
    text-decoration: underline;
}

/* Legal Notice (Footer) */
.rpa-detail__legal {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--rpa-bg-light);
    border-radius: var(--rpa-radius);
    border-left: 4px solid var(--rpa-text-light);
}

.rpa-detail__legal p {
    font-size: 0.875rem;
    color: var(--rpa-text-light);
    line-height: 1.6;
    margin: 0;
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .rpa-listings-grid {
        grid-template-columns: 1fr;
    }

    .rpa-detail__list {
        grid-template-columns: 1fr;
    }

    .rpa-detail__list dt {
        margin-bottom: 0.25rem;
    }

    .rpa-detail__list dd {
        margin-bottom: 1rem;
    }

    .rpa-detail__header {
        padding: 1.5rem;
    }

    .rpa-detail__type {
        font-size: 1.25rem;
    }

    .rpa-detail__type-badge {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .rpa-detail__financial-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .rpa-card__header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .rpa-card__meta {
        flex-direction: column;
        gap: 0.25rem;
    }

    .rpa-detail__financial-grid {
        grid-template-columns: 1fr;
    }
}
