/*
 * Clean driver.js + filament-tour styles
 * Styled to match Filament v4 with OKLCH color variables
 * Mobile-first responsive design with touch-friendly targets
 */

/* Driver.js core styles */
.driver-active *,
.driver-active .driver-overlay {
    pointer-events: none;
}

.driver-active .driver-active-element,
.driver-active .driver-active-element *,
.driver-popover,
.driver-popover * {
    pointer-events: auto;
}

@keyframes animate-fade-in {
    0% { opacity: 0; }
    to { opacity: 1; }
}

.driver-fade .driver-overlay {
    animation: animate-fade-in .2s ease-in-out;
}

.driver-fade .driver-popover {
    animation: animate-fade-in .2s;
}

/* ===== Popover container ===== */
.driver-popover {
    all: unset;
    box-sizing: border-box;
    margin: 0;
    padding: 1.5rem;
    border-radius: .75rem;
    color: var(--gray-950);
    min-width: 250px !important;
    max-width: min(750px, calc(100vw - 2rem)) !important;
    background-color: #fff;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1), 0 0 0 1px rgb(0 0 0 / .05);
    z-index: 1000000000;
    position: fixed;
    top: 0;
    right: 0;
}

.driver-popover * {
    font-family: var(--font-sans, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji");
}

/* ===== Title ===== */
.driver-popover-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    display: block;
    position: relative;
    margin: 0;
    padding-right: 2rem;
    color: var(--gray-950);
}

/* ===== Close button ===== */
.driver-popover-close-btn {
    all: unset;
    position: absolute;
    top: 0;
    right: 0;
    height: 2.75rem;
    width: 2.75rem;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 2.75rem;
    font-weight: 500;
    color: var(--gray-400);
    z-index: 1;
    text-align: center;
    transition: color .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.driver-popover-close-btn:focus,
.driver-popover-close-btn:hover {
    color: var(--gray-600);
}

/* ===== Description ===== */
.driver-popover-title[style*=block] + .driver-popover-description {
    margin-top: 5px;
}

.driver-popover-description {
    margin-bottom: 0;
    font-size: .875rem;
    line-height: 1.5;
    font-weight: 400;
    color: var(--gray-600);
}

/* ===== Footer ===== */
.driver-popover-footer {
    margin-top: 1rem;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}

.driver-popover-progress-text {
    font-size: .8125rem;
    font-weight: 400;
    color: var(--gray-500);
    white-space: nowrap;
}

/* ===== Base button reset ===== */
.driver-popover-footer button {
    all: unset;
    display: inline-block;
    box-sizing: border-box;
    padding: .5rem .75rem;
    text-decoration: none;
    font-size: .875rem;
    line-height: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: .5rem;
    transition: all 75ms cubic-bezier(.4, 0, .2, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    white-space: nowrap;
}

.driver-popover-footer .driver-popover-btn-disabled {
    opacity: .5;
    pointer-events: none;
}

:not(body):has(> .driver-active-element) {
    overflow: hidden !important;
}

.driver-no-interaction,
.driver-no-interaction * {
    pointer-events: none !important;
}

.driver-popover-navigation-btns {
    display: flex;
    flex-grow: 1;
    justify-content: flex-end;
    gap: .5rem;
}

/* ===== Previous button (Filament secondary style) ===== */
.driver-popover-footer button.driver-popover-prev-btn {
    background-color: #fff;
    color: var(--gray-950);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05), inset 0 0 0 1px rgb(0 0 0 / .1);
}

.driver-popover-footer button.driver-popover-prev-btn:hover {
    background-color: var(--gray-50);
}

.driver-popover-footer button.driver-popover-prev-btn:disabled {
    pointer-events: none;
    opacity: .7;
}

/* ===== Next button (Filament primary style) ===== */
.driver-popover-footer button.driver-popover-next-btn {
    background-color: var(--primary-600);
    color: #fff;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);
}

.driver-popover-footer button.driver-popover-next-btn:hover {
    background-color: var(--primary-500);
}

.driver-popover-footer button.driver-popover-next-btn:focus {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary-500);
}

.driver-popover-footer button.driver-popover-next-btn:disabled {
    pointer-events: none;
    opacity: .7;
}

/* ===== Arrow (light mode) ===== */
.driver-popover-arrow {
    content: "";
    position: absolute;
    border: 5px solid #fff;
}

.driver-popover-arrow-side-over { display: none; }

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

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

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

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

.driver-popover-arrow-side-center { display: none; }

.driver-popover-arrow-side-left.driver-popover-arrow-align-start,
.driver-popover-arrow-side-right.driver-popover-arrow-align-start { top: 15px; }

.driver-popover-arrow-side-bottom.driver-popover-arrow-align-start,
.driver-popover-arrow-side-top.driver-popover-arrow-align-start { left: 15px; }

