/* Guided Tour Styles */
:root {
    --guided-tour-panel-bg: #ffffff;
    --guided-tour-content-text: #444444;
    --guided-tour-controls-border: #f0f0f0;
    --guided-tour-secondary-text: #6c757d;
    --guided-tour-dismiss-text: #999999;
    --guided-tour-divider-text: #dddddd;
    --guided-tour-previous-bg: rgba(0, 153, 204, 0.12);
    --guided-tour-previous-text: #0f4f64;
    --guided-tour-previous-border: rgba(0, 153, 204, 0.32);
    --guided-tour-previous-bg-hover: rgba(0, 153, 204, 0.2);
    --guided-tour-previous-text-hover: #083a4a;
    --guided-tour-previous-border-hover: rgba(0, 153, 204, 0.58);
}

/* When Telerik dark swatch is active, use a dark panel with readable text.
   Header gradient and primary button colors intentionally remain unchanged. */
html:has(#telerik-theme[href*='-dark']) {
    --guided-tour-panel-bg: #1f1f1f;
    --guided-tour-content-text: #e6e6e6;
    --guided-tour-controls-border: #3a3a3a;
    --guided-tour-secondary-text: #c0c6cc;
    --guided-tour-dismiss-text: #a0a6ad;
    --guided-tour-divider-text: #5d646b;
    --guided-tour-previous-bg: rgba(90, 188, 228, 0.22);
    --guided-tour-previous-text: #d6f4ff;
    --guided-tour-previous-border: rgba(90, 188, 228, 0.46);
    --guided-tour-previous-bg-hover: rgba(90, 188, 228, 0.32);
    --guided-tour-previous-text-hover: #effbff;
    --guided-tour-previous-border-hover: rgba(90, 188, 228, 0.72);
}

.guided-tour-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.guided-tour-overlay.active {
    opacity: 1;
    visibility: visible;
}

.guided-tour-popup {
    position: fixed;
    background: var(--guided-tour-panel-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 0;
    z-index: 10000;
    max-width: 400px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    animation: tourPopupSlide 0.3s ease-out;
    opacity: 1;
    visibility: visible;
    transition: top 0.4s cubic-bezier(0.4, 0, 0.2, 1), left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.guided-tour-popup::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 12px solid transparent;
    z-index: 10001;
}

/* Arrow pointing left (for elements to the left of popup) */
.guided-tour-popup.arrow-left::before {
    left: -20px;
    top: 30px;
    border-right-color: #0099CC; /* Changed from white to brand blue */
    filter: drop-shadow(-2px 0 4px rgba(0, 0, 0, 0.1));
}

/* Arrow pointing right (for elements to the right of popup) */
.guided-tour-popup.arrow-right::before {
    right: -24px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: #0099CC; /* Changed from white to brand blue */
}

/* Arrow pointing up (for elements above popup) */
.guided-tour-popup.arrow-up::before {
    top: -20px;
    left: 30px;
    border-bottom-color: #0099CC; /* Changed from white to brand blue */
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.1));
}

/* Arrow pointing down (for elements below popup) */
.guided-tour-popup.arrow-down::before {
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: #0099CC; /* Changed from white to brand blue */
}

.guided-tour-header {
    background: linear-gradient(135deg, #0099CC 0%, #AA7DCE 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px 12px 0 0;
    position: relative;
}

.guided-tour-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.guided-tour-progress {
    font-size: 12px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    backdrop-filter: blur(4px);
}

.guided-tour-content {
    padding: 20px;
    line-height: 1.5;
}

.guided-tour-content p {
    margin: 0;
    color: var(--guided-tour-content-text);
    font-size: 14px;
}

.guided-tour-controls {
    padding: 16px 20px;
    border-top: 1px solid var(--guided-tour-controls-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tour-navigation {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
}

.tour-secondary-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    font-size: 13px;
}

.tour-skip-link,
.tour-dismiss-link {
    color: var(--guided-tour-secondary-text);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 4px 8px;
}

.tour-skip-link:hover {
    color: #0099CC;
    text-decoration: underline;
}

.tour-dismiss-link {
    color: var(--guided-tour-dismiss-text);
}

.tour-dismiss-link:hover {
    color: #dc3545;
    text-decoration: underline;
}

.tour-divider {
    color: var(--guided-tour-divider-text);
    user-select: none;
}

.guided-tour-controls .btn {
    font-size: 13px;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    white-space: nowrap;
}

.guided-tour-controls .btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.guided-tour-controls .btn-primary {
    background: linear-gradient(135deg, #0099CC 0%, #AA7DCE 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 153, 204, 0.2);
}

.guided-tour-controls .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 153, 204, 0.4);
}

.guided-tour-controls .btn-success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    box-shadow: 0 2px 4px rgba(40, 167, 69, 0.2);
}

