/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #1a1a1a;
    color: #ffffff;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Панель инструментов */
.toolbar {
    background: #2a2a2a;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #404040;
}

.toolbar-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.slide-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 20px;
}

#slide-counter {
    font-size: 14px;
    color: #ccc;
    min-width: 120px;
    text-align: center;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #404040;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn:hover {
    background: #505050;
}

.btn-primary {
    background: #007acc;
}

.btn-primary:hover {
    background: #0066aa;
}

.btn-success {
    background: #28a745;
}

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
}

/* Основной контейнер */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Рабочая область */
.workspace {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1a1a1a;
    padding: 20px;
}

.canvas-container {
    position: relative;
    width: 80%;
    max-width: 1200px;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.canvas {
    position: relative;
    width: 100%;
    height: 100%;
}

.background-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.elements-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.text-element, .image-element {
    position: absolute;
    pointer-events: auto;
    cursor: move;
    user-select: none;
}

.text-element {
    font-size: 24px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    padding: 10px;
    border: 2px solid transparent;
    border-radius: 4px;
}

.text-element.selected {
    border-color: #007acc;
    background: rgba(0,122,204,0.1);
}

/* Ручки для изменения размера текста */
.text-element.selected .resize-handle {
    position: absolute;
    background: #007acc;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 10;
    display: block;
}

.text-element .resize-handle {
    display: none;
}

.resize-handle {
    position: absolute;
    background: #007acc;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 10;
}

.resize-handle.bottom-right {
    bottom: -6px;
    right: -6px;
    width: 12px;
    height: 12px;
    cursor: nw-resize;
}

.resize-handle.bottom-left {
    bottom: -6px;
    left: -6px;
    width: 8px;
    height: 8px;
    cursor: ne-resize;
}

.resize-handle.top-right {
    top: -6px;
    right: -6px;
    width: 8px;
    height: 8px;
    cursor: se-resize;
}

.resize-handle.top-left {
    top: -6px;
    left: -6px;
    width: 8px;
    height: 8px;
    cursor: sw-resize;
}

.image-element {
    border: 2px solid transparent;
}

.image-element.selected {
    border-color: #007acc;
}

.image-element img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
}

.modal-content {
    background-color: #2a2a2a;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover {
    color: white;
}

.preview-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 40px;
}

/* Полноэкранная презентация */
.fullscreen-presentation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.fullscreen-presentation.active {
    display: flex !important;
}

.fullscreen-slides {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    padding: 20px 0; /* Отступы сверху и снизу */
    box-sizing: border-box;
}

.fullscreen-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000; /* Черный фон */
    display: none;
}

.fullscreen-slide.active {
    display: block !important;
}

.fullscreen-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.fullscreen-elements {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.fullscreen-text-element {
    position: absolute;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: Arial, sans-serif;
}

.fullscreen-image-element {
    position: absolute;
}

.fullscreen-image-element img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.fullscreen-controls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s;
}

.fullscreen-presentation:hover .fullscreen-controls {
    opacity: 1;
}

.fullscreen-btn {
    padding: 12px 20px;
    background: rgba(0,0,0,0.8);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    backdrop-filter: blur(10px);
}

.fullscreen-btn:hover {
    background: rgba(0,0,0,0.9);
}

.slide-indicator {
    position: fixed;
    top: 30px;
    right: 30px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 10001;
    backdrop-filter: blur(10px);
}

/* Адаптивность */
@media (max-width: 1200px) {
    .main-container {
        flex-direction: column;
    }
    
    .layers-panel, .properties-panel {
        width: 100%;
        height: auto;
        max-height: 200px;
    }
}