/* Formulaire Services v2 — ICT — Flat Minimalist */
@keyframes fs-spin { to { transform: rotate(360deg); } }
@keyframes fs-in   { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

:root {
    --fsp:         #1a5cff;   /* couleur principale  */
    --fss:         #ff7a00;   /* couleur secondaire (hover) */
    --fsf:         inherit;
    --fsr:         3px;
    --fsborder:    #d0d0d0;
    --fsbg:        #f7f7f7;
    --fstext:      #1a1a1a;
    --fsmuted:     #888;
    --fserror:     #c0392b;
    --fssuccess:   #1a7a4a;
    /* Tile text colors — overridable from back-office */
    --fstile-text:       #1a1a1a;   /* texte tuile (repos) */
    --fstile-text-hover: #ffffff;   /* texte tuile (survol) */
    --fstile-text-on:    #ffffff;   /* texte tuile (actif) */
}

.fs-wrap {
    font-family: var(--fsf);
    color: var(--fstext);
    font-size: 15px;
    line-height: 1.5;
}

/* Success banner */
.fs-success {
    border-left: 4px solid var(--fssuccess);
    background: #f0faf4;
    color: var(--fssuccess);
    padding: 14px 18px;
    font-size: .9rem;
    font-weight: 500;
    animation: fs-in .3s ease;
}

/* ---- Subject tabs (Demande de devis / Contact) ---- */
.fs-tabs {
    display:         flex;
    justify-content: flex-start;
    border-bottom:   2px solid var(--fsborder);
    margin-bottom:   24px;
}

.fs-tab {
    flex-shrink:   0;
    padding:       10px 20px;
    background:    none;
    border:        none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family:   var(--fsf);
    font-size:     .88rem;
    font-weight:   600;
    color:         var(--fsmuted);
    cursor:        pointer;
    transition:    color .15s, border-color .15s;
    letter-spacing: .02em;
    white-space:   nowrap;
}
.fs-tab:hover {
    color:         var(--fss);
    border-bottom: 3px solid var(--fss);
}
.fs-tab--active {
    color:              var(--fsp);
    border-bottom-color: var(--fsp);
}

/* ---- Section ---- */
.fs-section { margin-bottom: 22px; animation: fs-in .25s ease; }

.fs-fieldlabel {
    font-size:      .78rem;
    font-weight:    700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color:          var(--fsmuted);
    margin:         0 0 10px;
}
.fs-req { color: var(--fserror); }

/* ---- Category tab nav (scrollable + arrows) ---- */
.fs-cat-nav {
    display:       flex;
    align-items:   stretch;
    border-bottom: 2px solid var(--fsborder); /* single shared border */
    margin-bottom: 14px;
}

.fs-cat-nav-scroll {
    flex:         1;
    overflow-x:   hidden;  /* hide horizontal scrollbar */
    overflow-y:   visible; /* let margin-bottom: -2px peek through */
    min-width:    0;
}

/* Remove border-bottom from inner .fs-tabs — parent .fs-cat-nav owns it */
.fs-cat-nav .fs-tabs {
    border-bottom:     none;
    margin-bottom:     0;
    flex-wrap:         nowrap;
    overflow-x:        auto;
    scroll-behavior:   smooth;
    scrollbar-width:   none;
    -ms-overflow-style: none;
}
.fs-cat-nav .fs-tabs::-webkit-scrollbar { display: none; }

/* Category tabs share the same .fs-tab style — margin-bottom trick no longer needed */
.fs-cat-nav .fs-tab {
    border-bottom: 3px solid transparent;
    margin-bottom: -2px; /* overlap the parent border */
}
.fs-cat-nav .fs-tab--active {
    border-bottom-color: var(--fsp);
}

/* Arrow buttons — hidden by default, JS shows them when overflow exists */
.fs-cat-nav-arrow {
    flex-shrink:     0;
    display:         flex;
    align-items:     center;
    justify-content: center;
    width:           26px;
    background:      transparent;
    border:          none;
    cursor:          pointer;
    color:           var(--fsmuted);
    padding:         0 0 2px; /* compensate border */
    transition:      color .15s;
    outline:         none;
    visibility:      hidden;
    pointer-events:  none;
}
.fs-cat-nav-arrow.is-visible {
    visibility:     visible;
    pointer-events: auto;
}
.fs-cat-nav-arrow:hover { color: var(--fsp); }

/* ---- Service grid ---- */
.fs-service-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fs-svc-tile {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: flex-start;
    gap:             8px;
    width:           175px;
    height:          auto;
    box-sizing:      border-box;
    background:      #fff;
    border:          1px solid var(--fsborder);
    border-radius:   var(--fsr);
    cursor:          pointer;
    padding:         14px 12px 12px;
    font-family:     var(--fsf);
    font-size:       .78rem;
    font-weight:     600;
    color:           var(--fstile-text);
    text-align:      center;
    line-height:     1.4;
    transition:      border-color .15s, background .15s, color .15s;
}

/* ---- Hover : couleur secondaire ---- */
.fs-svc-tile:hover {
    border-color: var(--fss);
    background:   var(--fss);
    color:        var(--fstile-text-hover);
}
.fs-svc-tile:hover .fs-svc-img        { filter: brightness(0) invert(1); }
.fs-svc-tile:hover .fs-svc-placeholder::before { border-color: rgba(255,255,255,.6); }

/* ---- Active : couleur principale ---- */
.fs-svc-tile.is-on {
    border-color: var(--fsp);
    background:   var(--fsp);
    color:        var(--fstile-text-on);
}
.fs-svc-tile.is-on .fs-svc-img        { filter: brightness(0) invert(1); }
.fs-svc-tile.is-on .fs-svc-placeholder::before { border-color: rgba(255,255,255,.5); }

.fs-svc-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

/* Default icon placeholder (when no media set) */
.fs-svc-placeholder {
    display: block;
    width: 36px;
    height: 36px;
    position: relative;
}
.fs-svc-placeholder::before {
    content: '';
    position: absolute;
    inset: 4px;
    border: 2px solid var(--fsp);
    border-radius: 50%;
}

.fs-svc-name { font-size: .7rem; }

/* ---- Fields ---- */
.fs-fields { margin-top: 4px; }
.fs-row1 { margin-bottom: 10px; }
.fs-row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.fs-field { position: relative; }

.fs-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    background: #fff;
    border: 1px solid var(--fsborder);
    border-radius: var(--fsr);
    font-family: var(--fsf);
    font-size: .88rem;
    color: var(--fstext);
    transition: border-color .15s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.fs-input::placeholder { color: var(--fsmuted); }
.fs-input:focus { border-color: var(--fsp); }
.fs-input.fs-err { border-color: var(--fserror); }
.fs-textarea { resize: vertical; min-height: 120px; }

/* WhatsApp field — same structure as phone prefix */
.fs-wa-prefix {
    cursor:  default;
    padding: 0 12px;
    border-right: 1px solid var(--fsborder);
}
.fs-wa-prefix:hover  { background: transparent; }
.fs-wa-prefix:focus  { background: transparent; outline: none; }

/* ---- Phone field ---- */
.fs-phone-wrap {
    display:   flex;
    align-items: stretch;
    border:    1px solid var(--fsborder);
    border-radius: var(--fsr);
    background: #fff;
    transition: border-color .15s;
    overflow:  visible;
}
.fs-phone-wrap:focus-within { border-color: var(--fsp); }

.fs-phone-prefix-wrap {
    position:    relative;
    flex-shrink: 0;
}

.fs-phone-trigger {
    display:     flex;
    align-items: center;
    gap:         4px;
    padding:     0 10px 0 12px;
    height:      100%;
    min-height:  44px;
    background:  transparent;
    border:      none;
    border-right: 1px solid var(--fsborder);
    font-family: var(--fsf);
    font-size:   .84rem;
    font-weight: 600;
    color:       var(--fstext);
    cursor:      pointer;
    white-space: nowrap;
    box-sizing:  border-box;
    transition:  background .15s;
}
.fs-phone-trigger:hover  { background: var(--fsbg); }
.fs-phone-trigger:focus  { outline: none; background: var(--fsbg); }

.fs-sel-flag { font-size: 1.2rem; line-height: 1; display: block; }
.fs-sel-code { font-size: .8rem; font-weight: 700; letter-spacing: .01em; }
.fs-caret    { color: var(--fsmuted); flex-shrink: 0; margin-left: 2px; }

/* Dropdown panel */
.fs-phone-dropdown {
    position:       absolute;
    top:            calc(100% + 4px);
    left:           0;
    z-index:        99999;
    background:     #fff;
    border:         1px solid var(--fsborder);
    border-radius:  var(--fsr);
    width:          270px;
    box-shadow:     0 6px 20px rgba(0,0,0,.12);
    overflow:       hidden;
    display:        flex;
    flex-direction: column;
    max-height:     300px;
}

.fs-phone-search-row {
    padding: 8px;
    border-bottom: 1px solid var(--fsborder);
    flex-shrink: 0;
}
.fs-phone-search {
    display:      block;
    width:        100%;
    box-sizing:   border-box;
    padding:      7px 10px;
    border:       1px solid var(--fsborder);
    border-radius: var(--fsr);
    font-family:  var(--fsf);
    font-size:    .83rem;
    color:        var(--fstext);
    outline:      none;
    background:   var(--fsbg);
}
.fs-phone-search:focus { border-color: var(--fsp); background: #fff; }

.fs-phone-list {
    list-style:  none;
    margin:      0;
    padding:     3px 0;
    overflow-y:  auto;
    flex:        1;
}
.fs-phone-list::-webkit-scrollbar { width: 5px; }
.fs-phone-list::-webkit-scrollbar-thumb { background: var(--fsborder); border-radius: 3px; }

.fs-phone-opt {
    display:     flex;
    align-items: center;
    gap:         8px;
    padding:     7px 12px;
    cursor:      pointer;
    font-size:   .82rem;
    color:       var(--fstext);
    line-height: 1.3;
    transition:  background .1s;
}
.fs-phone-opt:hover      { background: var(--fsbg); }
.fs-phone-opt.fs-opt--on { background: var(--fsbg); color: var(--fsp); font-weight: 600; }

.fs-opt-flag { font-size: 1.1rem; flex-shrink: 0; width: 22px; text-align: center; }
.fs-opt-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fs-opt-dial { color: var(--fsmuted); font-size: .76rem; flex-shrink: 0; }

/* Number input shares the outer border via parent */
.fs-phone-number {
    flex:          1;
    border:        none !important;
    border-radius: 0 var(--fsr) var(--fsr) 0 !important;
    background:    transparent;
    box-shadow:    none !important;
    padding-left:  10px;
    min-width:     0;
}

/* RGPD */
.fs-rgpd-row { margin-top: 6px; }
.fs-cb-wrap { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: .83rem; color: var(--fsmuted); }
.fs-cb-input { position: absolute; opacity: 0; width: 0; height: 0; }
.fs-cb-box {
    flex-shrink: 0; margin-top: 1px;
    width: 17px; height: 17px;
    border: 1px solid var(--fsborder);
    border-radius: 2px;
    background: #fff;
    transition: background .15s, border-color .15s;
}
.fs-cb-input:checked ~ .fs-cb-box { background: var(--fsp); border-color: var(--fsp); }
.fs-cb-input:checked ~ .fs-cb-box::after {
    content: '';
    display: block;
    width: 9px; height: 5px;
    border: 1.5px solid #fff;
    border-top: none; border-right: none;
    transform: rotate(-45deg) translateY(-1px);
    margin: 4px auto 0;
}
.fs-cb-text a { color: var(--fsp); }

/* Captcha */
.fs-captcha-row { margin: 12px 0; }

/* Error */
.fs-error {
    border-left: 3px solid var(--fserror);
    background: #fdf2f2;
    color: var(--fserror);
    padding: 10px 14px;
    font-size: .84rem;
    margin-bottom: 10px;
    animation: fs-in .25s ease;
}

/* Submit */
.fs-submit-row { margin-top: 10px; }
.fs-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px 24px;
    background: var(--fss);
    color: #fff;
    border: none;
    border-radius: var(--fsr);
    font-family: var(--fsf);
    font-size: .92rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: .03em;
    transition: opacity .15s;
}
.fs-submit-btn:hover { opacity: .9; }
.fs-submit-btn:disabled { opacity: .6; cursor: not-allowed; }
.fs-submit-btn svg circle { animation: fs-spin 1s linear infinite; transform-origin: center; display: block; }

@media (max-width: 768px) {
    .fs-tab { font-size: .6rem; padding: 8px 12px; }
}

@media (max-width: 580px) {
    .fs-row2 { grid-template-columns: 1fr; }
    .fs-svc-tile { width: calc(50% - 4px); }
}
