/* screenshot-editor.tuls.me — styles specific to the Screenshot Editor tool.
   Loaded only by templates/screenshot-editor.html, after app.css.
   Full-height workspace: the toolbars keep a fixed height, the canvas takes
   whatever is left of the viewport. `--se-chrome` is set from JS to the real
   height of the sticky site header. */

.se-shell {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    padding: .5rem .75rem .625rem;
    box-sizing: border-box;
    height: calc(100vh - var(--se-chrome, 61px));
    height: calc(100dvh - var(--se-chrome, 61px));
}

.se-bar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .375rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    padding: .25rem .5rem;
}

.se-bar-options { background: #f9fafb; }

.se-title {
    font-size: .9375rem;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    margin-right: .25rem;
}

.se-spacer { flex: 1 1 auto; }

.se-group,
.se-toolgroup {
    display: flex;
    align-items: center;
    gap: 1px;
}

.se-group {
    padding-left: .5rem;
    margin-left: .125rem;
    border-left: 1px solid #e5e7eb;
}

.se-group-plain { border-left: none; }

.se-toolgroup {
    background: #f3f4f6;
    border-radius: .5rem;
    padding: 2px;
}

.se-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: .5rem;
    color: #6b7280;
    background: transparent;
    transition: background .12s, color .12s;
}

