/* Social canvas editor fonts are registered at runtime (SC_<family> aliases) from the font endpoint
   via the Font Loading API - see LoadFonts in Editor.razor and socialCanvas.loadFont. There are no
   static @font-face rules here: the same DB-served bytes back both the editor and the PNG renderer. */

.social-canvas-viewport {
    overflow: auto;
    background: #4a4f55;
    padding: 24px;
    outline: none; /* focusable for keyboard shortcuts, but no focus ring on the big grey area */
    flex: 1 1 auto;
    min-height: 0;
}

.social-canvas-editor {
    display: flex;
    gap: 12px;
    align-items: stretch;
    height: calc(100vh - 200px);
    min-height: 500px;
}

.social-canvas-panel {
    flex: 0 0 320px;
    overflow-y: auto;
    background: #fff;
    padding: 12px;
    border: 1px solid #ddd;
}

.social-canvas-panel h3 {
    font-size: 15px;
    margin: 12px 0 6px;
}

.social-canvas-panel label {
    font-size: 12px;
    color: #666;
    margin-top: 6px;
}

.social-canvas-swatch {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 1px solid #999;
    border-radius: 3px;
    cursor: pointer;
    margin-right: 4px;
    vertical-align: middle;
}

.social-canvas-toolbar {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding: 6px 0;
}

.social-canvas-toolbar .button {
    margin-bottom: 0;
}

.social-canvas-slot-badge {
    background: #ffb300;
    color: #222;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-left: 6px;
}

/* ---- Full-screen editor shell (Canva-style layout) --------------------------------------- */
.sc-editor {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f0f1f3;
}

.sc-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 54px;
    flex: 0 0 54px;
    padding: 0 14px;
    background: #fff;
    border-bottom: 1px solid #e3e3e6;
    z-index: 30;
}

.sc-burger {
    font-size: 20px;
    color: #333;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
}

.sc-burger:hover {
    background: #f2f2f4;
}

.sc-name {
    border: 1px solid transparent !important;
    background: transparent !important;
    box-shadow: none !important;
    font-weight: 600;
    font-size: 16px;
    width: 260px;
    margin: 0 !important;
    height: 38px;
    padding: 0 8px !important;
}

.sc-name:hover,
.sc-name:focus {
    border-color: #e3e3e6 !important;
}

.sc-topbar .spacer {
    flex: 1 1 auto;
}

.sc-body {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.sc-rail {
    flex: 0 0 88px;
    background: #fff;
    border-right: 1px solid #e3e3e6;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 0;
    z-index: 20;
}

.sc-rail button {
    width: 68px;
    height: 66px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    color: #444;
    font-size: 11px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.sc-rail button:hover {
    background: #f2f2f4;
}

.sc-rail button i {
    font-size: 20px;
}

.sc-stage {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    background: #4a4f55;
    outline: none;
}

.sc-stage-scroll {
    position: absolute;
    inset: 0;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}

/* Floating contextual toolbar - sits over the canvas near the top, Canva-style. */
.sc-floating-toolbar {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 25;
    max-width: calc(100% - 32px);
}

/* Bottom-right zoom control with a slider and fit-to-screen. */
.sc-zoom {
    position: absolute;
    right: 16px;
    bottom: 16px;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #e3e3e6;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
    padding: 6px 12px;
}

.sc-zoom input[type="range"] {
    width: 130px;
    margin: 0;
}

.sc-zoom .sc-zoom-value {
    font-size: 13px;
    color: #333;
    width: 42px;
    text-align: right;
}

.sc-zoom button {
    border: 1px solid #e3e3e6;
    background: #fff;
    border-radius: 8px;
    height: 32px;
    padding: 0 10px;
    font-size: 13px;
    cursor: pointer;
    color: #333;
}

.sc-zoom button:hover {
    background: #f2f2f4;
}

/* Popover for canvas background / image replace, anchored off the left rail. */
.sc-popover {
    position: absolute;
    left: 96px;
    top: 12px;
    z-index: 30;
    width: 280px;
    background: #fff;
    border: 1px solid #e3e3e6;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .15);
    padding: 14px;
}

.sc-popover h4 {
    font-size: 14px;
    margin: 0 0 8px;
}

/* Canva-style contextual text toolbar - a rounded pill of the controls the renderer can honour.
   Deliberately excludes italic/underline/strike: the ImageSharp renderer supports bold only, and a
   button that changed the editor but not the exported PNG would break WYSIWYG. */
.social-canvas-textbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: #fff;
    border: 1px solid #e3e3e6;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    padding: 8px 12px;
    margin: 8px 0;
}

.social-canvas-textbar select,
.social-canvas-textbar .textbar-size-value {
    height: 40px;
    border: 1px solid #e3e3e6;
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
    padding: 0 12px;
}

.social-canvas-textbar select {
    min-width: 150px;
}

.social-canvas-size {
    display: flex;
    align-items: center;
    border: 1px solid #e3e3e6;
    border-radius: 8px;
    overflow: hidden;
    height: 40px;
}

.social-canvas-size button {
    width: 38px;
    height: 40px;
    border: none;
    background: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #333;
}

.social-canvas-size button:hover {
    background: #f2f2f4;
}

.social-canvas-size input {
    width: 56px;
    height: 40px;
    border: none;
    border-left: 1px solid #e3e3e6;
    border-right: 1px solid #e3e3e6;
    text-align: center;
    font-size: 15px;
    margin: 0;
}

.social-canvas-iconbtn {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e3e3e6;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 17px;
    color: #333;
}

.social-canvas-iconbtn:hover {
    background: #f2f2f4;
}

.social-canvas-iconbtn.active {
    background: #e9e2ff;
    border-color: #8b5cf6;
    color: #6d28d9;
}

.social-canvas-textbar .textbar-colour {
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 1px solid #e3e3e6;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
}

.social-canvas-textbar .textbar-divider {
    width: 1px;
    align-self: stretch;
    background: #e3e3e6;
    margin: 2px 2px;
}

/* Inline on-canvas text editing: a transparent textarea overlaid via foreignObject, styled to match
   the rendered text exactly so what you type is what you see. Plain textarea keeps the \n-only,
   no-auto-wrap contract the PNG renderer relies on. */
.social-canvas-inline-edit {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    /* !important throughout: the app's global Foundation textarea rules (background #fefefe, border,
       box-shadow, padding, margin-bottom) would otherwise paint a solid box over the canvas and hide
       the text. The overlay must be fully transparent so the glyphs show against the canvas. */
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
    resize: none !important;
    overflow: hidden;
    white-space: pre;
    caret-color: #00b0ff;
}
