/* =====================================================================
   webmaps.io — Espace utilisateur
===================================================================== */

/* ---------- Bouton « Mon espace » dans la barre du haut ---------- */

.account-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 180px;
    padding: 4px 12px 4px 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
    color: var(--text);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.account-btn:hover {
    background: #f1f5f9;
    color: var(--text);
}

.account-btn[hidden] {
    display: none;
}

.account-btn-name {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .account-btn {
        padding: 3px;
    }

    .account-btn-name {
        display: none;
    }
}

.account-avatar {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    width: 32px;
    height: 32px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    font-size: 13px;
    font-weight: 700;
}

.account-avatar.large {
    width: 46px;
    height: 46px;
    font-size: 17px;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ---------- Fenêtres (connexion, adresse) ---------- */

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--muted);
}

.modal-close:hover {
    background: #e2e8f0;
    color: var(--text);
}

.auth-content {
    width: min(420px, 100%);
    max-height: calc(100vh - 36px);
    padding: 24px;
    overflow-y: auto;
}

.auth-content h2 {
    margin: 0 40px 4px 0;
    font-size: 21px;
}

.auth-subtitle {
    margin: 0 0 18px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: white;
    color: var(--text);
    font-weight: 600;
}

.btn-google:hover {
    background: #f8fafc;
    color: var(--text);
}

.auth-separator {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 16px 0;
    color: var(--muted);
    font-size: 13px;
}

.auth-separator::before,
.auth-separator::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: 10px;
    background: #f1f5f9;
}

.auth-tab {
    padding: 8px;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
}

.auth-tab:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text);
}

.auth-tab.active {
    background: white;
    color: var(--text);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.auth-form[hidden] {
    display: none;
}

.auth-form label small,
.form-field label small {
    color: var(--muted);
    font-weight: normal;
}

.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.auth-submit {
    width: 100%;
    margin-top: 16px;
    padding: 12px;
}

.auth-status {
    min-height: 0;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.4;
}

.auth-status:empty {
    display: none;
}

.auth-status.error {
    padding: 10px 12px;
    border-radius: 8px;
    background: #fef2f2;
    color: #b91c1c;
}

.auth-status.info {
    color: var(--muted);
}

/* Fenêtre d'adresse */

.address-modal-address {
    margin: 0 36px 10px 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.kind-picker,
.energy-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 4px;
}

.modal-content .kind-picker label,
.kind-picker label,
.energy-picker label {
    display: inline-block;
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

.kind-picker input,
.energy-picker input,
.checkbox-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.kind-picker span,
.energy-picker span,
.checkbox-chip span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
    font-size: 14px;
    transition: background .15s, border-color .15s, color .15s;
}

.kind-picker input:checked + span,
.energy-picker input:checked + span,
.checkbox-chip input:checked + span {
    border-color: var(--blue);
    background: #eff6ff;
    color: var(--blue-dark);
    font-weight: 600;
}

.kind-picker input:focus-visible + span,
.energy-picker input:focus-visible + span,
.checkbox-chip input:focus-visible + span {
    outline: 2px solid var(--blue);
    outline-offset: 2px;
}

.modal-content .checkbox-line,
.checkbox-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 14px 0 0;
    font-size: 14px;
    font-weight: normal;
    cursor: pointer;
}

.checkbox-line input {
    width: 18px;
    height: 18px;
    margin: 0;
}

.checkbox-line .fa-star {
    color: #f59e0b;
}

.modal-actions {
    justify-content: flex-end;
}

/* ---------- Panneau « Mon espace » ---------- */

.account-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    width: min(420px, 100%);
    background: var(--background);
    box-shadow: -8px 0 30px rgba(15, 23, 42, 0.18);
    transform: translateX(100%);
    transition: transform .25s ease;
}

.account-panel.open {
    transform: translateX(0);
}

.account-panel[hidden] {
    display: none;
}

.account-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 60px 14px 16px;
    background: white;
}

.account-identity {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.account-identity strong,
.account-identity span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-identity span {
    color: var(--muted);
    font-size: 13px;
}

.account-header .modal-close {
    top: 50%;
    transform: translateY(-50%);
}

.account-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-bottom: 1px solid var(--border);
    background: white;
}

.account-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
}

.account-tab i {
    font-size: 17px;
}

.account-tab:hover {
    background: #f8fafc;
    color: var(--text);
}

.account-tab.active {
    border-bottom-color: var(--blue);
    color: var(--blue);
}