.guided-tour-controls .btn-success:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.guided-tour-controls .btn-tour-previous {
    background: var(--guided-tour-previous-bg);
    color: var(--guided-tour-previous-text);
    border: 1px solid var(--guided-tour-previous-border);
}

.guided-tour-controls .btn-tour-previous:hover:not(:disabled) {
    background: var(--guided-tour-previous-bg-hover);
    border-color: var(--guided-tour-previous-border-hover);
    color: var(--guided-tour-previous-text-hover);
}

/* Highlight effect for tour elements */
.tour-highlight {
    position: relative;
    z-index: 9998;
    animation: tourHighlight 2s ease-in-out infinite;
}

@keyframes tourHighlight {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(0, 153, 204, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 6px rgba(170, 125, 206, 0.8);
        transform: scale(1.02);
    }
}

/* Special styling for different types of highlighted elements */
.tour-highlight[id*="drawer-id"] {
    border-radius: 8px;
    background-color: rgba(0, 153, 204, 0.1) !important;
    transition: all 0.3s ease;
}

.tour-highlight[id="app-title"] {
    border-radius: 6px;
    padding: 4px 8px;
    background-color: rgba(170, 125, 206, 0.15) !important;
}

.tour-highlight#client-estate-list,
.guided-tour-highlight#client-estate-list {
    border-radius: 18px !important;
    background-color: transparent !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.8), 0 0 30px rgba(170, 125, 206, 0.4);
}

.tour-highlight#estate-search-container,
.guided-tour-highlight#estate-search-container {
    border-radius: 22px !important;
    background-color: transparent !important;
    box-shadow: 0 0 0 5px rgba(102, 126, 234, 0.85), 0 0 40px rgba(170, 125, 206, 0.45);
}

.tour-highlight#estate-search-container::before,
.tour-highlight#estate-search-container::after,
.guided-tour-highlight#estate-search-container::after {
    display: none;
}

.guided-tour-highlight#estate-search-container {
    z-index: 10000 !important;
}

.tour-highlight#estate-search-container,
.guided-tour-highlight#estate-search-container {
    overflow: visible;
}

.tour-highlight#estate-search-container .k-input,
.tour-highlight#estate-search-container .k-input-inner,
.tour-highlight#estate-search-container .k-input::after,
.tour-highlight#estate-search-container .k-input::before,
.guided-tour-highlight#estate-search-container .k-input,
.guided-tour-highlight#estate-search-container .k-input-inner,
.guided-tour-highlight#estate-search-container .k-input::after,
.guided-tour-highlight#estate-search-container .k-input::before {
    border-radius: 999px !important;
}
.guided-tour-highlight#estate-search-container {
    z-index: 9999 !important;
}

.tour-highlight#chat-prompts,
.guided-tour-highlight#chat-prompts {
    border-radius: 20px !important;
    background-color: transparent !important;
    box-shadow: 0 0 40px rgba(0, 153, 204, 0.4), 0 0 50px rgba(170, 125, 206, 0.45);
}

/* Responsive design */
@media (max-width: 768px) {
    .guided-tour-popup {
        max-width: 320px;
        margin: 20px;
    }
    
    .tour-navigation {
        flex-direction: column;
        width: 100%;
    }
    
    .tour-navigation .btn {
        width: 100%;
    }
    
    .tour-secondary-actions {
        font-size: 12px;
    }
}

/* Element highlighting */
.guided-tour-highlight {
    position: relative;
    z-index: 9997 !important;
}

.guided-tour-highlight::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    background: rgba(102, 126, 234, 0.2);
    border: 2px solid #667eea;
    border-radius: 8px;
    pointer-events: none;
    animation: guidedTourPulse 2s infinite;
    z-index: -1;
}

.guided-tour-highlight#client-estate-list,
.guided-tour-highlight#estate-search-container {
    border-radius: 16px !important;
    box-shadow: 0 0 0 4px rgba(0, 153, 204, 0.35), 0 0 25px rgba(170, 125, 206, 0.35);
    animation: tourHighlight 2s ease-in-out infinite;
}

.guided-tour-highlight#client-estate-list::before,

.guided-tour-highlight#estate-search-container::before,
.guided-tour-highlight#chat-prompts::before {
    display: none;
}



@keyframes guidedTourPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(102, 126, 234, 0.1);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .guided-tour-popup {
        min-width: 280px;
        max-width: 90vw;
        margin: 20px;
    }
    
    .guided-tour-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .guided-tour-controls .btn {
        flex: 1;
        min-width: 80px;
    }
}

/* Animation for popup appearance */
.guided-tour-popup {
    animation: guidedTourFadeIn 0.3s ease-out;
}

@keyframes guidedTourFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}
