/* CMS edit-mode styles. Loaded by consumer apps via importmap or AssetMapper auto-discovery. */

body.cms-edit-mode .cms-editable {
    outline: 2px dashed transparent;
    outline-offset: 2px;
    transition: outline-color 0.15s ease;
    cursor: text;
}

body.cms-edit-mode .cms-editable:hover {
    outline-color: rgba(0, 122, 255, 0.4);
}

body.cms-edit-mode .cms-editable--active {
    outline-color: rgba(0, 122, 255, 0.85);
    background-color: rgba(0, 122, 255, 0.05);
}

body.cms-edit-mode .cms-editable-image {
    outline: 2px dashed transparent;
    outline-offset: 2px;
    cursor: pointer;
    position: relative;
}

body.cms-edit-mode .cms-editable-image:hover {
    outline-color: rgba(0, 122, 255, 0.6);
}

body.cms-edit-mode .cms-editable-image::after {
    content: '📷 Klik pro výměnu';
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

body.cms-edit-mode .cms-editable-image:hover::after {
    opacity: 1;
}

body.cms-edit-mode .cms-richtext-editable {
    outline: 2px dashed transparent;
    outline-offset: 2px;
    cursor: pointer;
}

body.cms-edit-mode .cms-richtext-editable:hover {
    outline-color: rgba(0, 122, 255, 0.4);
}

body.cms-edit-mode .cms-gallery-edit--active > * {
    cursor: move;
}

body.cms-edit-mode .cms-add-button {
    background: #007aff;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
}

/* Toast */
.cms-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 100000;
    animation: cms-toast-in 0.2s ease;
}

.cms-toast--success { background: #34c759; }
.cms-toast--error { background: #ff3b30; }

@keyframes cms-toast-in {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Modals (collection-modal + richtext-modal) */
.cms-modal,
.cms-richtext-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.cms-modal__inner,
.cms-richtext-modal__inner {
    background: white;
    border-radius: 8px;
    padding: 24px;
    min-width: 400px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.cms-modal__header h3,
.cms-richtext-modal__header h3 {
    margin: 0 0 16px;
    font-size: 18px;
}

.cms-modal__field {
    display: block;
    margin-bottom: 12px;
}

.cms-modal__field span {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
}

.cms-modal__field input,
.cms-modal__field textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
}

.cms-modal__field textarea { min-height: 80px; }

.cms-modal__actions,
.cms-richtext-modal__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}

.cms-modal__actions button,
.cms-richtext-modal__actions button {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ccc;
    background: white;
    font-weight: 500;
}

.cms-modal__actions button[type="submit"],
.cms-richtext-modal__actions [data-action="cms-richtext:save"] {
    background: #007aff;
    color: white;
    border-color: #007aff;
}

.cms-richtext-modal__editor {
    min-height: 300px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 12px;
}

/* GrapesJS modal — Plan 04 Mode A */
body.cms-edit-mode .cms-grapes-editable {
    outline: 2px dashed transparent;
    outline-offset: 2px;
    cursor: pointer;
    position: relative;
    min-height: 60px;
}
body.cms-edit-mode .cms-grapes-editable:hover { outline-color: rgba(255, 149, 0, 0.6); }
body.cms-edit-mode .cms-grapes-editable--active::before {
    content: '🧩 Klik pro úpravu sekce';
    position: absolute; top: 8px; right: 8px;
    background: #ff9500; color: white;
    padding: 4px 8px; font-size: 12px; border-radius: 4px;
    pointer-events: none;
    z-index: 10;
}

.cms-grapes-modal {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
}
.cms-grapes-modal__inner {
    background: white;
    width: 95vw; height: 95vh;
    border-radius: 8px;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.cms-grapes-modal__header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid #eee;
    background: #f5f5f7;
}
.cms-grapes-modal__header h3 { margin: 0; font-size: 16px; }
.cms-grapes-modal__actions { display: flex; gap: 8px; }
.cms-grapes-modal__actions button {
    padding: 8px 16px; border-radius: 4px; cursor: pointer;
    border: 1px solid #ccc; background: white; font-weight: 500;
}
.cms-grapes-modal__actions [data-action="cms-grapes:save"] {
    background: #34c759; color: white; border-color: #34c759;
}
.cms-grapes-modal__body {
    display: flex; flex: 1; min-height: 0;
}
.cms-grapes-modal__canvas {
    flex: 1; min-height: 0;
}
.cms-grapes-modal__sidebar {
    width: 280px; padding: 12px;
    overflow-y: auto; background: #fafafa;
    border-left: 1px solid #eee;
}
.cms-grapes-modal__sidebar h4 {
    margin: 16px 0 8px; font-size: 13px;
    text-transform: uppercase; letter-spacing: 0.04em;
    color: #888;
}
.cms-grapes-modal__sidebar h4:first-child { margin-top: 0; }
