/* Layout editor styling — only kicks in when body has .layout-edit-mode */

.layout-editor-toolbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: 0 0 12px 12px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    box-shadow: 0 8px 16px rgba(0,0,0,.15);
}

.layout-editor-toolbar h6 {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,.85);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.layout-toolbar-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.layout-toolbar-switch input {
    width: 38px;
    height: 20px;
    appearance: none;
    background: rgba(255,255,255,.25);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s ease;
}

.layout-toolbar-switch input:checked {
    background: #4ca6d1;
}

.layout-toolbar-switch input::after {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: white;
    top: 2px; left: 2px;
    transition: left .2s ease;
}

.layout-toolbar-switch input:checked::after { left: 20px; }

.layout-toolbar-status {
    font-size: 0.85rem;
    margin-left: auto;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

.layout-toolbar-status.success { background: rgba(16, 185, 129, 0.25); color: #d1fae5; }
.layout-toolbar-status.error   { background: rgba(239, 68, 68, 0.25);  color: #fee2e2; }
.layout-toolbar-status.info    { background: rgba(59, 130, 246, 0.25); color: #dbeafe; }

.layout-toolbar-btn {
    background: rgba(255,255,255,.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,.2);
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background .15s ease;
}

.layout-toolbar-btn:hover { background: rgba(255,255,255,.2); }

/* Edit mode visual cues */
body.layout-edit-mode .section-container {
    position: relative;
    outline: 2px dashed rgba(76, 166, 209, 0.5);
    outline-offset: -4px;
    border-radius: 12px;
    cursor: grab;
    transition: outline-color .15s ease;
}

body.layout-edit-mode .section-container:hover {
    outline-color: var(--primary-color, #4ca6d1);
}

body.layout-edit-mode .section-overlay {
    display: flex;
}

.section-overlay {
    display: none;
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 10;
    align-items: center;
    gap: 4px;
    background: rgba(15, 23, 42, 0.85);
    color: #fff;
    border-radius: 8px;
    padding: 4px;
    font-size: 0.75rem;
}

.section-overlay button,
.section-overlay [data-drag-handle] {
    background: transparent;
    color: #fff;
    border: none;
    padding: 2px 6px;
    cursor: pointer;
    border-radius: 4px;
}

.section-overlay button:hover { background: rgba(255,255,255,.15); }
.section-overlay .danger:hover { background: rgba(239, 68, 68, .35); }
.section-overlay [data-drag-handle] { cursor: grab; }
.section-overlay [data-drag-handle]:active { cursor: grabbing; }

.section-overlay .width-picker {
    display: inline-flex;
    gap: 2px;
    border-left: 1px solid rgba(255,255,255,.2);
    border-right: 1px solid rgba(255,255,255,.2);
    padding: 0 4px;
    margin: 0 2px;
}

.layout-section-ghost { opacity: 0.4; background: rgba(76, 166, 209, 0.15); }
.layout-section-chosen { box-shadow: 0 12px 28px rgba(0,0,0,.18); }

/* Modal styling */
.layout-modal::backdrop { background: rgba(15, 23, 42, 0.55); }
.layout-modal {
    border: none;
    border-radius: 12px;
    padding: 0;
    max-width: 640px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
}

.layout-modal-form {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.layout-modal-form h4 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.layout-modal-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
}

.layout-modal-form label.inline {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.layout-modal-form input[type="text"],
.layout-modal-form input[type="url"],
.layout-modal-form select,
.layout-modal-form textarea {
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.6rem;
    border-radius: 6px;
    font: inherit;
}

.layout-modal-form textarea {
    font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
    font-size: 0.85rem;
}

.layout-modal-form menu {
    list-style: none;
    margin: 0; padding: 0;
    display: flex; gap: 0.5rem;
    justify-content: flex-end;
    border-top: 1px solid #e2e8f0;
    padding-top: 0.85rem;
    margin-top: 0.5rem;
}

.layout-modal-form button {
    padding: 0.45rem 1rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #fff;
    cursor: pointer;
}

.layout-modal-form button.primary {
    background: var(--primary-color, #4ca6d1);
    color: #fff;
    border-color: transparent;
}

.layout-modal-form button.danger {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
    margin-right: auto;
}
