/* ========================================
   ИНТЕРАКТИВНЫЙ ТУТОРИАЛ
   Без зависимостей, полный контроль
   ======================================== */

/* Overlay (затемнение фона) */
.msp-tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9998;
    opacity: 0;
    pointer-events: auto;
}

.msp-tutorial-overlay.active {
    opacity: 1;
}

/* Подсветка элемента (граница) */
.msp-tutorial-highlight {
    position: absolute;
    border: 3px solid #667eea;
    border-radius: 8px;
    z-index: 9999;
    pointer-events: none; /* НЕ блокирует клики */
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.3);
}

/* Зона кликабельности (прозрачная область над элементом) */
.msp-tutorial-clickable {
    position: absolute;
    z-index: 9999;
    pointer-events: auto; /* Разрешает клики */
    background: transparent;
}

/* Popover (всплывающая подсказка) */
.msp-tutorial-popover {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    padding: 20px;
    max-width: 400px;
    z-index: 10000;
    pointer-events: auto;
}

/* Стрелки popover */
.msp-tutorial-popover::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 10px solid transparent;
}

/* Стрелка сверху (popover снизу от элемента) */
.msp-tutorial-popover.arrow-top::before {
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: white;
}

/* Стрелка снизу (popover сверху от элемента) */
.msp-tutorial-popover.arrow-bottom::before {
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: white;
}

/* Стрелка слева (popover справа от элемента) */
.msp-tutorial-popover.arrow-left::before {
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: white;
}

/* Стрелка справа (popover слева от элемента) */
.msp-tutorial-popover.arrow-right::before {
    right: -20px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: white;
}

/* Header (шапка с кнопкой закрытия) */
.msp-tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

/* Body (основной контент) */
.msp-tutorial-body {
    margin-bottom: 20px;
}

/* Buttons (контейнер кнопок) */
.msp-tutorial-buttons {
    display: flex;
    gap: 10px;
}

/* Progress (индикатор прогресса) */
.msp-tutorial-progress {
    color: #999;
    font-size: 13px;
    margin-right: auto;
}

/* Заголовок */
.msp-tutorial-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: #333;
    line-height: 1.4;
}

.step-badge {
    display: inline-block;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 8px;
    font-weight: 600;
}

/* Описание */
.msp-tutorial-description {
    font-size: 15px;
    line-height: 1.6;
    color: #555;
    margin: 0 0 20px 0;
}

.msp-tutorial-description strong {
    color: #667eea;
    font-weight: 600;
}

/* Футер с кнопками */
.msp-tutorial-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    align-items: center;
}

/* Кнопки */
.msp-tutorial-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.msp-tutorial-btn-close {
    background: transparent;
    color: #999;
    padding: 8px;
    font-size: 18px;
}

.msp-tutorial-btn-close:hover {
    color: #666;
    background: #f5f5f5;
}

.msp-tutorial-btn-prev {
    background: #e0e0e0;
    color: #333;
}

.msp-tutorial-btn-prev:hover {
    background: #d0d0d0;
}

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

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

/* ========================================
   ПЛАВАЮЩАЯ КНОПКА ПОМОЩИ
   ======================================== */

.msp-tutorial-fab {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    
    display: flex;
    align-items: center;
    gap: 8px;
    
    padding: 12px 20px;
    border-radius: 30px;
    
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    
    cursor: pointer;
    z-index: 9997;
    
    transition: all 0.3s ease;
}

.msp-tutorial-fab .fab-icon {
    font-size: 24px;
    line-height: 1;
}

.msp-tutorial-fab .fab-label {
    color: white;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.msp-tutorial-fab:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.6);
}

/* Пульсация для привлечения внимания */
.msp-tutorial-fab::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 30px;
    background: rgba(102, 126, 234, 0.3);
    animation: msp-tutorial-pulse 2s infinite;
    z-index: -1;
}

@keyframes msp-tutorial-pulse {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Убрать пульсацию после первого клика */
.msp-tutorial-fab.clicked::before {
    animation: none;
}

/* ========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ======================================== */

@media (max-width: 768px) {
    /* Popover на всю ширину с отступами */
    .msp-tutorial-popover {
        max-width: calc(100% - 40px);
        padding: 16px;
        left: 20px !important;
        right: 20px !important;
    }
    
    .msp-tutorial-title {
        font-size: 16px;
    }
    
    .msp-tutorial-description {
        font-size: 14px;
    }
    
    .msp-tutorial-btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    /* Кнопка помощи внизу по центру */
    .msp-tutorial-fab {
        bottom: 20px;
        top: auto;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .msp-tutorial-fab:hover {
        transform: translateX(-50%) scale(1.05);
    }
    
    .msp-tutorial-fab .fab-icon {
        font-size: 20px;
    }
    
    .msp-tutorial-fab .fab-label {
        font-size: 13px;
    }
}

/* Планшеты */
@media (min-width: 769px) and (max-width: 1024px) {
    .msp-tutorial-popover {
        max-width: 350px;
    }
}

/* ========================================
   АНИМАЦИИ
   ======================================== */

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

@keyframes msp-tutorial-slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Применить анимацию при появлении */
.msp-tutorial-popover.active {
    animation: msp-tutorial-slideIn 0.3s ease;
}

/* ========================================
   ACCESSIBILITY (Доступность)
   ======================================== */

/* Фокус на кнопках для клавиатурной навигации */
.msp-tutorial-btn:focus,
.msp-tutorial-fab:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Высококонтрастный режим */
@media (prefers-contrast: high) {
    .msp-tutorial-popover {
        border: 2px solid #000;
    }
    
    .msp-tutorial-highlight {
        border-width: 4px;
    }
}

/* Уменьшение движения для пользователей с вестибулярными расстройствами */
@media (prefers-reduced-motion: reduce) {
    .msp-tutorial-overlay,
    .msp-tutorial-popover,
    .msp-tutorial-highlight,
    .msp-tutorial-fab {
        transition: none;
        animation: none;
    }
    
    .msp-tutorial-fab::before {
        animation: none;
    }
}
