/* Top Bar */
#topBar {
    display: flex;
    flex-wrap: wrap;  /* allow wrap for responsiveness */
    align-items: center;
    background: #3f51b5;
    color: #fff;
    padding: 10px;
}
#topBar h1 {
    margin: 0 20px 0 0;
    font-size: 20px;
    flex-shrink: 0;
}
#topBar button,
#topBar .dropbtn {
    background: #fff;
    color: #333;
    border: none;
    margin: 5px;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    flex-shrink: 0;
}
#topBar button:hover,
#topBar .dropbtn:hover {
    background: #ddd;
}
.pencilLabel {
    margin: 5px;
    color: #fff;
    font-weight: 500;
}
.pencilLabel input[type="color"],
.pencilLabel input[type="number"] {
    margin-left: 5px;
}
.spacer {
    flex: 1;
}

/* Dropdown for shapes & background */
.dropdown {
    position: relative;
    display: inline-block;
    margin: 5px;
}
.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fefefe;
    min-width: 160px;
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
    z-index: 1000;
    border-radius: 4px;
    padding: 4px 0;
}
.dropdown-content div {
    padding: 8px 12px;
    cursor: pointer;
    color: #000; /* ensure black text */
    white-space: nowrap;
}
.dropdown-content div:hover {
    background-color: #ddd;
}

/* Workspace */
#workspace {
    display: flex;
    height: calc(100vh - 60px);
}

/* Template Panel */
#templatePanel {
    width: 220px;
    background: #e8eaf6;
    padding: 15px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.15);
    overflow-y: auto;
}
#templatePanel h2 {
    margin-bottom: 12px;
}
.tItem {
    padding: 8px;
    background: #fff;
    margin-bottom: 8px;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    font-weight: 500;
    display: inline-block;
}
.tItem:hover {
    background: #ddd;
}
.hidden {
    display: none;
}

/* SVG Container */
#svgContainer {
  position: relative; /* Add this! */
  flex: 1;
  background: #fff;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 1px #999; /* existing styles... */
}

#mainCanvas {
    width: 100%;
    height: 100%;
}

/* Bounding box + handles */
.boundingBox {
    fill: none;
    stroke: #00f;
    stroke-width: 1;
    stroke-dasharray: 3,3;
    pointer-events: none;
}
.handle {
    fill: #fff;
    stroke: #00f;
    stroke-width: 1;
    cursor: pointer;
}

/* Toolbox */
#toolbox {
    position: absolute; /* (instead of fixed) */
    background: #fff;
    border: 1px solid #ccc;
    padding: 3px 5px;
    border-radius: 4px;
    gap: 4px;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    z-index: 999;
    /* no top/left here - we do it from JS */
}

#toolbox button {
    background: #f44336;
    color: #fff;
    border: none;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 3px;
    font-size: 12px;
}
#toolbox button:hover {
    background: #d32f2f;
}
#toolbox input[type="color"] {
    width: 26px;
    height: 20px;
    padding: 0;
    border: none;
    cursor: pointer;
}
#toolbox select,
#toolbox input[type="number"] {
    font-size: 12px;
}
/* shapeControls and textControls are hidden by default, toggled by JS */
.shapeControls,
.textControls {
    display: none;
}

/* Code Panel */
#codePanel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 400px;
    height: 100px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    padding: 8px;
    z-index: 1000;
    display: none;
    flex-direction: column;
}
#svgCodeArea {
    flex: 1;
    width: 100%;
    background: #f8f8f8;
    margin-bottom: 6px;
    font-size: 12px;
    white-space: pre;
    overflow: auto;
}
#closeCodeBtn {
    align-self: flex-end;
    background: #e91e63;
    font-size: 12px;
}
#copyCodeBtn {
    background: #009688;
    font-size: 18px;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 20px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
}

#copyCodeBtn:active {
    transform: scale(0.95); /* Slightly shrink the button */
    background: #00796b; /* Darker shade for active state */
}

#copyCodeBtn:hover {
    background: #00bfa5; /* Lighter shade for hover state */
}

/* Style for the inline text editor */
#textEditor {
    box-sizing: border-box;
    border-radius: 4px;
    outline: none;
  }
  