.driver-popover {
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.driver-popover-title {
    color: var(--mangofit-color);
    font-weight: 600;
}

.driver-popover-close-btn:focus {
    outline: unset !important;
}

.driver-popover-prev-btn,
.driver-popover-next-btn {
    border-radius: 999px;
    font-weight: 600;
    border: 1px solid var(--mangofit-color);
}

.driver-popover-next-btn:hover {
    filter: brightness(0.95);
}

/*
 * Premium popover of every guided tour (GuidedTourModule.getDriver() adds the class), in both themes; the rules
 * above stay for any popover created without it.
 */
.driver-popover.mf-guide-popover {
    min-width: min(17rem, calc(100vw - 2rem));
    max-width: min(21rem, calc(100vw - 2rem));
    padding: 1rem 1rem 0.85rem;
    border: 1px solid rgba(var(--contrast-theme-color-rgb), 0.12);
    border-radius: 1rem;
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.22);
}

.driver-popover.mf-guide-popover * {
    font-family: var(--bs-body-font-family);
}

.driver-popover.mf-guide-popover .driver-popover-title {
    padding-right: 1.5rem;
    color: var(--bs-heading-color);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
}

.driver-popover.mf-guide-popover .driver-popover-description {
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
    line-height: 1.5;
}

.driver-popover.mf-guide-popover .driver-popover-close-btn {
    top: 0.5rem;
    right: 0.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    color: var(--bs-secondary-color);
    font-size: 1.25rem;
    line-height: 2rem;
}

.driver-popover.mf-guide-popover .driver-popover-close-btn:hover,
.driver-popover.mf-guide-popover .driver-popover-close-btn:focus-visible {
    color: var(--bs-body-color);
    background: var(--bs-tertiary-bg);
}

.driver-popover.mf-guide-popover .driver-popover-footer {
    gap: 0.75rem;
    margin-top: 0.85rem;
}

.driver-popover.mf-guide-popover .driver-popover-progress-text {
    color: var(--bs-secondary-color);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.driver-popover.mf-guide-popover .driver-popover-footer button {
    min-height: 2.25rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--mangofit-color);
    border-radius: 0.55rem;
    color: #fff;
    background-color: var(--mangofit-color);
    font-size: 0.85rem;
    font-weight: 600;
    text-shadow: none;
    text-align: center;
}

.driver-popover.mf-guide-popover .driver-popover-footer button:hover,
.driver-popover.mf-guide-popover .driver-popover-footer button:focus-visible {
    border-color: var(--mangofit-color-hovered);
    background-color: var(--mangofit-color-hovered);
}

.driver-popover.mf-guide-popover .driver-popover-arrow {
    border-color: var(--bs-body-bg);
}

.driver-popover.mf-guide-popover .driver-popover-arrow-side-left {
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
}

.driver-popover.mf-guide-popover .driver-popover-arrow-side-right {
    border-left-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
}

.driver-popover.mf-guide-popover .driver-popover-arrow-side-top {
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-left-color: transparent;
}

.driver-popover.mf-guide-popover .driver-popover-arrow-side-bottom {
    border-left-color: transparent;
    border-top-color: transparent;
    border-right-color: transparent;
}

.driver-popover.mf-guide-popover .driver-popover-navigation-btns {
    flex-wrap: wrap;
    gap: 0.4rem;
}

.driver-popover.mf-guide-popover .driver-popover-navigation-btns button + button {
    margin-left: 0;
}

/*
 * While a guide of the «Guide» panel runs, the dimmed area does not take clicks (driver.js gives its path an inline
 * pointer-events): a menu, a date picker or a confirmation opened by the highlighted control and drawn outside it
 * stays clickable (guides.css). The rest of the page still does not react, through driver.css.
 */
body.mf-guide-running .driver-overlay path {
    pointer-events: none !important;
}

/* «Avanti» pressed with the field still empty */
.driver-popover.mf-guide-popover .mf-guide-popover-note {
    margin: 0.5rem 0 0;
    color: var(--bs-danger-text-emphasis);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
}

/* A guide still waiting for the app's confirmation after its window closed: nothing of it stays on screen */
body.mf-guide-paused .driver-overlay,
body.mf-guide-paused .driver-popover {
    display: none !important;
}

/* «Fatto!»: «Chiudi» and «Prossima: …» side by side, the longer label wraps inside its own button */
.driver-popover.mf-guide-popover-done .driver-popover-navigation-btns {
    flex-wrap: nowrap;
    align-items: stretch;
}

.driver-popover.mf-guide-popover-done .driver-popover-footer button {
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
}

.driver-popover.mf-guide-popover-done .driver-popover-footer button.mf-guide-popover-secondary-btn {
    flex: 0 0 auto;
}

.driver-popover.mf-guide-popover .driver-popover-footer button.driver-popover-prev-btn,
.driver-popover.mf-guide-popover .driver-popover-footer button.mf-guide-popover-secondary-btn {
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
    background-color: transparent;
}

.driver-popover.mf-guide-popover .driver-popover-footer button.driver-popover-prev-btn:hover,
.driver-popover.mf-guide-popover .driver-popover-footer button.driver-popover-prev-btn:focus-visible,
.driver-popover.mf-guide-popover .driver-popover-footer button.mf-guide-popover-secondary-btn:hover,
.driver-popover.mf-guide-popover .driver-popover-footer button.mf-guide-popover-secondary-btn:focus-visible {
    border-color: var(--bs-border-color);
    background-color: var(--bs-tertiary-bg);
}

/* «Fatto!» has no control to point at: always in the middle of the screen, whatever width «Chiudi» and «Prossima» give
   it (driver.js centres it before «Chiudi» is added) */
.driver-popover.mf-guide-popover.mf-guide-popover-done {
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    left: 50% !important;
    width: min(21rem, calc(100vw - 2rem));
    transform: translate(-50%, -50%);
}

/* «Aggiungi esercizi» of the exercise picker slides in from below: during a guide it is there at once, so the popover
   placed beside it does not follow its slide */
body.mf-guide-running #exercises_library_selection_modal .modal-footer .fade-in-from-bottom {
    animation: none;
}

/* A popover without arrow keeps the arrow's room while driver.js places it: its first frame is where it stays */
.driver-popover.mf-guide-popover .driver-popover-arrow-none {
    display: block;
    visibility: hidden;
}