.account-body {
    flex: 1;
    padding: 14px 14px 30px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.account-section[hidden] {
    display: none;
}

.account-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 18px 0 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.account-subtitle .fa-star {
    color: #f59e0b;
}

.account-note {
    margin: 8px 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.4;
}

.account-note.attribution {
    margin-top: 18px;
    font-size: 12px;
    text-align: center;
}

.account-note a {
    color: var(--blue);
}

.account-loading {
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

.account-empty {
    padding: 24px 16px;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
    text-align: center;
}

.account-empty > i {
    margin-bottom: 6px;
    color: #94a3b8;
    font-size: 26px;
}

.account-empty p {
    margin: 6px 0;
}

.account-wide-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.success {
    background: #dcfce7;
    color: #166534;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
}

.icon-btn:hover {
    background: #e2e8f0;
    color: var(--text);
}

.icon-btn.active {
    color: #f59e0b;
}

button.icon-btn.danger {
    background: transparent;
    color: var(--muted);
}

button.icon-btn.danger:hover {
    background: #fee2e2;
    color: var(--danger);
}

/* ---------- Adresses ---------- */

.quick-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.quick-card {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    color: var(--text);
    font-weight: normal;
    text-align: left;
}

.quick-card:hover {
    border-color: var(--blue);
    background: white;
    color: var(--text);
}

.quick-card > .fa-solid:first-child {
    display: grid;
    flex: 0 0 34px;
    place-items: center;
    height: 34px;
    border-radius: 50%;
    background: #eff6ff;
    color: var(--blue);
}

.quick-card.empty {
    border-style: dashed;
}

.quick-card.empty > .fa-solid:first-child {
    background: #f1f5f9;
    color: #94a3b8;
}

.quick-card-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.quick-card-text small {
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quick-card-go {
    color: var(--blue);
}

.address-list,
.trip-list {
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    list-style: none;
    background: white;
}

.address-item,
.trip-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-right: 6px;
    border-bottom: 1px solid #eef2f7;
}

.address-item:last-child,
.trip-item:last-child {
    border-bottom: 0;
}

.address-main {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-weight: normal;
    text-align: left;
}

.address-main:hover {
    background: #f8fafc;
    color: var(--text);
}

.address-icon,
.saved-search-icon {
    display: grid;
    flex: 0 0 32px;
    place-items: center;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
}

.address-icon.favorite,
.saved-search-icon.favorite {
    background: #fef3c7;
    color: #d97706;
}

.address-icon.kind-home,
.address-icon.kind-work,
.saved-search-icon.kind-home,
.saved-search-icon.kind-work {
    background: #eff6ff;
    color: var(--blue);
}

.address-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.address-text strong,
.address-text small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.address-text small {
    color: var(--muted);
    font-size: 12px;
}

.address-actions {
    display: flex;
    flex: 0 0 auto;
}

/* Adresses dans la recherche */

.saved-search-item .search-result-title,
.saved-search-item .search-result-address {
    display: block;
}

.saved-search-item .search-result-address {
    font-weight: normal;
}

.profile-form > .account-subtitle:first-child {
    margin-top: 0;
}

.saved-search-title {
    margin: 2px 2px 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Fiche d'un résultat de recherche */

.search-popup-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.search-popup-actions .search-popup-go {
    flex: 1;
    margin-top: 0;
}

.search-popup-save {
    padding: 7px 10px;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    background: #fffbeb;
    color: #b45309;
    font-size: 13px;
}

.search-popup-save:hover {
    background: #fef3c7;
    color: #92400e;
}

/* ---------- Historique ---------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (max-width: 380px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
}

.stat-card i {
    color: var(--blue);
    font-size: 15px;
}

.stat-card strong {
    margin-top: 4px;
    font-size: 18px;
    line-height: 1.15;
    white-space: nowrap;
}

.stat-card span {
    color: var(--muted);
    font-size: 12px;
}

.months-chart {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    align-items: end;
    gap: 4px;
    height: 120px;
    padding: 12px 10px 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
}

.month-bar {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
    gap: 4px;
}

.month-bar-fill {
    width: 100%;
    max-width: 22px;
    border-radius: 4px 4px 0 0;
    background: var(--blue);
}

.month-bar-label {
    color: var(--muted);
    font-size: 10px;
}

.mode-split {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.mode-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: white;
    border: 1px solid var(--border);
    font-size: 13px;
}

.trip-mode {
    display: grid;
    flex: 0 0 34px;
    place-items: center;
    height: 34px;
    margin: 0 4px 0 10px;
    border-radius: 50%;
    background: #eff6ff;
    color: var(--blue);
}

.trip-mode.mode-bike {
    background: #ecfdf5;
    color: #047857;
}

.trip-mode.mode-foot {
    background: #fff7ed;
    color: #c2410c;
}

.trip-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    padding: 9px 4px;
}

.trip-text small {
    color: var(--muted);
    font-size: 12px;
}

.trip-text strong {
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trip-details {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin-top: 2px;
    color: #475569;
    font-size: 12px;
}

/* ---------- Véhicule ---------- */

.vehicle-card {
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
}

.vehicle-card.default {
    border-color: #93c5fd;
}

.vehicle-card header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.vehicle-energy {
    display: grid;
    flex: 0 0 40px;
    place-items: center;
    height: 40px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
    font-size: 18px;
}

.vehicle-energy.energy-electric,
.vehicle-energy.energy-plugin_hybrid {
    background: #ecfdf5;
    color: #059669;
}

.vehicle-title {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.vehicle-title small {
    color: var(--muted);
    font-size: 12px;
}

.vehicle-facts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.vehicle-facts span {
    display: flex;
    flex-direction: column;
    padding: 8px;
    border-radius: 10px;
    background: #f8fafc;
}

.vehicle-facts i {
    color: #059669;
    font-size: 13px;
}

.vehicle-facts strong {
    margin-top: 3px;
    font-size: 15px;
    white-space: nowrap;
}

.vehicle-facts small {
    color: var(--muted);
    font-size: 11px;
}

.vehicle-connectors {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
}

.vehicle-card footer {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 12px;
}

.vehicle-card footer button:not(.icon-btn) {
    padding: 8px 10px;
    font-size: 13px;
}

.vehicle-form,
.profile-form {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
}

.profile-form + .profile-form {
    margin-top: 12px;
}

.vehicle-form .account-subtitle {
    margin-top: 0;
}

.catalog-box {
    margin: 12px 0;
    padding: 12px;
    border-radius: 12px;
    background: #f0fdf4;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 10px;
}

.form-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.form-field label,
.connectors-field legend {
    margin: 10px 0 4px;
    font-size: 13px;
    font-weight: 700;
}

.form-field select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--text);
    font: inherit;
}

.form-field input:disabled {
    background: #f8fafc;
    color: var(--muted);
}

.catalog-versions-field[hidden] {
    display: none;
}

.catalog-versions {
    max-height: 230px;
    margin: 6px 0 0;
    padding: 0;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    list-style: none;
    background: white;
}

.catalog-versions li {
    border-bottom: 1px solid #eef2f7;
}

.catalog-versions li:last-child {
    border-bottom: 0;
}

.catalog-versions .account-note,
.catalog-versions .account-loading {
    margin: 0;
    padding: 10px;
}

.catalog-version {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 8px 10px;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font-weight: normal;
    text-align: left;
}

.catalog-version strong {
    font-size: 14px;
}

.catalog-version small {
    color: var(--muted);
    font-size: 12px;
}

.catalog-version:hover {
    background: #f8fafc;
    color: var(--text);
}

.catalog-version.selected {
    background: #dcfce7;
}

.connectors-field {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    border: 0;
}

.connectors-field legend {
    width: 100%;
    padding: 0;
}

.checkbox-chip {
    position: relative;
    cursor: pointer;
}

.checkbox-chip span {
    padding: 6px 10px;
    font-size: 13px;
}

.vehicle-estimate {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #ecfdf5;
    color: #065f46;
    font-size: 14px;
}

.vehicle-estimate[hidden] {
    display: none;
}

.vehicle-estimate small {
    display: block;
    margin-top: 2px;
    color: #047857;
}

@media (max-width: 380px) {
    .form-grid,
    .auth-row {
        grid-template-columns: 1fr;
    }
}

/* Recherches récentes */

.saved-search-title + .saved-search-item {
    margin-top: 0;
}

.search-result-item + .saved-search-title {
    margin-top: 10px;
}

.saved-search-icon.recent {
    background: #f1f5f9;
    color: #64748b;
}

.saved-search-item .search-result-content {
    flex: 1;
}

.recent-remove {
    display: grid;
    flex: 0 0 30px;
    place-items: center;
    height: 30px;
    border-radius: 50%;
    color: #94a3b8;
}

.recent-remove:hover {
    background: #e2e8f0;
    color: var(--text);
}
