/* css/main.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f9;
    color: #333;
    margin: 0;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
h1, h2 {
    color: #1a202c;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 10px;
    margin-top: 0;
}
.site-controls {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    padding: 20px;
    background-color: #fcfdff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.control-group { flex: 1; }
label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}
input[type="text"], select {
    width: 100%;
    padding: 10px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    box-sizing: border-box;
}
button {
    background-color: #4a5568;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    margin-top: 10px;
}
button:hover { background-color: #2d3748; }
.editor-area {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}
.message-success {
    padding: 15px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}
.message-error {
    padding: 15px;
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    margin-bottom: 20px;
}
body { padding: 0; }
.editor-container {
    display: flex;
    height: calc(100vh - 60px);
}
.palette {
    width: 280px;
    background-color: #f8fafc;
    border-right: 1px solid #e2e8f0;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}
.palette h3 {
    margin-top: 0;
    color: #4a5568;
}
.palette-item {
    background-color: #fff;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 10px;
    cursor: grab;
    font-weight: 500;
    transition: background-color 0.2s, box-shadow 0.2s;
}
.palette-item:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}
.palette-item:active {
    cursor: grabbing;
    background-color: #e2e8f0;
}
.canvas {
    flex-grow: 1;
    padding: 30px;
    background-color: #f1f5f9;
    overflow-y: auto;
    min-width: 0;
}
.palette-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}
.tab-button {
    flex: 1;
    padding: 12px 10px;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}
.tab-button:hover {
    background-color: #f1f5f9;
    color: #334155;
}
.tab-button.active {
    color: #1e293b;
    border-bottom-color: #4a5568;
}
.palette-content {
    padding-top: 20px;
    flex-grow: 1;
    overflow-y: auto;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fff;
    padding: 0 20px;
    height: 60px;
    border-bottom: 1px solid #e2e8f0;
    box-sizing: border-box;
}
.top-bar-left .back-link {
    text-decoration: none;
    color: #4a5568;
    font-weight: 600;
}
.top-bar-right {
    display: flex;
    gap: 15px;
}
.action-button {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    background-color: #f8fafc;
    color: #334155;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
}
.action-button:hover {
    background-color: #f1f5f9;
    border-color: #94a3b8;
}
.action-button.primary {
    background-color: #4a5568;
    border-color: #4a5568;
    color: #fff;
}
.action-button.primary:hover {
    background-color: #2d3748;
    border-color: #2d3748;
}
.canvas > * {
    transition: outline 0.2s ease-in-out;
    cursor: pointer;
    overflow-wrap: break-word;
    position: relative; /* --- ИЗМЕНЕНИЕ 1 --- Добавляем позиционирование для дочерних кнопок */
}
.selected-element {
    outline: 2px dashed #4a5568;
    outline-offset: 3px;
}
.canvas .dragging { opacity: 0.5; }
.drag-placeholder {
    height: 4px;
    background-color: #4a5568;
    margin: 10px 0;
    border-radius: 2px;
}

/* --- НОВЫЕ СТИЛИ для кнопки удаления --- */
.delete-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 30px;
    height: 30px;
    background-color: #ef4444; /* Красный цвет */
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    line-height: 26px; /* Для центрирования крестика */
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    padding: 0;
    margin: 0;
}
.delete-btn:hover {
    background-color: #dc2626; /* Более темный красный при наведении */
}