.driver-popover-arrow-align-end.driver-popover-arrow-side-left,
.driver-popover-arrow-align-end.driver-popover-arrow-side-right { bottom: 15px; }

.driver-popover-arrow-side-bottom.driver-popover-arrow-align-end,
.driver-popover-arrow-side-top.driver-popover-arrow-align-end { right: 15px; }

.driver-popover-arrow-side-left.driver-popover-arrow-align-center,
.driver-popover-arrow-side-right.driver-popover-arrow-align-center {
    top: 50%;
    margin-top: -5px;
}

.driver-popover-arrow-side-bottom.driver-popover-arrow-align-center,
.driver-popover-arrow-side-top.driver-popover-arrow-align-center {
    left: 50%;
    margin-left: -5px;
}

.driver-popover-arrow-none { display: none; }

/* =============================================================
   DARK MODE
   ============================================================= */

.dark .driver-popover {
    background-color: var(--gray-900);
    color: var(--gray-100);
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / .3), 0 1px 2px -1px rgb(0 0 0 / .3), 0 0 0 1px rgb(255 255 255 / .1);
}

.dark .driver-popover-title {
    color: #fff;
}

.dark .driver-popover-close-btn {
    color: var(--gray-500);
}

.dark .driver-popover-close-btn:focus,
.dark .driver-popover-close-btn:hover {
    color: var(--gray-300);
}

.dark .driver-popover-description {
    color: var(--gray-400);
}

.dark .driver-popover-progress-text {
    color: var(--gray-500);
}

.dark .driver-popover-footer button.driver-popover-prev-btn {
    background-color: rgb(255 255 255 / .05);
    color: #fff;
    box-shadow: inset 0 0 0 1px rgb(255 255 255 / .1);
}

.dark .driver-popover-footer button.driver-popover-prev-btn:hover {
    background-color: rgb(255 255 255 / .1);
}

.dark .driver-popover-footer button.driver-popover-next-btn {
    background-color: var(--primary-500);
    color: #fff;
}

.dark .driver-popover-footer button.driver-popover-next-btn:hover {
    background-color: var(--primary-400);
}

.dark .driver-popover-footer button.driver-popover-next-btn:focus {
    box-shadow: 0 0 0 2px var(--gray-900), 0 0 0 4px var(--primary-400);
}

.dark .driver-popover-arrow {
    border-color: var(--gray-900);
}

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

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

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

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

/* =============================================================
   MOBILE RESPONSIVE (< 640px)
   ============================================================= */

@media (max-width: 639px) {
    .driver-popover {
        min-width: 0 !important;
        max-width: calc(100vw - 1.5rem) !important;
        padding: 1.25rem;
        border-radius: .75rem;
        margin: 0 .75rem;
    }

    .driver-popover-title {
        font-size: .9375rem;
    }

    .driver-popover-description {
        font-size: .8125rem;
    }

    /* Larger touch targets for mobile */
    .driver-popover-footer button {
        padding: .625rem 1rem;
        min-height: 2.75rem;
        font-size: .875rem;
    }

    .driver-popover-close-btn {
        height: 3rem;
        width: 3rem;
        font-size: 1.5rem;
        line-height: 3rem;
    }

    .driver-popover-footer {
        flex-wrap: wrap;
    }

    .driver-popover-progress-text {
        width: 100%;
        text-align: center;
        margin-bottom: .25rem;
    }

    .driver-popover-navigation-btns {
        width: 100%;
        justify-content: stretch;
    }

    .driver-popover-navigation-btns button {
        flex: 1;
        text-align: center;
    }
}

/* =============================================================
   SMALL MOBILE (< 400px)
   ============================================================= */

@media (max-width: 399px) {
    .driver-popover {
        max-width: calc(100vw - 1rem) !important;
        padding: 1rem;
        margin: 0 .5rem;
    }

    .driver-popover-title {
        font-size: .875rem;
    }

    .driver-popover-description {
        font-size: .8125rem;
        line-height: 1.4;
    }
}

/* ===== CSS selector helper cursor ===== */
#circle-cursor {
    pointer-events: none;
    cursor: crosshair;
    display: none;
    width: 20px;
    height: 20px;
    background-color: rgb(255 255 255 / .5);
    border-radius: 50%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10000;
    transition: width .3s, height .3s, left .1s, top .1s;
    box-shadow: 0 0 5px 0 var(--gray-950);
}

/* ===== Help button positioning ===== */
.driver-help-button {
    width: 15px;
    height: 15px;
    position: absolute;
    cursor: pointer;
}

.top-left { top: -14px; left: -16px; }
.top-right { top: -14px; right: -16px; }
.bottom-right { bottom: -14px; right: -16px; }
.bottom-left { bottom: -14px; left: -16px; }
