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

body {
    font-family: 'Segoe UI', Roboto, system-ui, sans-serif;
    background: #1a1e2b;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #e0e0e0;
}

.app {
    display: flex;
    width: 100%;
    height: 100vh;
    max-width: 1600px;
    background: #1a1e2b;
    box-shadow: 0 0 30px rgba(0,0,0,0.7);
    overflow: hidden;
}

/* Боковая панель */
.sidebar {
    width: 300px;
    background: #242937;
    padding: 20px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    border-right: 1px solid #3a4050;
    box-shadow: 4px 0 15px rgba(0,0,0,0.3);
    z-index: 10;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #b0b9d0;
    margin-bottom: 4px;
    letter-spacing: 0.3px;
}

.sidebar-section input[type="text"],
.sidebar-section input[type="file"] {
    padding: 10px 12px;
    background: #1a1e2b;
    border: 1px solid #3a4050;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: border 0.2s;
}

.sidebar-section input[type="text"]:focus {
    border-color: #e67e22;
}

.sidebar-section input[type="file"] {
    padding: 8px;
    cursor: pointer;
}

.sidebar-section input[type="file"]::file-selector-button {
    background: #3a4050;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    color: white;
    margin-right: 10px;
    cursor: pointer;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-row input[type="color"] {
    width: 50px;
    height: 38px;
    border: 1px solid #3a4050;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.note {
    font-size: 12px;
    color: #9aa1b0;
    margin-top: 4px;
}

/* Кнопки */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    text-align: center;
}

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

.btn-primary:hover {
    background: #d35400;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

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

.btn-secondary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-template {
    background: #2ecc71;
    color: white;
    flex: 1;
    padding: 8px 0;
}

.btn-template:hover {
    background: #27ae60;
}

.btn-icon {
    background: #5d6d7e;
    color: white;
    padding: 8px 12px;
    font-size: 16px;
}

.btn-icon:hover {
    background: #34495e;
}

.template-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.zoom-controls {
    flex-direction: row !important;
    margin-top: auto;
}

/* Область редактора */
.editor-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f131c;
    padding: 16px;
    overflow: hidden;
}

.canvas-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f131c;
    border-radius: 12px;
    box-shadow: inset 0 0 20px #00000088;
}

#canvas {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
    box-shadow: 0 0 0 2px #2c3e50;
    background: white;
    /* Размеры будут управляться через JS */
}

/* Адаптив для мобильных */
@media (max-width: 768px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 45vh;
        border-right: none;
        border-bottom: 1px solid #3a4050;
        padding: 16px;
        overflow-y: auto;
    }

    .editor-area {
        padding: 8px;
    }

    .template-buttons {
        justify-content: space-between;
    }
}