/* Tutorial System Styles - Glass Morphism Design */

/* Tutorial Question Mark Button - Always Visible */
#tutorial-trigger {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    transition: transform 0.3s ease;
}

#tutorial-trigger:hover {
    transform: scale(1.1);
}

.tutorial-question-mark {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #4b5563;
    transition: all 0.3s ease;
    animation: pulse 3s infinite;
}

/* Pulse animation to draw attention */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3);
    }
}

.tutorial-question-mark:hover {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    color: #3b82f6;
}

/* Dark mode styles for button */
.dark .tutorial-question-mark {
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #9ca3af;
}

.dark .tutorial-question-mark:hover {
    background: rgba(50, 50, 50, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #60a5fa;
}

/* Tutorial Overlay */
#tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15);  /* Very light overlay */
    backdrop-filter: blur(1px);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.dark #tutorial-overlay {
    background: rgba(0, 0, 0, 0.25);  /* Slightly darker for dark mode */
}

#tutorial-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Tutorial Panel - Glass Morphism */
#tutorial-panel {
    position: fixed;
    bottom: 64px;
    left: 24px;
    transform: none;
    width: auto;
    min-width: 240px;
    max-width: min(340px, calc(100% - 48px));
    max-height: calc(100vh - 96px);
    display: inline-flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.5);
    padding: 12px 16px;
    z-index: 10003;  /* Above highlight */
    opacity: 0;
    transition: all 0.3s ease;
}

#tutorial-panel.active {
    opacity: 1;
    transform: none;
}

/* Dark mode tutorial panel */
.dark #tutorial-panel {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Drag Handle */
.tutorial-drag-handle {
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 20px;
    cursor: grab;
    color: #9ca3af;
    font-size: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
    user-select: none;
    z-index: 1;
}

.tutorial-drag-handle:hover {
    opacity: 1;
}

.tutorial-drag-handle:active {
    cursor: grabbing;
}

/* Tutorial Header */
.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    margin-top: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .tutorial-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.2;
}

.dark .tutorial-title {
    color: #f3f4f6;
}

.tutorial-step-counter {
    font-size: 12px;
    color: #6b7280;
    background: rgba(59, 130, 246, 0.1);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.dark .tutorial-step-counter {
    color: #9ca3af;
    background: rgba(59, 130, 246, 0.2);
}

/* Tutorial Content */
.tutorial-content {
    margin: 6px 0;
    font-size: 13px;
    line-height: 1.4;
    color: #4b5563;
    overflow-y: auto;
    padding-right: 4px;
    max-height: 220px;
}

/* Custom scrollbar for tutorial content */
.tutorial-content::-webkit-scrollbar {
    width: 4px;
}

.tutorial-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 2px;
}

.tutorial-content::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

.tutorial-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.dark .tutorial-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.dark .tutorial-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.dark .tutorial-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.dark .tutorial-content {
    color: #d1d5db;
}

/* Tutorial Navigation */
.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.dark .tutorial-navigation {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.tutorial-nav-buttons {
    display: flex;
    gap: 10px;
}

.tutorial-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.tutorial-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tutorial-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.tutorial-btn-secondary {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.tutorial-btn-secondary:hover {
    background: rgba(107, 114, 128, 0.2);
}

.tutorial-btn-skip {
    background: transparent;
    color: #ef4444;
    text-decoration: underline;
    padding: 8px;
}

.tutorial-btn-skip:hover {
    color: #dc2626;
}

/* Dark mode buttons */
.dark .tutorial-btn-secondary {
    background: rgba(156, 163, 175, 0.1);
    color: #9ca3af;
}

.dark .tutorial-btn-secondary:hover {
    background: rgba(156, 163, 175, 0.2);
}

/* Spotlight Effect for Highlighted Elements */
.tutorial-highlight {
    position: relative;
    z-index: 10002;  /* Above overlay but below panel */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.6), 0 0 20px rgba(59, 130, 246, 0.4);
    border-radius: 4px;
    animation: highlight-pulse 1.5s infinite;
    outline: 2px solid rgba(59, 130, 246, 0.4);
    outline-offset: 3px;
}

@keyframes highlight-pulse {
    0%, 100% {
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.6), 0 0 20px rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 5px rgba(59, 130, 246, 0.4), 0 0 30px rgba(59, 130, 246, 0.3);
    }
}

/* Dark mode highlight */
.dark .tutorial-highlight {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.7), 0 0 20px rgba(96, 165, 250, 0.5);
    outline: 2px solid rgba(96, 165, 250, 0.4);
}

/* Tutorial Pointer Arrow */
.tutorial-arrow {
    position: absolute;
    width: 20px;
    height: 20px;
    background: inherit;
    border: inherit;
    transform: rotate(45deg);
}

.tutorial-arrow.top {
    top: -10px;
    border-right: none;
    border-bottom: none;
}

.tutorial-arrow.bottom {
    bottom: -10px;
    border-left: none;
    border-top: none;
}

.tutorial-arrow.left {
    left: -10px;
    border-right: none;
    border-top: none;
}

.tutorial-arrow.right {
    right: -10px;
    border-left: none;
    border-bottom: none;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    #tutorial-panel {
        width: 92%;
        min-width: 0;
        left: 50%;
        transform: translateX(-50%);
        bottom: 56px;
        padding: 10px 12px;
        max-width: none;
    }

    .tutorial-question-mark {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }

    .tutorial-title {
        font-size: 14px;
    }

    .tutorial-content {
        font-size: 12px;
        max-height: 40vh;
    }

    .tutorial-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* Tutorial Progress Bar */
.tutorial-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.tutorial-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

/* Tooltip for Question Mark */
.tutorial-tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    transform: translateX(0);
    margin-bottom: 10px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    max-width: 220px;
    white-space: normal;
    line-height: 1.3;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

#tutorial-trigger:hover .tutorial-tooltip {
    opacity: 1;
}

/* Loading State */
.tutorial-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.tutorial-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.2);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Disabled state for navigation buttons */
.tutorial-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tutorial-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Arrow pointer from panel to element */
.tutorial-arrow-pointer {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.dark .tutorial-arrow-pointer {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
