/* ========================================
   МОБИЛЬНАЯ АДАПТАЦИЯ
   ======================================== */

@media (max-width: 768px) {
    /* Скрываем десктопную структуру */
    .split-container {
        display: none;
    }

    /* Мобильный контейнер */
    .mobile-container {
        display: block !important;
        padding-top: 70px;
    }

    /* Главный экран - форма */
    .mobile-main-screen {
        padding: 20px;
        min-height: calc(100vh - 70px);
    }

    /* Экран просмотра слайдов */
    .mobile-slides-view {
        display: none;
        padding: 20px;
        padding-top: 160px; /* 70px header + 90px warning */
        min-height: calc(100vh - 70px);
        background: #f5f5f5;
    }

    .mobile-slides-view.active {
        display: block;
    }

    /* Слайд в мобильном просмотре */
    .mobile-slide {
        background: white;
        margin: 0 auto 30px;
        max-width: 100%;
        aspect-ratio: 16/9;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-radius: 12px;
        overflow: hidden;
        position: relative;
        cursor: pointer;
        transition: all 0.3s ease;
    }

    .mobile-slide:active {
        transform: scale(0.98);
    }

    /* Сообщение при клике на слайд */
    .mobile-edit-warning {
        position: fixed;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 16px 24px;
        border-radius: 12px;
        font-size: 14px;
        text-align: center;
        max-width: 90%;
        z-index: 1000;
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from {
            opacity: 0;
            transform: translateX(-50%) translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }
    }

    /* Бургер меню */
    .burger-btn {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        background: transparent;
        border: none;
        padding: 8px;
        cursor: pointer;
    }

    .burger-line {
        width: 24px;
        height: 3px;
        background: #4f46e5;
        border-radius: 2px;
        transition: all 0.3s;
    }

    .burger-btn.active .burger-line:nth-child(1) {
        transform: rotate(45deg) translate(6px, 6px);
    }

    .burger-btn.active .burger-line:nth-child(2) {
        opacity: 0;
    }

    .burger-btn.active .burger-line:nth-child(3) {
        transform: rotate(-45deg) translate(6px, -6px);
    }

    /* Боковое меню */
    .side-menu {
        position: fixed;
        top: 0;
        right: -70%;
        width: 70%;
        height: 100vh;
        background: white;
        box-shadow: -4px 0 12px rgba(0,0,0,0.1);
        z-index: 100;
        transition: right 0.3s ease;
        padding: 80px 20px 20px;
        overflow-y: auto;
    }

    .side-menu.active {
        right: 0;
    }

    .menu-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 99;
        display: none;
    }

    .menu-overlay.active {
        display: block;
    }

    /* Хедер мобильный - главный экран */
    .mobile-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        z-index: 50;
    }

    /* Хедер для просмотра слайдов */
    .mobile-header-slides {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 70px;
        background: white;
        border-bottom: 1px solid #e5e7eb;
        display: none;
        align-items: center;
        justify-content: space-between;
        padding: 0 20px;
        gap: 12px;
        z-index: 50;
    }

    .mobile-header-slides.active {
        display: flex;
    }

    /* Предупреждение о мобильном просмотре */
    .mobile-preview-warning {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: linear-gradient(135deg, #fef3c7, #fde68a);
        border-bottom: 2px solid #f59e0b;
        padding: 12px 16px;
        display: none;
        align-items: center;
        gap: 12px;
        z-index: 49;
        animation: slideDown 0.3s ease;
    }

    .mobile-preview-warning.active {
        display: flex;
    }

    .warning-icon {
        font-size: 24px;
        flex-shrink: 0;
    }

    .warning-text {
        flex: 1;
        font-size: 13px;
        line-height: 1.4;
    }

    .warning-text strong {
        display: block;
        color: #92400e;
        margin-bottom: 2px;
        font-weight: 600;
    }

    .warning-text p {
        color: #78350f;
        margin: 0;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .header-left {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .header-right {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    /* Большие кнопки в шапке просмотра */
    .icon-btn-large {
        flex: 1;
        height: 50px;
        border-radius: 12px;
        border: none;
        font-size: 16px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .icon-btn-large.primary {
        background: linear-gradient(135deg, #4f46e5, #7c3aed);
        color: white;
    }

    .icon-btn-large.secondary {
        background: #e5e7eb;
        color: #374151;
    }

    .icon-btn-large:active {
        transform: scale(0.95);
    }

    /* Скрываем desktop элементы */
    .desktop-only {
        display: none !important;
    }

    /* Адаптация формы */
    .mobile-main-screen textarea,
    .mobile-main-screen input {
        font-size: 16px; /* Предотвращает zoom на iOS */
    }

    /* Счетчик попыток */
    .attempts-badge {
        background: linear-gradient(135deg, #4f46e5, #7c3aed);
        color: white;
        padding: 6px 12px;
        border-radius: 8px;
        font-weight: 600;
        font-size: 14px;
    }
}

/* Десктоп - скрываем мобильные элементы */
@media (min-width: 769px) {
    .mobile-container {
        display: none !important;
    }

    .burger-btn {
        display: none !important;
    }

    .side-menu,
    .menu-overlay {
        display: none !important;
    }

    .mobile-header,
    .mobile-header-slides,
    .mobile-preview-warning {
        display: none !important;
    }
}