﻿/* ============================================
   XDOCKET TUTORIAL SYSTEM - BEAUTIFUL TOOLTIPS
   Matches xDocket design system perfectly
   ============================================ */

/* Tutorial Overlay - Subtle background */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(2px);
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

/* Highlighted Element - Clean glow */
.tutorial-highlight {
    position: relative;
    z-index: 9999;
    box-shadow: 0 0 0 4px var(--xd-primary), 0 0 0 8px rgba(var(--xd-primary-rgb), 0.2), 0 8px 32px rgba(0, 0, 0, 0.25);
    border-radius: var(--xd-radius-md);
    transition: all var(--xd-transition-normal);
}

.tutorial-highlight-secondary {
    box-shadow: 0 0 0 2px var(--xd-info), 0 0 0 4px rgba(90, 200, 250, 0.15);
    border-radius: var(--xd-radius-sm);
}

/* Main Tooltip - Beautiful card design */
.tutorial-tooltip {
    position: absolute;
    background: white;
    border-radius: var(--xd-radius-lg);
    box-shadow: var(--xd-shadow-xl);
    padding: 0;
    max-width: 400px;
    min-width: 320px;
    z-index: 10000;
    animation: tooltipSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid var(--xd-gray-200);
    font-family: var(--xd-font-family-base);
}

    /* Tooltip arrow - matches card */
    .tutorial-tooltip::before {
        content: '';
        position: absolute;
        width: 0;
        height: 0;
        border-style: solid;
        filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.06));
    }

    .tutorial-tooltip.bottom::before {
        top: -10px;
        left: 50%;
        transform: translateX(-50%);
        border-width: 0 10px 10px 10px;
        border-color: transparent transparent white transparent;
    }

    .tutorial-tooltip.top::before {
        bottom: -10px;
        left: 50%;
        transform: translateX(-50%);
        border-width: 10px 10px 0 10px;
        border-color: white transparent transparent transparent;
    }

    .tutorial-tooltip.left::before {
        right: -10px;
        top: 50%;
        transform: translateY(-50%);
        border-width: 10px 0 10px 10px;
        border-color: transparent transparent transparent white;
    }

    .tutorial-tooltip.right::before {
        left: -10px;
        top: 50%;
        transform: translateY(-50%);
        border-width: 10px 10px 10px 0;
        border-color: transparent white transparent transparent;
    }

/* Header with brand accent */
.tutorial-header {
    background: linear-gradient(135deg, var(--xd-primary) 0%, var(--xd-secondary) 100%);
    padding: 20px 24px;
    border-radius: var(--xd-radius-lg) var(--xd-radius-lg) 0 0;
    position: relative;
    overflow: hidden;
}

    .tutorial-header::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse"><path d="M 20 0 L 0 0 0 20" fill="none" stroke="white" stroke-width="0.5" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
        opacity: 0.3;
    }

.tutorial-title {
    font-size: 18px;
    font-weight: 600;
    color: white;
    margin: 0;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

    .tutorial-title i {
        font-size: 22px;
        opacity: 0.9;
    }

/* Step counter badge */
.tutorial-step-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: var(--xd-radius-xl);
    font-size: 13px;
    font-weight: 500;
    color: white;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

    .tutorial-step-badge i {
        font-size: 14px;
    }

/* Content area */
.tutorial-content {
    padding: 24px;
    color: var(--xd-gray-700);
    line-height: 1.6;
    font-size: 15px;
    background: white;
}

    .tutorial-content p {
        margin: 0 0 12px 0;
    }

        .tutorial-content p:last-child {
            margin-bottom: 0;
        }

    .tutorial-content strong {
        color: var(--xd-gray-900);
        font-weight: 600;
    }

    .tutorial-content code {
        background: var(--xd-gray-100);
        padding: 2px 6px;
        border-radius: var(--xd-radius-xs);
        font-family: var(--xd-font-family-mono);
        font-size: 13px;
        color: var(--xd-secondary);
    }

/* Tips and hints */
.tutorial-tip {
    display: flex;
    align-items: start;
    gap: 10px;
    background: var(--xd-gray-50);
    padding: 12px 16px;
    border-radius: var(--xd-radius-md);
    margin-top: 16px;
    border-left: 3px solid var(--xd-info);
}

    .tutorial-tip i {
        color: var(--xd-info);
        font-size: 18px;
        margin-top: 2px;
    }

.tutorial-tip-content {
    flex: 1;
    font-size: 14px;
    color: var(--xd-gray-600);
    line-height: 1.5;
}

/* Footer with actions */
.tutorial-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--xd-gray-50);
    border-radius: 0 0 var(--xd-radius-lg) var(--xd-radius-lg);
    border-top: 1px solid var(--xd-gray-200);
}

/* Progress dots */
.tutorial-progress {
    display: flex;
    gap: 6px;
    align-items: center;
}

.tutorial-progress-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--xd-gray-300);
    transition: all var(--xd-transition-normal);
}

    .tutorial-progress-dot.active {
        background: var(--xd-primary);
        width: 24px;
        border-radius: var(--xd-radius-xl);
    }

    .tutorial-progress-dot.completed {
        background: var(--xd-success);
    }

