/* That Guy Consulting — admin WYSIWYG canvas editor */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: 'Inter', system-ui, Arial, sans-serif; background: #1d2024; color: #e8eaed; }
button { font-family: inherit; }
a { color: #6ab7ff; }

/* ---------- login ---------- */
.login-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card { background: #282c31; padding: 36px 40px; border-radius: 12px; width: 340px; box-shadow: 0 10px 40px rgba(0,0,0,.5); text-align: center; }
.login-card img { width: 120px; margin-bottom: 8px; }
.login-card h1 { font-size: 18px; margin: 6px 0 20px; font-weight: 600; letter-spacing: .5px; }
.login-card input { width: 100%; padding: 11px 12px; border-radius: 7px; border: 1px solid #3a3f45; background: #1d2024; color: #fff; font-size: 14px; margin-bottom: 12px; }
.login-card button { width: 100%; padding: 11px; border: none; border-radius: 7px; background: #2f7d4f; color: #fff; font-size: 14px; cursor: pointer; font-weight: 600; }
.login-card .err { color: #ff7a7a; font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-rows: 52px 1fr; height: 100vh; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 0 14px; background: #15171a; border-bottom: 1px solid #000; }
.topbar .brand { font-weight: 700; letter-spacing: .5px; margin-right: 12px; font-size: 15px; }
.topbar .brand small { color: #8a9099; font-weight: 400; }
.topbar .spacer { flex: 1; }
.tbtn { background: #2a2f35; color: #e8eaed; border: 1px solid #3a3f45; padding: 7px 13px; border-radius: 7px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.tbtn:hover { background: #343a41; }
.tbtn.primary { background: #2f7d4f; border-color: #2f7d4f; }
.tbtn.primary:hover { background: #36925c; }
.tbtn.danger { background: #8a2f2f; border-color: #8a2f2f; }
.save-state { font-size: 12px; color: #8a9099; margin-left: 4px; min-width: 86px; }
.save-state.dirty { color: #ffcf6a; }
.save-state.saved { color: #7bd29a; }

.body { display: grid; grid-template-columns: 220px 1fr 300px; overflow: hidden; }
.panel { background: #21252a; overflow-y: auto; }
.panel-left { border-right: 1px solid #15171a; }
.panel-right { border-left: 1px solid #15171a; }
.panel h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #8a9099; margin: 16px 14px 8px; }

/* ---------- canvas area ---------- */
.stage-area { background: #313640; overflow: auto; position: relative; }
.stage-pad { padding: 40px; min-width: min-content; }
#canvas { position: relative; background-color: #f3efe6; margin: 0 auto; box-shadow: 0 8px 40px rgba(0,0,0,.5); transform-origin: top left;
  background-image: radial-gradient(circle at 4px 4px, rgba(0,0,0,.09) 1.1px, transparent 1.2px); background-size: 9px 9px; }
#canvas .el { position: absolute; }
#canvas .el-image img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; display: block; }
#canvas .el-text { overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
#canvas .el-field input, #canvas .el-field textarea, #canvas .el-field .submit-btn { width: 100%; height: 100%; border: none; background: inherit; font: inherit; color: inherit; padding: 6px 10px; pointer-events: none; }
#canvas .el { outline: 1px dashed transparent; cursor: move; }
#canvas .el:hover { outline-color: #6ab7ff88; }
#canvas .el.selected { outline: 1.5px solid #2f8fff; }

/* resize handles */
.handle { position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid #2f8fff; border-radius: 2px; z-index: 99999; }
.handle.nw { cursor: nwse-resize; } .handle.ne { cursor: nesw-resize; }
.handle.sw { cursor: nesw-resize; } .handle.se { cursor: nwse-resize; }
.handle.n { cursor: ns-resize; } .handle.s { cursor: ns-resize; }
.handle.e { cursor: ew-resize; } .handle.w { cursor: ew-resize; }

/* ---------- asset library ---------- */
.upload-zone { margin: 0 14px 10px; border: 1.5px dashed #3f454c; border-radius: 8px; padding: 14px; text-align: center; font-size: 12px; color: #9aa1a9; cursor: pointer; }
.upload-zone:hover { border-color: #2f8fff; color: #cfd4da; }
.asset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 14px 20px; }
.asset { background: #2c3137; border: 1px solid #353b42; border-radius: 6px; padding: 6px; cursor: pointer; text-align: center; }
.asset:hover { border-color: #2f8fff; }
.asset img { width: 100%; height: 54px; object-fit: contain; background:
   repeating-conic-gradient(#3a3f45 0% 25%, #2c3137 0% 50%) 50% / 14px 14px; border-radius: 3px; }
.asset span { display: block; font-size: 9px; color: #8a9099; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- properties ---------- */
.props { padding: 4px 14px 40px; }
.props .empty { color: #8a9099; font-size: 13px; padding: 20px 0; text-align: center; }
.field { margin-bottom: 11px; }
.field label { display: block; font-size: 11px; color: #9aa1a9; margin-bottom: 4px; letter-spacing: .3px; }
.field input[type=text], .field input[type=number], .field input[type=url], .field select, .field textarea {
  width: 100%; padding: 7px 9px; background: #1a1d21; border: 1px solid #353b42; border-radius: 6px; color: #e8eaed; font-size: 13px;
}
.field textarea { resize: vertical; min-height: 64px; font-family: 'SFMono-Regular', Menlo, monospace; font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.field input[type=color] { width: 100%; height: 32px; padding: 2px; background: #1a1d21; border: 1px solid #353b42; border-radius: 6px; }
.color-row { display: flex; gap: 6px; align-items: center; }
.color-row input[type=color] { width: 40px; flex: 0 0 40px; }
.color-row input[type=text] { flex: 1; }
.seg { display: flex; gap: 0; }
.seg button { flex: 1; background: #1a1d21; border: 1px solid #353b42; color: #cfd4da; padding: 6px; cursor: pointer; font-size: 12px; }
.seg button:first-child { border-radius: 6px 0 0 6px; }
.seg button:last-child { border-radius: 0 6px 6px 0; }
.seg button.active { background: #2f8fff; color: #fff; border-color: #2f8fff; }
.prop-section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #6f767e; margin: 18px 0 8px; border-top: 1px solid #2c3137; padding-top: 12px; }
.mini-btns { display: flex; gap: 6px; margin-top: 8px; }
.mini-btns button { flex: 1; background: #2a2f35; border: 1px solid #3a3f45; color: #e8eaed; padding: 6px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.mini-btns button:hover { background: #343a41; }
.dup-btn { width: 100%; margin-top: 16px; background: #2a2f35; border: 1px solid #3a3f45; color: #e8eaed; padding: 9px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.dup-btn:hover { background: #343a41; }
.del-btn { width: 100%; margin-top: 8px; background: #8a2f2f; border: none; color: #fff; padding: 9px; border-radius: 7px; cursor: pointer; font-size: 13px; }
.del-btn:hover { background: #a13838; }

.zoomctl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #9aa1a9; }
.zoomctl button { width: 26px; height: 26px; border-radius: 6px; border: 1px solid #3a3f45; background: #2a2f35; color: #fff; cursor: pointer; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #2f7d4f; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 100000; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: #a13838; }
