/**
 * FACT Pieton — Styles page pieton (sans carte)
 *
 * Tous les styles sont scopes sous #fact-pieton avec le prefixe fp-
 * pour eviter les conflits avec Divi et les autres modules FACT.
 *
 * @package FACT
 * @since   2.19.0
 */

/* =============================================================================
   Variables CSS
   ============================================================================= */
#fact-pieton {
    /* Variables pieton — heritent de fact-variables.css via fallback */
    --fp-primary: var(--fact-color-primary, #0052FF);
    --fp-primary-dark: var(--fact-color-primary-dark, #0046D9);
    --fp-primary-bg: var(--fact-color-primary-bg, rgba(0, 82, 255, 0.08));
    --fp-text: var(--fact-color-text, #1C1C1E);
    --fp-text-light: var(--fact-color-text-light, #8E8E93);
    --fp-bg: var(--fact-color-bg, #FFFFFF);
    --fp-bg-secondary: var(--fact-color-bg-secondary, #F2F2F7);
    --fp-border: var(--fact-color-border, rgba(60, 60, 67, 0.12));
    --fp-separator: var(--fact-color-separator, rgba(60, 60, 67, 0.08));
    --fp-success: var(--fact-color-success, #34c759);
    --fp-success-bg: rgba(52, 199, 89, 0.08);
    --fp-info: #5ac8fa;
    --fp-info-bg: rgba(90, 200, 250, 0.08);
    --fp-radius-sm: var(--fact-radius-sm, 10px);
    --fp-radius-md: var(--fact-radius-md, 14px);
    --fp-radius-lg: 20px;
}

/* =============================================================================
   Reset Divi — neutralise les styles parasites dans le scope #fact-pieton
   ============================================================================= */
#fact-pieton,
#fact-pieton *,
#fact-pieton *::before,
#fact-pieton *::after {
    box-sizing: border-box;
}

#fact-pieton {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--fp-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    max-width: 480px;
    margin: 0 auto;
    padding: 0 0 40px;
    background: var(--fp-bg);
}

#fact-pieton h1,
#fact-pieton h2,
#fact-pieton h3,
#fact-pieton p {
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

#fact-pieton a {
    text-decoration: none;
    color: inherit;
}

#fact-pieton button {
    font-family: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

#fact-pieton ul,
#fact-pieton ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

#fact-pieton img {
    max-width: 100%;
    display: block;
}

/* =============================================================================
   Bouton retour
   ============================================================================= */
.fp-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    margin: 16px 16px 0;
    background: var(--fp-bg-secondary);
    border: none;
    border-radius: var(--fp-radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--fp-text-light);
    transition: background 0.15s ease;
}

.fp-back:active {
    background: var(--fp-border);
}

.fp-back svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* =============================================================================
   Hero / Header
   ============================================================================= */
.fp-hero {
    padding: 24px 20px 20px;
}

.fp-hero__title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--fp-text);
    margin-bottom: 8px;
}

.fp-hero__title em {
    font-style: italic;
    color: var(--fp-primary);
}

.fp-hero__desc {
    font-size: 15px;
    color: var(--fp-text-light);
    line-height: 1.5;
}

/* =============================================================================
   Barre de recherche
   ============================================================================= */
.fp-search {
    position: relative;
    margin: 0 16px 12px;
}

.fp-search__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--fp-text-light);
    pointer-events: none;
}

.fp-search__input {
    width: 100%;
    height: 44px;
    padding: 0 40px 0 42px;
    border: 1px solid var(--fp-border);
    border-radius: 12px;
    background: var(--fp-bg-secondary);
    font-size: 15px;
    font-family: inherit;
    color: var(--fp-text);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.fp-search__input::placeholder {
    color: var(--fp-text-light);
}

.fp-search__input:focus {
    border-color: var(--fp-primary);
    background: var(--fp-bg);
}

.fp-search__clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--fp-text-light);
    display: none;
    align-items: center;
    justify-content: center;
}

