/* ─── Cloud Sync UI ────────────────────────────────────────────────── */

/* En-tête de la popover des paramètres rapides : titre principal +
   sous-titre (email) quand l'utilisateur est connecté. */
.popover-identity {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.popover-identity .popover-title {
    font-weight: 600;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popover-identity .popover-subtitle {
    font-size: 10.5px;
    color: var(--fg-faint);
    font-family: var(--font-mono);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Bouton de connexion / déconnexion en pied de popover */
.popover-btn-auth {
    color: var(--fg-dim);
}

.popover-btn-auth:hover:not(:disabled) {
    color: var(--fg);
}

.popover-btn-auth.danger {
    color: var(--pink);
}

.popover-btn-auth.danger:hover:not(:disabled) {
    background: rgba(255, 107, 157, 0.08);
    color: var(--pink);
}

/* Modal d'auth : ligne prénom + nom sur 2 colonnes */
.auth-name-row {
    display: flex;
    gap: 10px;
}

.auth-name-row .auth-name-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

@media (max-width: 480px) {
    .auth-name-row {
        flex-direction: column;
    }
}

/* ─── Project progress bar (panneau d'édition projet) ─────────────── */
.project-progress {
    margin: 6px 0 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.project-progress-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.project-progress-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--fg-faint);
    font-family: var(--font-mono);
}

.project-progress-value {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
    color: var(--fg);
    letter-spacing: -0.02em;
}

.project-progress-track {
    height: 6px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.project-progress-fill {
    height: 100%;
    background: linear-gradient(to right, var(--pink), var(--cyan));
    border-radius: 999px;
    transition: width 0.4s ease;
    box-shadow: 0 0 8px rgba(94, 234, 212, 0.25);
}

/* Indicateur global de synchro dans la topbar (à gauche du lang-switcher).
   Affiche une icône cloud animée + le pourcentage en monospace.
   Couvre tous les flux : upload global, download global, sync projet. */
.cloud-sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 8px;
    border: 1px solid rgba(94, 234, 212, 0.35);
    border-radius: 20px;
    background: rgba(94, 234, 212, 0.06);
    color: var(--cyan);
    font-size: 11px;
    font-family: var(--font-mono);
    box-shadow:
        0 0 0 1px rgba(94, 234, 212, 0.04),
        0 0 12px rgba(94, 234, 212, 0.12);
    animation: cloud-sync-fade-in 0.18s ease-out;
}

.cloud-sync-indicator.error {
    border-color: rgba(255, 107, 157, 0.4);
    background: rgba(255, 107, 157, 0.06);
    color: var(--pink);
    box-shadow:
        0 0 0 1px rgba(255, 107, 157, 0.04),
        0 0 12px rgba(255, 107, 157, 0.12);
}

.cloud-sync-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    animation: cloud-sync-spin 1.4s linear infinite;
}

.cloud-sync-icon-no-animation {
    width: 14px !important;
    height: 14px !important;
    flex-shrink: 0;
}

/* Inverse la flèche selon le sens de la synchro */
.cloud-sync-indicator.download .cloud-sync-arrow {
    transform: rotate(180deg);
    transform-origin: 50% 50%;
}

.cloud-sync-pct {
    width: auto;
    text-align: right;
    letter-spacing: -0.02em;
}

@keyframes cloud-sync-spin {
    from {
        transform: rotate(0);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes cloud-sync-fade-in {
    from {
        opacity: 0;
        transform: translateY(-2px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bouton de synchro projet (topbar, à côté du nom du projet) */
.project-sync-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--fg-dim);
    margin-left: 4px;
    transition:
        background 0.15s,
        border-color 0.15s,
        color 0.15s;
    flex-shrink: 0;
    position: relative;
}

.project-sync-btn.visible {
    display: inline-flex;
}

.project-sync-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--fg);
}

.project-sync-btn:disabled {
    opacity: 0.7;
    cursor: progress;
}

.project-sync-btn svg {
    width: 13px;
    height: 13px;
}

.project-sync-btn.syncing {
    color: var(--cyan);
    border-color: rgba(94, 234, 212, 0.35);
    background: rgba(94, 234, 212, 0.06);
}

.project-sync-btn.syncing svg {
    animation: cloud-sync-spin 1.2s linear infinite;
}

/* ─── Modal d'authentification cloud ───────────────────────────────── */

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 4px;
    margin-bottom: 4px;
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--fg-dim);
    font-size: 12.5px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    transition:
        background 0.15s,
        color 0.15s,
        box-shadow 0.15s;
    font-family: inherit;
}

.auth-tab:hover {
    color: var(--fg);
}

.auth-tab.active {
    background: var(--bg-active);
    color: var(--fg);
    box-shadow: 0 0 0 1px var(--border-strong);
}

.cloud-auth-error {
    background: rgba(255, 107, 157, 0.06);
    border: 1px solid rgba(255, 107, 157, 0.3);
    border-radius: var(--r-md);
    padding: 10px 12px;
    font-size: 12px;
    color: var(--pink);
    line-height: 1.5;
}

.cloud-auth-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: var(--fg-faint);
    font-family: var(--font-mono);
}

.cloud-auth-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--fg-faint);
    flex-shrink: 0;
}

.cloud-auth-status.connected {
    color: var(--green);
}

.cloud-auth-status.connected::before {
    background: var(--green);
    box-shadow: 0 0 4px rgba(74, 222, 128, 0.5);
}

.cloud-auth-host {
    font-family: var(--font-mono);
    color: var(--fg-faint);
}

/* Section info compte dans le pied de modal */
.cloud-auth-foot-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
