/* ==========================================================================
   Tutorial System CSS - The Smithy Educational Platform
   ========================================================================== */

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(2px);
    z-index: 999998;
    display: none;
    opacity: 0;
    transition: opacity 300ms ease-in-out;
}

.tutorial-overlay.active {
    display: block;
    opacity: 1;
}

/* Tutorial Tooltip */
.tutorial-tooltip {
    position: fixed;
    max-width: 400px;
    min-width: 300px;
    background: linear-gradient(135deg, #2c2c2c 0%, #1a1a1a 100%);
    color: white;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 138, 0, 0.2);
    box-shadow: 
        0 16px 48px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 999999;
    display: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    transform: scale(0.95);
    transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tutorial-tooltip.active {
    display: block;
    transform: scale(1);
}

/* Tutorial Header */
.tutorial-tooltip h3 {
    margin: 0 0 8px 0;
    color: #ff8a00;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tutorial-progress {
    margin-bottom: 16px;
    padding: 6px 12px;
    background: rgba(255, 138, 0, 0.1);
    border-radius: 20px;
    display: inline-block;
}

.tutorial-progress span {
    font-size: 12px;
    color: #ff8a00;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tutorial Content */
.tutorial-content {
    margin-bottom: 24px;
    font-size: 15px;
    line-height: 1.6;
}

.tutorial-content p {
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.9);
}

.tutorial-content ul {
    margin: 12px 0;
    padding-left: 20px;
}

.tutorial-content li {
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.85);
}

.tutorial-content strong {
    color: #ff8a00;
    font-weight: 600;
}

.tutorial-content em {
    color: #a5ffd6;
    font-style: italic;
}

/* Tutorial Buttons */
.tutorial-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}

.tutorial-btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 200ms ease;
    position: relative;
    overflow: hidden;
    border: none;
    min-width: 80px;
    text-align: center;
}

.tutorial-btn-primary {
    background: linear-gradient(135deg, #ff8a00 0%, #e67300 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 138, 0, 0.3);
}

.tutorial-btn-primary:hover {
    background: linear-gradient(135deg, #ff9d1a 0%, #ff8a00 100%);
    box-shadow: 0 6px 16px rgba(255, 138, 0, 0.4);
    transform: translateY(-1px);
}

.tutorial-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255, 138, 0, 0.3);
}

.tutorial-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.tutorial-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.tutorial-btn-secondary:active {
    background: rgba(255, 255, 255, 0.05);
}

/* Tutorial Highlight */
.tutorial-highlight {
    position: fixed;
    border: 3px solid #ff8a00;
    background: rgba(255, 138, 0, 0.15);
    border-radius: 12px;
    z-index: 999999;
    display: none;
    pointer-events: none;
    transition: all 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 0 20px rgba(255, 138, 0, 0.6),
        inset 0 0 20px rgba(255, 138, 0, 0.1);
    animation: tutorialPulse 2s ease-in-out infinite;
}

.tutorial-highlight.active {
    display: block;
}

/* Tutorial Pulse Animation */
@keyframes tutorialPulse {
    0%, 100% {
        box-shadow: 
            0 0 20px rgba(255, 138, 0, 0.6),
            inset 0 0 20px rgba(255, 138, 0, 0.1);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(255, 138, 0, 0.8),
            inset 0 0 40px rgba(255, 138, 0, 0.2);
    }
}

/* Tutorial Help Button */
.tutorial-help-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #ff8a00 0%, #e67300 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 138, 0, 0.4);
    transition: all 300ms ease;
    z-index: 999997;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-help-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 138, 0, 0.5);
}

.tutorial-help-button:active {
    transform: scale(0.95);
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .tutorial-tooltip {
        max-width: calc(100vw - 40px);
        min-width: calc(100vw - 40px);
        padding: 20px;
        border-radius: 12px;
        left: 20px !important;
        right: 20px !important;
    }
    
    .tutorial-buttons {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .tutorial-btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .tutorial-help-button {
        bottom: 80px; /* Above mobile navigation if present */
        right: 16px;
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    /* Adjust highlight for mobile */
    .tutorial-highlight {
        border-width: 2px;
        border-radius: 8px;
    }
}

/* Touch Devices Optimization */
@media (hover: none) and (pointer: coarse) {
    .tutorial-btn {
        min-height: 44px; /* WCAG touch target compliance */
        padding: 12px 20px;
    }
    
    .tutorial-help-button {
        min-width: 48px;
        min-height: 48px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .tutorial-tooltip {
        background: #000;
        border: 2px solid #fff;
    }
    
    .tutorial-btn-primary {
        background: #ff8a00;
        border: 2px solid #fff;
    }
    
    .tutorial-btn-secondary {
        background: transparent;
        border: 2px solid #fff;
        color: #fff;
    }
    
    .tutorial-highlight {
        border-width: 4px;
        border-color: #ff8a00;
        background: transparent;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .tutorial-overlay,
    .tutorial-tooltip,
    .tutorial-btn,
    .tutorial-highlight {
        transition: none;
    }
    
    .tutorial-highlight {
        animation: none;
    }
    
    @keyframes tutorialPulse {
        0%, 100% {
            box-shadow: 0 0 20px rgba(255, 138, 0, 0.6);
        }
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .tutorial-tooltip {
        background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
        border-color: rgba(255, 138, 0, 0.3);
    }
}

/* Print Styles (hide tutorial during printing) */
@media print {
    .tutorial-overlay,
    .tutorial-tooltip,
    .tutorial-highlight,
    .tutorial-help-button {
        display: none !important;
    }
}

/* Tutorial Skip Link for Screen Readers */
.tutorial-skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 999999;
    transition: top 0.3s;
}

.tutorial-skip-link:focus {
    top: 6px;
}

/* Loading State for Tutorial */
.tutorial-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.7);
}

.tutorial-loading::after {
    content: "🔨";
    font-size: 24px;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Settings Menu Tutorial Integration */
.settings-menu-item {
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 200ms ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-menu-item:hover {
    background: rgba(255, 138, 0, 0.1);
    color: #ff8a00;
}

.settings-menu-item:active {
    background: rgba(255, 138, 0, 0.2);
}

/* Contextual Help Buttons */
.contextual-help-btn {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    width: 32px !important;
    height: 32px !important;
    border: none !important;
    background: rgba(255, 138, 0, 0.2) !important;
    color: #ff8a00 !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    font-size: 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100 !important;
    transition: all 200ms ease !important;
}

.contextual-help-btn:hover {
    background: rgba(255, 138, 0, 0.3) !important;
    transform: scale(1.1) !important;
}

/* Custom Help Modal */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 300ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}