* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

header {
    padding: 25px 30px;
    background: linear-gradient(135deg, #134E5E, #71B280);
    text-align: center;
    border-bottom: none;
}

header h1 {
    font-size: 28px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
}

.edit-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0;
    padding: 20px 30px;
    background: transparent;
    border-bottom: none;
}

.edit-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: transparent;
    border: none;
    border-radius: 0;
    font-size: 15px;
    font-weight: 500;
    color: #2c3e50;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.edit-item:not(:last-child)::after {
    content: '';
    position: absolute;
    right: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background-color: #d0d7de;
}

.edit-item:hover::after {
    background-color: transparent;
}

.edit-item:hover {
    background-color: #3d7b6d;
    color: white;
    border-radius: 30px;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .edit-menu {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0;
        padding: 15px;
    }
    .edit-item {
        padding: 10px 16px;
        width: auto;
        justify-content: center;
    }
    .canvas-container {
        min-height: 400px;
    }
    .workspace {
        padding: 15px;
    }
    .editor-panel {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin: 0 15px 20px;
    }
    header h1 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }
    .edit-menu {
        padding: 12px;
    }
    .edit-item {
        padding: 8px 14px;
        font-size: 14px;
    }
    .canvas-container {
        min-height: 350px;
    }
    .editor-panel {
        margin: 0 10px 20px;
    }
    header h1 {
        font-size: 20px;
    }
}

.workspace {
    flex: 1;
    padding: 25px;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.canvas-container {
    flex: 1;
    border: none;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    background: #fafafa;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.canvas-container canvas {
    display: block;
    width: auto;
    height: auto;
}

.canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.7);
    z-index: 5;
    pointer-events: none;
}

.upload-area {
    text-align: center;
    padding: 30px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    pointer-events: auto;
}

.upload-area i {
    color: #3d7b6d;
    margin-bottom: 15px;
}

.upload-area p {
    margin: 10px 0;
    color: #2c3e50;
}

.upload-area .btn {
    background: #3d7b6d;
    border: 1px solid #3d7b6d;
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    transition: all 0.2s;
}

.upload-area .btn:hover {
    background: transparent;
    color: #3d7b6d;
    border: 1px solid #3d7b6d;
}

.instructions {
    margin-top: 10px;
    padding: 15px 20px;
    background: #f0f7ff;
    border-radius: 12px;
    border-left: 5px solid #3498db;
}

.instruction-text {
    font-size: 15px;
    color: #2c3e50;
    font-style: italic;
}

.editor-panel {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    margin: 0 30px 20px 30px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    border: 1px solid #ecf0f1;
    transition: all 0.2s;
}

.editor-section {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    width: 100%;
}

.editor-left-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.editor-label {
    font-size: 14px;
    font-weight: 500;
    color: #7f8c8d;
    margin-right: 4px;
}

.color-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-preview {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: border 0.2s;
}

.color-preview:hover {
    border-color: #3498db;
}

.color-hex-input {
    width: 80px;
    padding: 6px 10px;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
}

.size-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.size-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    overflow: hidden;
}

.size-number-input {
    width: 70px;
    padding: 6px 10px;
    border: none;
    text-align: center;
    font-size: 14px;
    outline: none;
}

.size-unit {
    padding: 6px 10px;
    background: #f5f5f5;
    color: #7f8c8d;
    font-size: 13px;
    border-left: 1px solid #dcdcdc;
}

.btn-icon {
    background: none;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 12px;
    color: #e74c3c;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-icon:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

.empty-state {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #95a5a6;
    font-style: italic;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: #95a5a6;
}

.close:hover {
    color: #34495e;
}

.modal-body {
    padding: 25px;
    overflow-y: auto;
}

.format-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.format-btn {
    padding: 8px 16px;
    border: 1px solid #dcdcdc;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
}

.format-btn.active {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

.export-info {
    background: #e8f5e9;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    color: #27ae60;
    font-size: 14px;
}

#exportData {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

footer {
    padding: 15px 30px;
    border-top: 1px solid #ecf0f1;
    text-align: center;
    color: #7f8c8d;
    font-size: 14px;
}

/* === ВИЗУАЛЬНАЯ РАМКА ИЗОБРАЖЕНИЯ === */
.image-boundary {
    position: absolute;
    border: 2px dashed rgba(52, 152, 219, 0.7);
    pointer-events: none;
    z-index: 5;
    box-sizing: border-box;
}

.canvas-container.has-image {
    border: none;
}

@media (max-width: 1024px) {
    .canvas-container {
        min-height: 500px;
    }
    .editor-panel {
        flex-wrap: wrap;
        padding: 16px;
    }
    .editor-section {
        gap: 16px;
    }
}

/* Добавить в конец файла style.css */

/* Мобильные стили для редактора */
@media (max-width: 768px) {
    /* Скрываем блок с относительными координатами */
    .mobile-hidden {
        display: none !important;
    }
    
    /* Вертикальное выравнивание для QR-кода */
    .editor-section {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    
    .editor-section .qr-group,
    .editor-section .text-group,
    .editor-section .size-group,
    .editor-section .rotate-group {
        width: 100% !important;
        justify-content: space-between !important;
        margin: 0 !important;
    }
    
    .editor-section .qr-group,
    .editor-section .text-group {
        order: 1 !important;
    }
    
    .editor-section .size-group {
        order: 2 !important;
    }
    
    .editor-section .rotate-group {
        order: 3 !important;
    }
    
    .editor-section .btn-icon {
        order: 4 !important;
        margin-left: 0 !important;
        width: 100% !important;
        justify-content: center !important;
    }
    
    /* Улучшаем отображение элементов управления */
    .color-control {
        flex: 1 !important;
        justify-content: flex-end !important;
    }
    
    .size-control {
        width: 100% !important;
    }
    
    .size-input-wrapper {
        flex: 1 !important;
        max-width: 120px !important;
    }
    
    .rotate-control {
        width: 100% !important;
        justify-content: space-between !important;
    }
    
    .rotate-control .size-input-wrapper {
        width: 80px !important;
        max-width: none !important;
    }
    
    /* Кнопка удаления на всю ширину */
    #deleteObjectBtn {
        width: 100% !important;
        margin-top: 4px !important;
    }
}

@media (max-width: 480px) {
    .editor-section {
        gap: 10px !important;
    }
    
    .editor-label {
        min-width: 60px !important;
    }
    
    .color-control {
        gap: 4px !important;
    }
    
    .color-preview {
        width: 28px !important;
        height: 28px !important;
    }
    
    .color-hex-input {
        width: 70px !important;
        padding: 4px 8px !important;
    }
    
    .size-number-input {
        width: 60px !important;
        padding: 4px 8px !important;
    }
    
    .rotate-control .btn-icon {
        padding: 6px 10px !important;
    }
    
    .rotate-control .size-input-wrapper {
        width: 70px !important;
    }
    
    .rotate-control .size-number-input {
        width: 40px !important;
    }
}