/* css/tutorial.css - Tutorial System Styling */

/* Tutorial Overlay - Dark background that covers the entire screen */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 5000;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Tutorial Tooltip - Main tutorial content box */
.tutorial-tooltip {
    position: fixed;
    z-index: 5001;
    pointer-events: auto;
    background: white;
    border-radius: 15px;
    padding: 25px;
    max-width: 450px;
    min-width: 300px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 3px solid #4a90e2;
    animation: tutorialTooltipAppear 0.4s ease-out;
    backdrop-filter: blur(5px);
}

@keyframes tutorialTooltipAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Tutorial tooltip content styling */
.tutorial-tooltip h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 1.3em;
    font-weight: bold;
    line-height: 1.3;
}

.tutorial-tooltip h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    margin-right: 10px;
    border-radius: 2px;
    vertical-align: middle;
}

.tutorial-tooltip div:first-child {
    margin-bottom: 20px;
}

.tutorial-tooltip div:first-child div {
    color: #555;
    line-height: 1.6;
    white-space: pre-line;
    margin: 0;
}

/* Bold text in tutorial content */
.tutorial-tooltip strong {
    color: #4a90e2;
    font-weight: 600;
}

/* Bullet points styling */
.tutorial-tooltip div:first-child div::before {
    content: '';
}

/* Tutorial footer with step counter and buttons */
.tutorial-tooltip > div:last-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 2px solid #f1f5f9;
    padding-top: 15px;
    margin-top: 20px;
}

.tutorial-tooltip > div:last-child > div:first-child {
    color: #999;
    font-size: 0.9em;
    font-weight: 500;
}

/* Tutorial button container */
.tutorial-tooltip > div:last-child > div:last-child {
    display: flex;
    gap: 10px;
}

/* Tutorial buttons */
.tutorial-tooltip button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9em;
    transition: all 0.2s ease;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Next button styling */
.tutorial-tooltip button[onclick*="nextStep"] {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    margin-right: 10px;
}

.tutorial-tooltip button[onclick*="nextStep"]:hover {
    background: linear-gradient(135deg, #357abd, #2563eb);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

/* Finish button styling */
.tutorial-tooltip button[onclick*="completeTutorial"] {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    margin-right: 10px;
}

.tutorial-tooltip button[onclick*="completeTutorial"]:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Skip button styling */
.tutorial-tooltip button[onclick*="skipTutorial"] {
    background: #6b7280;
    color: white;
}

.tutorial-tooltip button[onclick*="skipTutorial"]:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

/* Tutorial highlight - Glowing border around highlighted elements */
.tutorial-highlight {
    position: fixed;
    z-index: 5000;
    pointer-events: none;
    border: 3px solid #4a90e2;
    border-radius: 10px;
    box-shadow: 
        0 0 0 4px rgba(74, 144, 226, 0.3),
        0 0 20px rgba(74, 144, 226, 0.5),
        inset 0 0 0 2px rgba(255, 255, 255, 0.2);
    animation: tutorialPulse 2s infinite;
}

@keyframes tutorialPulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 
            0 0 0 4px rgba(74, 144, 226, 0.3),
            0 0 20px rgba(74, 144, 226, 0.5),
            inset 0 0 0 2px rgba(255, 255, 255, 0.2);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.02);
        box-shadow: 
            0 0 0 6px rgba(74, 144, 226, 0.4),
            0 0 30px rgba(74, 144, 226, 0.7),
            inset 0 0 0 2px rgba(255, 255, 255, 0.3);
    }
}

/* Tutorial restart modal */
.tutorial-restart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6000;
    backdrop-filter: blur(5px);
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(5px);
    }
}

.tutorial-restart-modal > div {
    background: white;
    border-radius: 20px;
    max-width: 400px;
    width: 90%;
    padding: 30px;
    text-align: center;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.4s ease-out;
    border: 3px solid #4a90e2;
}

@keyframes modalSlideIn {
    from {
        transform: scale(0.9) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.tutorial-restart-modal h2 {
    color: #4a90e2;
    margin-bottom: 20px;
    font-size: 1.4em;
}

.tutorial-restart-modal p {
    margin-bottom: 25px;
    color: #666;
    line-height: 1.5;
}

.tutorial-restart-modal div:last-child {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.tutorial-restart-modal button {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    min-height: 44px;
}

.tutorial-restart-modal button:first-child {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
}

.tutorial-restart-modal button:first-child:hover {
    background: linear-gradient(135deg, #357abd, #2563eb);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.3);
}

.tutorial-restart-modal button:last-child {
    background: #6b7280;
    color: white;
}

.tutorial-restart-modal button:last-child:hover {
    background: #4b5563;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107, 114, 128, 0.3);
}

/* Tutorial Button in game controls */
#tutorialButton {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
    border-color: #8b5cf6;
}

#tutorialButton:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

#tutorialButton:active {
    transform: translateY(0);
}

/* Enhanced tooltip styling for better readability */
.tutorial-tooltip {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Special styling for tips and important info */
.tutorial-tooltip div:first-child div {
    position: relative;
}

/* Add subtle background to tip sections */
.tutorial-tooltip div:first-child div:contains("Tip"):before,
.tutorial-tooltip div:first-child div:contains("Pro Tip"):before {
    content: "💡";
    position: absolute;
    left: -25px;
    top: 0;
    font-size: 1.1em;
}

/* Responsive design */
@media (max-width: 768px) {
    .tutorial-tooltip {
        max-width: 90vw;
        min-width: 280px;
        padding: 20px;
        margin: 10px;
    }
    
    .tutorial-tooltip h3 {
        font-size: 1.2em;
    }
    
    .tutorial-tooltip > div:last-child {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .tutorial-tooltip > div:last-child > div:last-child {
        flex-direction: column;
        gap: 10px;
    }
    
    .tutorial-tooltip button {
        width: 100%;
        margin: 0 !important;
    }
}

@media (max-width: 480px) {
    .tutorial-tooltip {
        padding: 15px;
        margin: 5px;
    }
    
    .tutorial-tooltip h3 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .tutorial-restart-modal > div {
        padding: 20px;
        margin: 10px;
    }
    
    .tutorial-restart-modal div:last-child {
        flex-direction: column;
    }
    
    .tutorial-restart-modal button {
        width: 100%;
        margin: 5px 0 !important;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .tutorial-tooltip,
    .tutorial-highlight,
    .tutorial-restart-modal > div {
        animation: none;
    }
    
    .tutorial-highlight {
        animation: none;
    }
    
    @keyframes tutorialPulse {
        0%, 100% { opacity: 1; }
        50% { opacity: 0.8; }
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tutorial-tooltip {
        border: 4px solid #000;
        box-shadow: 0 0 0 2px #fff, 0 20px 60px rgba(0, 0, 0, 0.8);
    }
    
    .tutorial-highlight {
        border: 4px solid #000;
        box-shadow: 0 0 0 2px #fff;
    }
}

/* Focus states for accessibility */
.tutorial-tooltip button:focus {
    outline: 3px solid rgba(74, 144, 226, 0.5);
    outline-offset: 2px;
}

.tutorial-restart-modal button:focus {
    outline: 3px solid rgba(74, 144, 226, 0.5);
    outline-offset: 2px;
}

/* Ensure tutorial elements don't interfere with game elements */
.tutorial-overlay,
.tutorial-tooltip,
.tutorial-highlight,
.tutorial-restart-modal {
    user-select: none;
}

.tutorial-tooltip * {
    user-select: text;
}

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