/* Стили модального окна создания флаера (обновлённые) */

/* ========== ОВЕРЛЕЙ ========== */
.flyer-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 18, 0.85);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(8px);
}

.flyer-modal-overlay.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* ========== КОНТЕЙНЕР ========== */
.flyer-modal-container {
    background: var(--bg-primary, #1a1a2e);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    margin: 20px auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

/* ========== ШАПКА ========== */
.flyer-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, var(--primary-color, #1a5f2a), var(--primary-dark, #0d3d15));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.flyer-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.flyer-modal-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px 12px;
    line-height: 1;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.flyer-modal-close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

/* ========== ТЕЛО ========== */
.flyer-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ========== ШАГИ ========== */
.flyer-step {
    display: none;
}

.flyer-step.active {
    display: block;
    animation: stepFadeIn 0.3s ease;
}

@keyframes stepFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== ИНДИКАТОР ШАГА ========== */
.flyer-step-indicator {
    font-size: 0.85rem;
    color: var(--text-muted, #6b7280);
    text-align: center;
    margin-bottom: 20px;
    padding: 10px 16px;
    background: rgba(26, 95, 42, 0.1);
    border-radius: 8px;
    display: inline-block;
    width: 100%;
    box-sizing: border-box;
}

.flyer-step-indicator strong {
    color: var(--primary-color, #1a5f2a);
}

/* ========== ЗАГОЛОВКИ ========== */
.flyer-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #fff);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-color, #1a5f2a);
}

/* ========== ЗАГРУЗКА ФОТО ========== */
.flyer-photo-dropzone {
    background: linear-gradient(135deg, rgba(26, 95, 42, 0.1), rgba(45, 138, 66, 0.15));
    border: 2px dashed rgba(26, 95, 42, 0.4);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.flyer-photo-dropzone:hover {
    border-color: var(--primary-color, #1a5f2a);
    background: linear-gradient(135deg, rgba(26, 95, 42, 0.15), rgba(45, 138, 66, 0.2));
}

.flyer-photo-dropzone.dragover {
    border-color: var(--accent-color, #ff6b00);
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.15), rgba(255, 140, 0, 0.2));
    transform: scale(1.02);
}

.flyer-photo-dropzone.has-photo {
    padding: 0;
    min-height: auto;
    background: transparent;
    border: none;
    aspect-ratio: 9 / 16;
    max-height: 400px;
}

.flyer-photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary, #8892b0);
}

.flyer-photo-placeholder svg {
    width: 64px;
    height: 64px;
    color: var(--primary-color, #1a5f2a);
    opacity: 0.6;
}

.flyer-photo-placeholder span {
    font-size: 0.95rem;
    color: var(--primary-color, #1a5f2a);
    font-weight: 600;
}

.flyer-photo-preview {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    cursor: grab;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flyer-photo-preview:active {
    cursor: grabbing;
}

.flyer-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    /* GPU ускорение для плавного перетаскивания */
    will-change: transform;
    transform-origin: center center;
    /* Оптимизация рендеринга */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Сглаживание изображения */
    image-rendering: -webkit-optimize-contrast;
}

.flyer-photo-preview img.visible {
    display: block;
    opacity: 1;
}

.flyer-photo-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    z-index: 5;
}

.flyer-photo-remove:hover {
    background: #ef4444;
    transform: scale(1.1);
}

.flyer-photo-input {
    display: none;
}

/* ========== ZOOM CONTROLS ========== */
.flyer-zoom-controls {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 6px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 5;
}

.flyer-photo-preview:hover .flyer-zoom-controls {
    opacity: 1;
}

.flyer-zoom-btn {
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flyer-zoom-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.flyer-zoom-btn svg {
    width: 20px;
    height: 20px;
}

/* ========== ПОЛЯ ВВОДА ========== */
.flyer-input-group {
    margin-bottom: 16px;
}

.flyer-input-group label:not(.flyer-checkbox-inline) {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #b8bdd6);
    margin-bottom: 8px;
}

.flyer-input-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-secondary, #16213e);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.95rem;
    color: var(--text-primary, #fff);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.flyer-input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color, #1a5f2a);
    box-shadow: 0 0 0 3px rgba(26, 95, 42, 0.2);
}

.flyer-input-row {
    display: flex;
    gap: 12px;
}

.flyer-input-row .flyer-input-group {
    flex: 1;
}

/* ========== ЧЕКБОКС ========== */
.flyer-checkbox-group {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 16px;
    background: var(--bg-secondary, #16213e);
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.flyer-checkbox-group:hover {
    border-color: rgba(26, 95, 42, 0.4);
}

.flyer-checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color, #1a5f2a);
    cursor: pointer;
}

.flyer-checkbox-group span {
    font-size: 0.9rem;
    color: var(--text-primary, #fff);
}

/* Компактный вариант чекбокса для инлайн использования */
.flyer-input-group .flyer-checkbox-inline,
label.flyer-checkbox-inline {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 16px;
    background: #16213e;
    border-radius: 10px;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
    white-space: nowrap;
    margin: 0 !important;
    min-width: auto;
}

.flyer-input-group .flyer-checkbox-inline:hover,
label.flyer-checkbox-inline:hover {
    border-color: rgba(26, 95, 42, 0.4);
}

.flyer-input-group .flyer-checkbox-inline input[type="checkbox"],
label.flyer-checkbox-inline input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 18px !important;
    height: 18px !important;
    border: 2px solid #4ade80;
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    margin: 0 !important;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s ease;
}

.flyer-input-group .flyer-checkbox-inline input[type="checkbox"]:hover,
label.flyer-checkbox-inline input[type="checkbox"]:hover {
    border-color: #22c55e;
    background-color: rgba(74, 222, 128, 0.1);
}

.flyer-input-group .flyer-checkbox-inline input[type="checkbox"]:checked,
label.flyer-checkbox-inline input[type="checkbox"]:checked {
    background-color: #1a5f2a;
    border-color: #4ade80;
}

.flyer-input-group .flyer-checkbox-inline input[type="checkbox"]:checked::after,
label.flyer-checkbox-inline input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #4ade80;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.flyer-input-group .flyer-checkbox-inline span,
label.flyer-checkbox-inline span {
    font-size: 0.85rem;
    color: #ffffff;
    font-weight: 500;
}

/* ========== СЕТКА СТИЛЕЙ ========== */
.flyer-styles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

/* ========== ИНДИКАТОР СТАТУСА TELEGRAM ========== */
.flyer-telegram-status {
    background: linear-gradient(135deg, rgba(26, 95, 42, 0.15), rgba(45, 138, 66, 0.1));
    border: 1.5px solid rgba(26, 95, 42, 0.3);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.flyer-telegram-status.warning {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1));
    border-color: rgba(255, 193, 7, 0.3);
}

.flyer-telegram-status-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.flyer-telegram-status-text {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-primary, #fff);
    line-height: 1.4;
}

.flyer-telegram-status-text a {
    color: var(--primary-color, #1a5f2a);
    text-decoration: underline;
    font-weight: 500;
}

.flyer-telegram-status-text a:hover {
    color: var(--accent-color, #ff6b00);
}

.flyer-telegram-status.warning .flyer-telegram-status-text a {
    color: #ffc107;
}

.flyer-telegram-status.warning .flyer-telegram-status-text a:hover {
    color: #ff9800;
}

/* ========== СЕТКА СТИЛЕЙ ========== */
.flyer-styles-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 16px;
}

.flyer-style-card {
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    background: var(--bg-secondary, #16213e);
}

.flyer-style-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    border-color: rgba(26, 95, 42, 0.3);
}

.flyer-style-card.selected {
    border-color: var(--primary-color, #1a5f2a);
    box-shadow: 0 0 0 3px rgba(26, 95, 42, 0.3), 0 8px 24px rgba(0, 0, 0, 0.3);
}

.flyer-style-card.selected::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--primary-color, #1a5f2a);
    color: #fff;
    border-radius: 50%;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.flyer-style-preview-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    border-radius: 10px;
    background: #000;
}

.flyer-style-preview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.flyer-style-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5;
}

.flyer-style-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #1a5f2a;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.flyer-style-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.flyer-style-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}


/* ========== ФУТЕР ========== */
.flyer-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
}

/* ========== КНОПКИ ========== */
.flyer-btn {
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
}

.flyer-btn-secondary {
    background: var(--bg-secondary, #16213e);
    color: var(--text-primary, #fff);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.flyer-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

.flyer-btn-primary {
    background: linear-gradient(135deg, var(--primary-color, #1a5f2a), var(--primary-dark, #0d3d15));
    color: #fff;
    flex: 1;
    box-shadow: 0 4px 16px rgba(26, 95, 42, 0.3);
}

.flyer-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(26, 95, 42, 0.45);
}

.flyer-btn-primary:disabled {
    background: #4a4a5a;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.flyer-btn svg {
    width: 20px;
    height: 20px;
}

/* ========== LOADING OVERLAY ========== */
.flyer-loading-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 18, 0.95);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    z-index: 100;
    border-radius: 16px;
}

.flyer-loading-overlay.active {
    display: flex;
}

.flyer-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color, #1a5f2a);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.flyer-loading-text {
    font-size: 1rem;
    color: #fff;
    font-weight: 500;
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 540px) {
    .flyer-modal-overlay {
        padding: 10px;
    }

    .flyer-modal-container {
        margin: 0;
        border-radius: 12px;
        max-height: 95vh;
    }

    .flyer-modal-header {
        padding: 16px 20px;
    }

    .flyer-modal-body {
        padding: 20px;
    }

    .flyer-modal-footer {
        padding: 16px 20px;
        flex-direction: column-reverse;
    }

    .flyer-styles-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .flyer-style-card {
        max-width: 300px;
        margin: 0 auto;
    }

    .flyer-input-row {
        flex-direction: column;
        gap: 0;
    }

    .flyer-btn {
        width: 100%;
    }

    .flyer-btn-secondary {
        order: 2;
    }

    .flyer-btn-primary {
        order: 1;
    }
}

/* ========== КНОПКИ ДЕЙСТВИЙ В PLACEHOLDER ========== */
.flyer-photo-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.flyer-photo-action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--primary-color, #1a5f2a);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.flyer-photo-action-btn svg {
    width: 18px;
    height: 18px;
}

.flyer-photo-action-btn:hover {
    background: var(--primary-dark, #0d3d15);
    transform: translateY(-1px);
}

.flyer-photo-action-btn:active {
    transform: translateY(0);
}

/* ========== МОДАЛЬНОЕ ОКНО КАМЕРЫ ========== */
.flyer-camera-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10001;
    justify-content: center;
    align-items: center;
}

.flyer-camera-modal.active {
    display: flex;
}

.flyer-camera-container {
    width: 100%;
    max-width: 480px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.8);
}

.flyer-camera-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(26, 26, 46, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.flyer-camera-header h3 {
    margin: 0;
    color: white;
    font-size: 1.1rem;
}

.flyer-camera-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.flyer-camera-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.flyer-camera-viewport {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: #000;
    overflow: hidden;
}

.flyer-camera-viewport video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.flyer-camera-frame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 3px solid rgba(26, 95, 42, 0.6);
    pointer-events: none;
    box-sizing: border-box;
}

.flyer-camera-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
    background: rgba(26, 26, 46, 0.9);
}

.flyer-camera-capture-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: white;
    border: 4px solid var(--primary-color, #1a5f2a);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flyer-camera-capture-btn svg {
    width: 56px;
    height: 56px;
    color: var(--primary-color, #1a5f2a);
}

.flyer-camera-capture-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(26, 95, 42, 0.5);
}

.flyer-camera-capture-btn:active {
    transform: scale(0.95);
}

/* Мобильная адаптация камеры */
@media (max-width: 768px) {
    .flyer-camera-container {
        max-width: 100%;
        height: 100vh;
        border-radius: 0;
    }
    
    .flyer-camera-viewport {
        height: calc(100vh - 140px);
        aspect-ratio: auto;
    }
}