.se-btn:hover:not([disabled]) { background: #eef2f5; color: #111827; }
.se-btn[disabled] { opacity: .3; cursor: not-allowed; }
.se-btn.is-active { background: #fff; color: #ea580c; box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.se-btn.has-beauty { color: #ea580c; }
.se-btn-danger:hover:not([disabled]) { background: #fef2f2; color: #dc2626; }

.se-indicator {
    min-width: 34px;
    text-align: center;
    font-size: .75rem;
    font-weight: 500;
    color: #6b7280;
}

.se-dims {
    font-size: .75rem;
    font-weight: 500;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    padding: 0 .25rem;
}

/* Export cluster (sticky bottom bar under 768px) */
.se-export-actions { display: flex; align-items: center; gap: .375rem; }

.se-copy,
.se-copy-caret {
    background: #f97316;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    font-size: .8125rem;
    font-weight: 600;
    height: 32px;
    transition: background .12s;
}

.se-copy { padding: 0 .625rem 0 .75rem; border-radius: .5rem 0 0 .5rem; }
.se-copy-caret { padding: 0 .375rem; border-radius: 0 .5rem .5rem 0; border-left: 1px solid rgba(255, 255, 255, .35); }
.se-copy:hover, .se-copy-caret:hover { background: #ea580c; }

.se-destructive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .375rem;
    height: 32px;
    width: 32px;
    border-radius: .5rem;
    color: #ef4444;
    border: 1px solid #fecaca;
    background: #fff;
    font-size: .8125rem;
    font-weight: 600;
    transition: background .12s;
}

.se-destructive:hover { background: #fef2f2; }
.se-destructive-label { display: none; }

/* Options bar */
.se-opt { display: flex; align-items: center; gap: .5rem; }
.se-opt + .se-opt { border-left: 1px solid #e5e7eb; padding-left: .625rem; }
.se-opt.hidden { display: none; }
.se-opt-label { font-size: .6875rem; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .02em; }
.se-opt-hint { font-size: .75rem; color: #9ca3af; font-style: italic; }

.se-swatches { display: flex; align-items: center; gap: .25rem; }

.color-btn, .textbg-btn {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, .12);
    transition: transform .12s, box-shadow .12s;
}

.textbg-btn { border-radius: .25rem; }
.color-btn:hover, .textbg-btn:hover { transform: scale(1.12); }
.color-btn.is-active, .textbg-btn.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111827; }
.se-bg-none { background: #fff; position: relative; overflow: hidden; }
.se-bg-none::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom right, transparent 45%, #ef4444 45%, #ef4444 55%, transparent 55%); }
.se-color-input { width: 22px; height: 22px; border: 0; border-radius: .25rem; padding: 0; cursor: pointer; background: none; }

.se-seg { display: flex; align-items: center; gap: 1px; background: #fff; border: 1px solid #e5e7eb; border-radius: .375rem; padding: 2px; }

.se-seg > button {
    min-width: 26px;
    height: 24px;
    padding: 0 .375rem;
    border-radius: .25rem;
    font-size: .75rem;
    font-weight: 600;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.se-seg > button:hover { background: #f3f4f6; color: #111827; }
.se-seg > button.is-active { background: #f97316; color: #fff; }

/* Mise en beauté: background swatches (solid + gradient) and preset chips */
.bg-btn {
    width: 22px;
    height: 22px;
    border-radius: .25rem;
    border: 1px solid rgba(0, 0, 0, .12);
    transition: transform .12s, box-shadow .12s;
}

.bg-btn:hover { transform: scale(1.12); }
.bg-btn.is-active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111827; }

.se-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 .625rem;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #4b5563;
    font-size: .75rem;
    font-weight: 600;
    transition: background .12s, color .12s;
}

.se-chip + .se-chip { margin-left: .25rem; }
.se-chip:hover { background: #f9fafb; color: #111827; }
.se-chip.is-primary { background: #f97316; border-color: #f97316; color: #fff; }
.se-chip.is-primary:hover { background: #ea580c; color: #fff; }

/* Keyboard shortcuts popover (btn-shortcuts) */
.se-shortcuts-wrap { position: relative; }

.se-shortcuts-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: .375rem;
    width: 19rem;
    max-height: min(28rem, 70vh);
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    box-shadow: 0 12px 28px rgba(0, 0, 0, .14);
    z-index: 50;
}

.se-shortcuts-panel.hidden { display: none; }

.se-shortcuts-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .625rem .75rem;
    border-bottom: 1px solid #e5e7eb;
    font-size: .8125rem;
    font-weight: 700;
    color: #111827;
}

.se-shortcuts-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: .375rem;
    color: #9ca3af;
    transition: background .12s, color .12s;
}

.se-shortcuts-close:hover { background: #f3f4f6; color: #111827; }

.se-shortcuts-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: .5rem .75rem .75rem;
}

.se-kb-group + .se-kb-group { margin-top: .625rem; padding-top: .625rem; border-top: 1px solid #f3f4f6; }
.se-kb-group-title { font-size: .6875rem; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .375rem; }

.se-kb-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    padding: .1875rem 0;
    font-size: .8125rem;
    color: #374151;
}

.se-kb-row kbd {
    flex: 0 0 auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: .6875rem;
    font-weight: 500;
    color: #4b5563;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: .3125rem;
    padding: .0625rem .375rem;
    white-space: nowrap;
}

/* Persistent "session not saved" banner */
.se-banner {
    display: flex;
    align-items: center;
    gap: .375rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
    border-radius: .5rem;
    padding: .25rem .5rem;
    font-size: .75rem;
    font-weight: 500;
}

.se-banner.hidden { display: none; }

/* Work area */
.se-main { flex: 1 1 auto; min-height: 0; display: flex; gap: .75rem; }

.se-canvas-area {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
}

.se-canvas-area.is-dragover { border-color: #f97316; background: #fff7ed; }
.se-canvas { border-radius: .5rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); cursor: default; }

/* Empty state */
.se-dropzone { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 1.5rem; cursor: pointer; }
.se-dropzone.hidden { display: none; }

.se-dropzone-inner {
    text-align: center;
    padding: 2.5rem 3rem;
    border: 2px dashed #cbd5e1;
    border-radius: 1rem;
    background: #fff;
    max-width: 32rem;
}

.se-dropzone:hover .se-dropzone-inner { border-color: #f97316; }
.se-dropzone-icon { width: 4rem; height: 4rem; margin: 0 auto 1rem; border-radius: 1rem; background: #fff7ed; color: #ea580c; display: flex; align-items: center; justify-content: center; }
.se-dropzone-title { font-size: 1.0625rem; font-weight: 600; color: #1f2937; margin-bottom: .375rem; }
.se-dropzone-hint { font-size: .875rem; color: #4b5563; margin-bottom: 1.25rem; }

.se-dropzone-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 1.25rem;
    border-radius: .5rem;
    background: #f97316;
    color: #fff;
    font-size: .875rem;
    font-weight: 600;
    transition: background .12s;
}

.se-dropzone-btn:hover { background: #ea580c; }

/* Layers panel */
.se-layers {
    flex: 0 0 13rem;
    width: 13rem;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    padding: .625rem;
    min-height: 0;
}

.se-layers.hidden { display: none; }
.se-layers-title { font-size: .6875rem; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: .06em; margin-bottom: .5rem; }
.se-layers-list { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.se-layers-empty { font-size: .8125rem; color: #9ca3af; font-style: italic; text-align: center; padding: 1rem 0; }

.se-layer {
    display: flex;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .25rem .375rem;
    border-radius: .5rem;
    text-align: left;
    cursor: pointer;
}

.se-layer:hover { background: #f3f4f6; }
.se-layer.is-selected { background: #ecfeff; box-shadow: inset 0 0 0 1px #67e8f9; }
.se-layer-dot { width: 10px; height: 10px; border-radius: 999px; flex: 0 0 auto; border: 1px solid rgba(0, 0, 0, .1); }
.se-layer-label { font-size: .75rem; color: #374151; flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.se-layer-del { width: 24px; height: 24px; border-radius: .25rem; color: #9ca3af; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.se-layer:hover .se-layer-del, .se-layer-del:focus-visible { color: #6b7280; }
.se-layer-del:hover { background: #fee2e2; color: #dc2626; }

.se-layers-clear {
    margin-top: .5rem;
    min-height: 32px;
    border-radius: .5rem;
    font-size: .75rem;
    font-weight: 600;
    color: #ef4444;
    transition: background .12s;
}

.se-layers-clear:hover { background: #fef2f2; }
.se-layers-clear[disabled] { opacity: .4; cursor: not-allowed; }

/* Toasts */
.se-toasts {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: .5rem;
    pointer-events: none;
}

.se-toast {
    pointer-events: auto;
    max-width: 22rem;
    padding: .5rem .875rem;
    border-radius: .5rem;
    background: #111827;
    color: #fff;
    font-size: .8125rem;
    font-weight: 500;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .18s ease, transform .18s ease;
}

.se-toast.is-visible { opacity: 1; transform: none; }
.se-toast.is-success { background: #047857; }
.se-toast.is-error { background: #b91c1c; }

/* ── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
    .se-shell {
        height: auto;
        min-height: calc(100dvh - var(--se-chrome, 61px));
        padding: .375rem .5rem 5.5rem;
    }

    .se-title { font-size: .8125rem; }
    .se-btn { width: 40px; height: 40px; }
    .se-group { padding-left: .375rem; }
    .se-main { flex-direction: column; }
    .se-canvas-area { min-height: 50vh; }

    .se-export-actions {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 40;
        padding: .5rem .75rem;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, .08);
    }

    .se-toasts { bottom: 5.25rem; }
    .se-copy-split { flex: 1 1 auto; }
    .se-copy { flex: 1 1 auto; height: 44px; }
    .se-copy-caret { height: 44px; min-width: 44px; padding: 0 .625rem; }
    .se-destructive { height: 44px; width: auto; padding: 0 .875rem; }
    .se-destructive-label { display: inline; }
    #export-menu { top: auto !important; bottom: 100%; margin-bottom: .375rem; }

    .color-btn, .textbg-btn, .se-color-input { width: 40px; height: 40px; }
    .bg-btn { width: 34px; height: 34px; }
    .se-chip { height: 36px; padding: 0 .875rem; font-size: .8125rem; }
    .se-seg > button { min-width: 40px; height: 40px; font-size: .8125rem; }
    .se-layers { flex: 0 0 auto; width: 100%; max-height: 14rem; }
    .se-dropzone-inner { padding: 1.5rem 1rem; }
    .se-shortcuts-panel { width: min(19rem, calc(100vw - 1.5rem)); }
}