/* Action buttons */
.tutorial-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Skip button - subtle */
.btn-skip-tutorial {
    background: transparent;
    border: 1px solid var(--xd-gray-300);
    color: var(--xd-gray-600);
    padding: 8px 16px;
    border-radius: var(--xd-radius-md);
    cursor: pointer;
    transition: all var(--xd-transition-fast);
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .btn-skip-tutorial:hover {
        background: white;
        border-color: var(--xd-gray-400);
        color: var(--xd-gray-700);
        box-shadow: var(--xd-shadow-sm);
    }

    .btn-skip-tutorial:active {
        transform: translateY(1px);
    }

/* Previous button - ghost style */
.btn-previous-step {
    background: transparent;
    border: none;
    color: var(--xd-gray-600);
    padding: 8px 12px;
    border-radius: var(--xd-radius-md);
    cursor: pointer;
    transition: all var(--xd-transition-fast);
    font-size: 14px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .btn-previous-step:hover {
        background: var(--xd-gray-200);
        color: var(--xd-gray-700);
    }

    .btn-previous-step:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

/* Next button - primary brand */
.btn-next-step {
    background: var(--xd-primary);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: var(--xd-radius-md);
    cursor: pointer;
    transition: all var(--xd-transition-fast);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(var(--xd-primary-rgb), 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

    .btn-next-step:hover {
        background: #0066DD;
        box-shadow: 0 4px 12px rgba(var(--xd-primary-rgb), 0.4);
        transform: translateY(-1px);
    }

    .btn-next-step:active {
        transform: translateY(0);
    }

/* Complete button - success state */
.btn-complete-tutorial {
    background: linear-gradient(135deg, var(--xd-success) 0%, #2DB04B 100%);
    border: none;
    color: white;
    padding: 10px 24px;
    border-radius: var(--xd-radius-md);
    cursor: pointer;
    transition: all var(--xd-transition-fast);
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

    .btn-complete-tutorial:hover {
        box-shadow: 0 4px 16px rgba(52, 199, 89, 0.4);
        transform: translateY(-1px);
    }

    .btn-complete-tutorial:active {
        transform: translateY(0);
    }

    .btn-complete-tutorial i {
        font-size: 16px;
    }

/* Close button - top right */
.tutorial-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--xd-transition-fast);
    z-index: 2;
    font-size: 16px;
}

    .tutorial-close:hover {
        background: rgba(255, 255, 255, 0.3);
        transform: rotate(90deg);
    }

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes tooltipSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Pulse animation for highlight */
@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 0 0 4px var(--xd-primary), 0 0 0 8px rgba(var(--xd-primary-rgb), 0.2), 0 8px 32px rgba(0, 0, 0, 0.25);
    }

    50% {
        box-shadow: 0 0 0 4px var(--xd-primary), 0 0 0 12px rgba(var(--xd-primary-rgb), 0.3), 0 8px 32px rgba(0, 0, 0, 0.25);
    }
}

.tutorial-highlight.pulse {
    animation: highlightPulse 2s ease-in-out infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tutorial-tooltip {
        max-width: 90vw;
        min-width: 280px;
    }

    .tutorial-header {
        padding: 16px 20px;
    }

    .tutorial-content {
        padding: 20px;
    }

    .tutorial-footer {
        padding: 12px 20px;
        flex-direction: column;
        gap: 12px;
    }

    .tutorial-actions {
        width: 100%;
        justify-content: space-between;
    }

    .btn-next-step,
    .btn-complete-tutorial {
        flex: 1;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .tutorial-tooltip {
        background: var(--xd-gray-900);
        border-color: var(--xd-gray-700);
    }

    .tutorial-content {
        background: var(--xd-gray-900);
        color: var(--xd-gray-300);
    }

        .tutorial-content strong {
            color: var(--xd-gray-100);
        }

        .tutorial-content code {
            background: var(--xd-gray-800);
            color: var(--xd-info);
        }

    .tutorial-tip {
        background: var(--xd-gray-800);
    }

    .tutorial-tip-content {
        color: var(--xd-gray-400);
    }

    .tutorial-footer {
        background: var(--xd-gray-800);
        border-top-color: var(--xd-gray-700);
    }

    .btn-skip-tutorial {
        border-color: var(--xd-gray-600);
        color: var(--xd-gray-400);
    }

        .btn-skip-tutorial:hover {
            background: var(--xd-gray-800);
            border-color: var(--xd-gray-500);
            color: var(--xd-gray-300);
        }

    .btn-previous-step {
        color: var(--xd-gray-400);
    }

        .btn-previous-step:hover {
            background: var(--xd-gray-700);
            color: var(--xd-gray-300);
        }
}

/* Loading state for buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

    .btn-loading::after {
        content: '';
        position: absolute;
        width: 16px;
        height: 16px;
        top: 50%;
        left: 50%;
        margin-left: -8px;
        margin-top: -8px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-radius: 50%;
        border-top-color: white;
        animation: spin 0.6s linear infinite;
    }

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Success checkmark animation */
@keyframes checkmark {
    0% {
        stroke-dashoffset: 50;
    }

    100% {
        stroke-dashoffset: 0;
    }
}

.tutorial-success-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
}

    .tutorial-success-icon circle {
        stroke: var(--xd-success);
        stroke-width: 2;
        fill: none;
    }

    .tutorial-success-icon path {
        stroke: var(--xd-success);
        stroke-width: 3;
        stroke-dasharray: 50;
        stroke-dashoffset: 50;
        animation: checkmark 0.5s ease-in-out 0.2s forwards;
    }
