html, body {
  margin: 0;
  height: 100%;
  overflow: hidden; /* no global scrollbars */
}
.main-container {
  display: flex;
  height: 100%;
  width: 100%;
}
.center-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto; /* only page scrolls here */
}
.sidebar {
  width: 250px;
  overflow-y: auto;
}

#sizeSelector {
  padding: 10px 16px;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(100, 100, 100, 0.1);
  background-color: white;
  transition: border-color 0.3s ease;
  min-width: 180px;
}
#sizeSelector:hover, #sizeSelector:focus {
  border-color: #2563eb;
  outline: none;
}

/* Center container that fills viewport minus left space */
.center-container {
  width: 100vw;   /* full viewport width */
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rect {
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgb(0, 0, 0);
  font-weight: 600;
  user-select: none;
  transition: width 0.4s ease, height 0.4s ease;
}

#leftControls {
  position: fixed;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 180px;
  z-index: 1000;
  background: rgb(0, 0, 0);
  padding: 10px;
}

button {
  height: 40px;
  width: 40px;
  padding: 2px 2px;
  font-size: 16px;
  border-radius: 50%;
  border: none;
  background-color: black;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
}

button:hover {
  opacity: 0.2;
}

#orientationBtn {
  padding: 10px 10px;
  font-size: 30px;
  font-weight: bold;
  border-radius: 50%;
  border: none;
  background-color: transparent;
  color: white;
  cursor: pointer;
}

#textElementSelector {
  padding: 10px 16px;
  font-size: 16px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background-color: #10b981;
  color: white;
  cursor: pointer;
}

.shape-element {
  display: block;
  position: absolute;
  top: 50px;
  left: 50px;
  width: 120px;
  height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  resize: both;
  overflow: hidden;
  cursor: move;
}

#pageNumber {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-weight: bold;
}

.page {
  position: relative;
  overflow: hidden; /* avoids scrollbars while moving */
}

.page-content {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: auto;
}

/* Rulers */
.page-ruler {
  position: absolute;
  background: rgba(0,0,0,0.15);
  pointer-events: none;
  z-index: 20;
}

.page-ruler.horizontal {
  height: 1px;
  width: 100%;
}

.page-ruler.vertical {
  width: 1px;
  height: 100%;
}

/* Ruler containers */
.ruler {
  position: absolute;
  background: #f9f9f9;
  color: #444;
  font-size: 10px;
  font-family: monospace;
  overflow: hidden;
  z-index: 100;
  pointer-events: none; /* don’t block clicks */
}

.ruler.horizontal {
  height: 20px;
  border-bottom: 1px solid #ccc;
}

.ruler.vertical {
  width: 20px;
  border-right: 1px solid #ccc;
}

/* Tick marks */
.ruler .tick {
  position: absolute;
  background: #777;
}

.ruler.horizontal .tick {
  width: 1px;
  height: 6px;
  bottom: 0;
}

.ruler.vertical .tick {
  height: 1px;
  width: 6px;
  right: 0;
}

/* Margins */
.page-margins {
  position: absolute;
  border: 1px dotted rgba(0,0,0,0.4);
  top: 5%;
  left: 5%;
  right: 5%;
  bottom: 5%;
  pointer-events: none;
  z-index: 15;
}

.text-element {
  position: absolute;
  background: rgba(255,255,255,0);
  min-width: 100px;
  min-height: 30px;
  padding: 2px;
  border-radius: 4px;
  cursor: move;
  color: black;
  z-index: 5;
  transition: border 0.2s;
}

.text-element .resizer {
  width: 12px;
  height: 12px;
  background: #2563eb;
  position: absolute;
  right: 0;
  bottom: 0;
  cursor: se-resize;
  border-top-left-radius: 3px;
}

.text-element.selected {
  border: 2px solid #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.text-element:focus {
  cursor: text;  /* change cursor to text when editing */
}

/* Hamburger menu styles */
.hamburger-menu {
  position: fixed;
  top: 20px;
  width: 40px;
  height: 40px;
  background-color: var(--menu-bg);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 1010;
  box-shadow: var(--menu-shadow);
}

.hamburger-icon {
  width: 24px;
  height: 18px;
  position: relative;
  transform: rotate(0deg);
  transition: .5s ease-in-out;
}

.hamburger-icon span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: white;
  border-radius: 2px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: .25s ease-in-out;
}

.hamburger-icon span:nth-child(1) { top: 0px; }
.hamburger-icon span:nth-child(2) { top: 8px; }
.hamburger-icon span:nth-child(3) { top: 16px; }

.hamburger-icon.open span:nth-child(1) {
  top: 8px;
  transform: rotate(135deg);
}

.hamburger-icon.open span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.hamburger-icon.open span:nth-child(3) {
  top: 8px;
  transform: rotate(-135deg);
}

.sidebar {
  position: fixed;
  top: 0;
  height: 100%;
  background: var(--menu-bg);
  z-index: 1000;
  box-shadow: var(--menu-shadow);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 70px 15px 15px;
  color: var(--menu-text);
  overflow-y: auto;
}

.left-sidebar {
  left: 0;
  transform: translateX(-100%);
  width: 250px;
}

.right-sidebar {
  right: 0;
  transform: translateX(100%);
  width: 250px;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-section {
  margin-bottom: 20px;
  border-bottom: 1px solid #333;
  padding-bottom: 15px;
}

.sidebar-section h3 {
  margin-top: 0;
  font-size: 16px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.sidebar-btn {
  padding: 8px;
  font-size: 14px;
  border-radius: 4px;
  border: none;
  background-color: #333;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-btn:hover {
  background-color: var(--menu-hover);
}

.full-width {
  grid-column: span 2;
}

.color-picker-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.size-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #333;
  border: none;
  color: white;
  border-radius: 4px;
  cursor: pointer;
}

.size-btn:hover {
  background-color: var(--menu-hover);
}

.font-family-select {
  width: 100%;
  padding: 8px;
  margin-top: 10px;
  background: #333;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.saved-layouts {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 10px;
}

.layout-item {
  padding: 8px;
  margin-bottom: 5px;
  background: #333;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.layout-item button {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 16px;
}

.draggable {
      width: 150px;
      height: 100px;
      background: #4caf50;
      color: white;
      font-weight: bold;
      display: flex;
      align-items: center;
      justify-content: center;
      position: absolute; /* required for movement */
      top: 100px;
      left: 100px;
      cursor: move;
      user-select: none; /* prevents accidental text selection */
      border-radius: 8px;
    }

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: #222;
  padding: 20px;
  border-radius: 8px;
  width: 300px;
  color: white;
}

.modal-content input {
  width: 100%;
  padding: 8px;
  margin: 10px 0;
  border-radius: 4px;
  border: 1px solid #444;
  background: #333;
  color: white;
}

.modal-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

#elementToolbar {
  position: absolute;
  display: flex;
  flex-direction: row;  /* buttons in a row */
  gap: 5px;                 /* Spacing between buttons */
}

.toolbar {
  position: fixed !important;
  display: none;           /* hidden until JS shows it */
  flex-direction: row;
  gap: 8px;
  z-index: 10000 !important;
  pointer-events: auto;    /* allow clicks on toolbar buttons */
}

.toolbar-button {
  width: 30px;
  height: 30px;
  border-radius: 50%; /* makes it a circle */
  background-color: black;
  display: flex;
  justify-content: center;
  align-items: center;
  color: white; /* icon or text color */
  cursor: pointer;
}
