/* =================================================================
   Guided Tour Styles - Shepherd.js Theme Customization
   Matches Altorite brand colors and design system
   ================================================================= */

/* Modal Overlay */
.shepherd-modal-overlay-container {
    fill: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

/* Main Popover Container */
.shepherd-element {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color, #E5E7EB);
    max-width: 400px;
    z-index: 10001;
    overflow: hidden;
}

/* Arrow Styling */
.shepherd-arrow,
.shepherd-arrow:before {
    position: absolute;
    width: 16px;
    height: 16px;
    z-index: -1;
}

.shepherd-arrow {
    visibility: hidden;
}

.shepherd-arrow:before {
    visibility: visible;
    content: '';
    transform: rotate(45deg);
    background: white;
    border: 1px solid var(--border-color, #E5E7EB);
}

/* Arrow positioning for different placements */
.shepherd-element[data-popper-placement^='top'] > .shepherd-arrow {
    bottom: -8px;
}

.shepherd-element[data-popper-placement^='bottom'] > .shepherd-arrow {
    top: -8px;
}

.shepherd-element[data-popper-placement^='left'] > .shepherd-arrow {
    right: -8px;
}

.shepherd-element[data-popper-placement^='right'] > .shepherd-arrow {
    left: -8px;
}

/* Header */
.shepherd-header {
    padding: 16px 20px 8px 20px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.shepherd-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #333F48);
    margin: 0;
    letter-spacing: -0.02em;
    line-height: 1.4;
    flex: 1;
}

/* Cancel (X) Button */
.shepherd-cancel-icon {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--text-muted, #9CA3AF);
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    padding: 0;
    margin: -4px -4px 0 8px;
    transition: color 0.2s ease, transform 0.2s ease;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shepherd-cancel-icon:hover {
    color: var(--text-primary, #333F48);
    transform: scale(1.1);
}

.shepherd-cancel-icon:focus {
    outline: 2px solid var(--primary, #3891BB);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Content */
.shepherd-text {
    padding: 8px 20px 16px 20px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary, #6B7280);
}

.shepherd-text p {
    margin: 0 0 12px 0;
}

.shepherd-text p:last-child {
    margin-bottom: 0;
}

/* Footer / Buttons Container */
.shepherd-footer {
    padding: 0 20px 20px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Skip Guide button - positioned left, smaller */
.shepherd-footer .shepherd-skip-guide-btn {
    margin-right: auto;
    font-size: 0.8rem;
    padding: 6px 12px;
    min-width: auto;
    background: transparent;
    border: 1px solid var(--border-color, #E5E7EB);
    color: var(--text-muted, #9CA3AF);
}

.shepherd-footer .shepherd-skip-guide-btn:hover {
    color: var(--primary, #3891BB);
    border-color: var(--primary, #3891BB);
    background: var(--background-light, #F8FAFC);
}

/* Button Base Styles */
.shepherd-button {
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
}

.shepherd-button:focus {
    outline: 2px solid var(--primary, #3891BB);
    outline-offset: 2px;
}

/* Primary Button */
.shepherd-button-primary,
.shepherd-button:not(.shepherd-button-secondary) {
    background: var(--primary, #3891BB);
    color: white;
}

.shepherd-button-primary:hover,
.shepherd-button:not(.shepherd-button-secondary):hover {
    background: var(--primary-hover, #2A6D8E);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 145, 187, 0.35);
}

.shepherd-button-primary:active,
.shepherd-button:not(.shepherd-button-secondary):active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(56, 145, 187, 0.25);
}

/* Secondary Button */
.shepherd-button-secondary {
    background: var(--background-light, #F8FAFC);
    color: var(--text-secondary, #6B7280);
    border: 1px solid var(--border-color, #E5E7EB);
}

.shepherd-button-secondary:hover {
    background: var(--secondary-hover, #F3F4F6);
    border-color: var(--primary, #3891BB);
    color: var(--primary, #3891BB);
}

.shepherd-button-secondary:active {
    background: #E8ECF0;
}

/* Highlighted Element Outline */
.shepherd-target {
    outline: 3px solid var(--primary, #3891BB) !important;
    outline-offset: 4px !important;
    border-radius: 4px;
    position: relative;
    z-index: 10000;
}

/* Pulsing highlight effect for target element */
.shepherd-target-pulse {
    animation: shepherdTargetPulse 1.5s ease-in-out infinite;
}

@keyframes shepherdTargetPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(56, 145, 187, 0.5);
    }
    50% {
        box-shadow: 0 0 0 12px rgba(56, 145, 187, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(56, 145, 187, 0);
    }
}

/* Disable pointer events on highlighted element during tour (highlight-only steps) */
.shepherd-target-click-disabled {
    pointer-events: none !important;
}

/* When a tour step uses allowInteraction, this body class is added so clicks
   always pass through the modal overlay, even if Shepherd resets inline styles. */
body.tour-allow-interaction .shepherd-modal-overlay-container {
    pointer-events: none !important;
}

/* Field highlight for allowInteraction steps.
   Applied as a CSS class directly on the target element so it scrolls with it naturally. */
.shepherd-field-highlight {
    box-shadow: 0 0 0 3px #3891BB !important;
    border-radius: 6px;
    animation: shepherdFieldGlow 2s ease-in-out infinite;
    position: relative;
    z-index: 10002;
}

@keyframes shepherdFieldGlow {
    0%, 100% { box-shadow: 0 0 0 3px #3891BB, 0 0 0 0 rgba(56, 145, 187, 0.35); }
    50%       { box-shadow: 0 0 0 3px #3891BB, 0 0 0 12px rgba(56, 145, 187, 0); }
}

/* Animation for appearing */
.shepherd-element {
    animation: shepherdFadeIn 0.25s ease-out;
}

@keyframes shepherdFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Progress Indicator (optional enhancement) */
.shepherd-progress {
    display: flex;
    gap: 6px;
    padding: 0 20px 16px 20px;
    justify-content: center;
}

.shepherd-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color, #E5E7EB);
    transition: all 0.2s ease;
}

.shepherd-progress-dot.active {
    background: var(--primary, #3891BB);
    transform: scale(1.2);
}

.shepherd-progress-dot.completed {
    background: var(--primary-light, #EBF5FA);
    border: 2px solid var(--primary, #3891BB);
}

/* Centered Steps (when no target element) */
.shepherd-element.shepherd-centered {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* Step Number Badge (optional enhancement) */
.shepherd-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary, #3891BB);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 8px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .shepherd-element {
        max-width: calc(100vw - 32px) !important;
        max-height: calc(100vh - 32px);
        overflow-y: auto;
        margin: 0 16px;
        border-radius: 10px;
        position: fixed !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        top: auto !important;
        bottom: 16px !important;
    }

    .shepherd-arrow {
        display: none;
    }

    .shepherd-header {
        padding: 14px 16px 6px 16px;
    }

    .shepherd-title {
        font-size: 1rem;
    }

    .shepherd-text {
        padding: 6px 16px 14px 16px;
        font-size: 0.9rem;
    }

    .shepherd-footer {
        padding: 0 16px 16px 16px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .shepherd-button {
        width: 100%;
        padding: 12px 18px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .shepherd-element {
        max-width: calc(100vw - 24px) !important;
        margin: 0 12px;
        bottom: 12px !important;
    }

    .shepherd-header {
        padding: 12px 14px 4px 14px;
    }

    .shepherd-text {
        padding: 4px 14px 12px 14px;
    }

    .shepherd-footer {
        padding: 0 14px 14px 14px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .shepherd-element {
        border-width: 2px;
        border-color: #000;
    }

    .shepherd-button-primary,
    .shepherd-button:not(.shepherd-button-secondary) {
        background: #000;
    }

    .shepherd-button-secondary {
        border-width: 2px;
        border-color: #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .shepherd-element {
        animation: none;
    }

    .shepherd-target-pulse {
        animation: none;
    }

    .shepherd-button {
        transition: none;
    }

    .shepherd-cancel-icon {
        transition: none;
    }
}