.fp-search__clear svg {
    width: 18px;
    height: 18px;
}

/* =============================================================================
   Filtres chips
   ============================================================================= */
.fp-filters {
    display: flex;
    gap: 8px;
    padding: 0 16px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.fp-filters::-webkit-scrollbar {
    display: none;
}

.fp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 100px;
    border: 1px solid var(--fp-border);
    background: var(--fp-bg);
    font-size: 14px;
    font-weight: 500;
    color: var(--fp-text);
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.fp-chip:active {
    transform: scale(0.97);
}

.fp-chip--active {
    background: var(--fp-primary);
    border-color: var(--fp-primary);
    color: #ffffff;
}

.fp-chip--active .fp-chip__count {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
}

.fp-chip__dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.fp-chip__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.fp-chip__icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.fp-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 100px;
    background: var(--fp-bg-secondary);
    font-size: 12px;
    font-weight: 600;
    color: var(--fp-text-light);
    line-height: 1;
}

/* =============================================================================
   Liste des commerces
   ============================================================================= */
.fp-list {
    padding: 0 16px;
}

.fp-commerce {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--fp-separator);
    cursor: pointer;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.fp-commerce:last-child {
    border-bottom: none;
}

.fp-commerce:active {
    background: var(--fp-bg-secondary);
    border-radius: var(--fp-radius-sm);
}

/* Icone commerce (rond avec SVG) */
.fp-commerce__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    flex-shrink: 0;
}

.fp-commerce__icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* Texte commerce */
.fp-commerce__body {
    flex: 1;
    min-width: 0;
}

.fp-commerce__name {
    font-size: 16px;
    font-weight: 600;
    color: var(--fp-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-commerce__address {
    font-size: 13px;
    color: var(--fp-text-light);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Badge ouvert/ferme */
.fp-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    margin-top: 4px;
}

.fp-badge--open {
    background: rgba(52, 199, 89, 0.12);
    color: #1a8f3c;
}

.fp-badge--closed {
    background: rgba(255, 59, 48, 0.1);
    color: #d42b20;
}

/* Zone droite : badge + chevron */
.fp-commerce__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.fp-commerce__chevron {
    width: 20px;
    height: 20px;
    color: var(--fp-text-light);
    opacity: 0.5;
    flex-shrink: 0;
}

/* =============================================================================
   Fiche detail commerce (bottom sheet overlay)
   ============================================================================= */
.fp-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    transition: background 0.3s ease;
}

.fp-detail-overlay--visible {
    background: rgba(0, 0, 0, 0.4);
    pointer-events: auto;
}

.fp-detail-sheet {
    background: var(--fp-bg);
    border-radius: var(--fp-radius-lg) var(--fp-radius-lg) 0 0;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 calc(24px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    pointer-events: none;
}

.fp-detail-overlay--visible .fp-detail-sheet {
    transform: translateY(0);
    pointer-events: auto;
}

.fp-detail__handle {
    width: 36px;
    height: 5px;
    border-radius: 3px;
    background: var(--fp-border);
    margin: 12px auto 8px;
}

.fp-detail__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--fp-bg-secondary);
    color: var(--fp-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.fp-detail__close svg {
    width: 18px;
    height: 18px;
}

.fp-detail__close:active {
    background: var(--fp-border);
}

/* Header detail */
.fp-detail__header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px 16px;
}

.fp-detail__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 14px;
    flex-shrink: 0;
}

.fp-detail__icon svg {
    width: 26px;
    height: 26px;
    display: block;
}

.fp-detail__title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--fp-text);
}

.fp-detail__type {
    font-size: 14px;
    color: var(--fp-text-light);
    margin-top: 2px;
}

/* Sections detail */
.fp-detail__section {
    padding: 0 20px;
    margin-bottom: 16px;
}

.fp-detail__section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--fp-text-light);
    margin-bottom: 6px;
}

.fp-detail__section-text {
    font-size: 15px;
    color: var(--fp-text);
    line-height: 1.5;
}

/* Boutons action (tel, site web) */
.fp-detail__actions {
    display: flex;
    gap: 10px;
    padding: 8px 20px 0;
}

.fp-detail__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    height: 48px;
    padding: 0 16px;
    border: 1px solid var(--fp-border);
    border-radius: 12px;
    background: var(--fp-bg);
    font-size: 15px;
    font-weight: 600;
    color: var(--fp-primary);
    transition: background 0.15s ease;
}

.fp-detail__btn:active {
    background: var(--fp-bg-secondary);
}

.fp-detail__btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* =============================================================================
   Horaires (fact-hours.js) — styles complets car fact-frontend.css n'est pas charge
   ============================================================================= */
#fact-pieton .fact-horaires {
    margin: 0;
    border-top: 1px solid var(--fp-separator);
    border-bottom: 1px solid var(--fp-separator);
}

#fact-pieton .fact-horaires__toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: 14px;
    -webkit-tap-highlight-color: transparent;
}

#fact-pieton .fact-horaires__toggle:hover {
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
}

#fact-pieton .fact-horaires__toggle:focus {
    outline: none;
}

#fact-pieton .fact-horaires__toggle:focus-visible {
    outline: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 6px;
}

#fact-pieton .fact-horaires__ico {
    width: 16px;
    height: 16px;
    color: var(--fp-text-light);
    flex-shrink: 0;
}

#fact-pieton .fact-horaires__badge {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

#fact-pieton .fact-horaires__badge--ouvert {
    color: #34c759;
}

#fact-pieton .fact-horaires__badge--bientot {
    color: #FF9500;
}

#fact-pieton .fact-horaires__badge--ferme {
    color: #FF3B30;
}

#fact-pieton .fact-horaires__chevron {
    width: 18px;
    height: 18px;
    color: var(--fp-text-light);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

#fact-pieton .fact-horaires__toggle[aria-expanded="true"] .fact-horaires__chevron {
    transform: rotate(180deg);
}

#fact-pieton .fact-horaires__semaine {
    padding-bottom: 8px;
}

#fact-pieton .fact-horaires__ligne {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 3px 0;
    font-size: 13px;
    color: var(--fp-text-light);
}

#fact-pieton .fact-horaires__ligne--actif {
    color: var(--fp-text);
    font-weight: 600;
}

#fact-pieton .fact-horaires__jour {
    min-width: 36px;
    flex-shrink: 0;
}

#fact-pieton .fact-horaires__creneaux {
    text-align: right;
    color: var(--fp-text);
}

#fact-pieton .fact-horaires__creneaux--ferme {
    color: var(--fp-text-light);
    font-style: italic;
}

/* =============================================================================
   Popup de bienvenue
   ============================================================================= */
.fp-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0);
    pointer-events: none;
    transition: background 0.3s ease;
}

.fp-overlay--visible {
    background: rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.fp-popup {
    background: var(--fp-bg);
    border-radius: var(--fp-radius-lg);
    max-width: 400px;
    width: calc(100% - 48px);
    padding: 32px 24px 24px;
    text-align: center;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15), 0 2px 12px rgba(0, 0, 0, 0.08);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1),
                opacity 0.3s ease;
    pointer-events: none;
}

.fp-overlay--visible .fp-popup {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.fp-popup__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--fp-primary-bg);
    color: var(--fp-primary);
}

.fp-popup__icon svg {
    width: 28px;
    height: 28px;
}

.fp-popup__title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--fp-text);
    margin-bottom: 8px;
}

.fp-popup__subtitle {
    font-size: 14px;
    color: var(--fp-text-light);
    line-height: 1.5;
    margin-bottom: 24px;
    padding: 0 8px;
}

/* Cards info dans le popup */
.fp-popup__cards {
    text-align: left;
    margin-bottom: 24px;
}

.fp-popup__card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--fp-bg-secondary);
    border-radius: var(--fp-radius-sm);
    margin-bottom: 10px;
}

.fp-popup__card:last-child {
    margin-bottom: 0;
}

.fp-popup__card-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
}

.fp-popup__card-icon--success {
    background: var(--fp-success-bg);
    color: #1a8f3c;
}

.fp-popup__card-icon--info {
    background: var(--fp-info-bg);
    color: #0891b2;
}

.fp-popup__card-icon svg {
    width: 20px;
    height: 20px;
}

.fp-popup__card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--fp-text);
    margin-bottom: 2px;
}

.fp-popup__card-desc {
    font-size: 13px;
    color: var(--fp-text-light);
    line-height: 1.4;
}

/* Bouton CTA */
.fp-popup__btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 52px;
    padding: 0 24px;
    border: none;
    border-radius: 14px;
    background: var(--fp-primary);
    color: #ffffff;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    transition: transform 0.15s ease;
}

.fp-popup__btn:active {
    transform: scale(0.97);
}

/* =============================================================================
   Etats d'affichage (loading, empty)
   ============================================================================= */
.fp-loading {
    padding: 0 16px;
}

.fp-skeleton {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--fp-separator);
}

.fp-skeleton__icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: var(--fp-bg-secondary);
    animation: fp-pulse 1.5s ease-in-out infinite;
}

.fp-skeleton__lines {
    flex: 1;
}

.fp-skeleton__line {
    height: 14px;
    border-radius: 7px;
    background: var(--fp-bg-secondary);
    animation: fp-pulse 1.5s ease-in-out infinite;
    margin-bottom: 8px;
}

.fp-skeleton__line:last-child {
    margin-bottom: 0;
}

.fp-skeleton__line--lg {
    width: 70%;
}

.fp-skeleton__line--sm {
    width: 45%;
    height: 12px;
}

@keyframes fp-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Sentinelle lazy loading */
#fp-lazy-sentinel {
    padding: 0 16px;
}

/* Etat vide */
.fp-empty {
    text-align: center;
    padding: 48px 32px;
}

.fp-empty__icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--fp-text-light);
    opacity: 0.5;
}

.fp-empty__icon svg {
    width: 48px;
    height: 48px;
}

.fp-empty__title {
    font-size: 17px;
    font-weight: 600;
    color: var(--fp-text);
    margin-bottom: 6px;
}

.fp-empty__subtitle {
    font-size: 14px;
    color: var(--fp-text-light);
    line-height: 1.5;
}

.fp-empty__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--fp-radius-sm);
    background: var(--fp-primary);
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
}

.fp-empty__btn:active {
    transform: scale(0.97);
}

/* =============================================================================
   Footer
   ============================================================================= */
.fp-footer {
    text-align: center;
    padding: 32px 20px 16px;
    font-size: 12px;
    color: var(--fp-text-light);
    opacity: 0.6;
}

/* =============================================================================
   Highlight recherche
   ============================================================================= */
#fact-pieton mark {
    background: rgba(52, 152, 219, 0.15);
    color: inherit;
    border-radius: 2px;
    padding: 0 1px;
}

/* =============================================================================
   Selecteur multi-chantier
   ============================================================================= */
.fp-chantier-list {
    padding: 0 16px;
}

.fp-chantier {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    margin-bottom: 10px;
    background: var(--fp-bg-secondary);
    border-radius: var(--fp-radius-md);
    cursor: pointer;
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.fp-chantier:active {
    background: var(--fp-border);
}

.fp-chantier__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: var(--fp-primary-bg);
    color: var(--fp-primary);
}

.fp-chantier__icon svg {
    width: 22px;
    height: 22px;
}

.fp-chantier__text {
    flex: 1;
    min-width: 0;
}

.fp-chantier__name {
    font-size: 16px;
    font-weight: 600;
    color: var(--fp-text);
}

.fp-chantier__addr {
    font-size: 13px;
    color: var(--fp-text-light);
    margin-top: 2px;
}
