/* Main Layout Grid of the Report Designer */
.report-designer-container {
  display: flex;
  flex-direction: column;
  height: 80vh;
  min-height: 600px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  overflow: hidden;
}

/* Control Top bar */
.designer-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  z-index: 10;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.designer-badge {
  background-color: #4f46e5;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.template-name-input {
  max-width: 250px;
  font-weight: 600;
  border-color: #cbd5e1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.divider-vertical {
  width: 1px;
  height: 24px;
  background-color: #e2e8f0;
  margin: 0 4px;
}

/* Layout structure: Left Toolbox | Center Canvas | Right Properties */
.designer-main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* 1. Toolbox Sidebar */
.designer-toolbox {
  width: 240px;
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.toolbox-header {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 12px;
  font-weight: 700;
}

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

.toolbox-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
  font-weight: 500;
  color: #334155;
}

.toolbox-item:hover {
  background-color: #e0e7ff;
  border-color: #c7d2fe;
  color: #4338ca;
}

.toolbox-icon {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.data-fields-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.data-field-token {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  background-color: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.data-field-token:hover {
  background-color: #e2e8f0;
}

.token-key {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}

.token-value {
  font-size: 0.7rem;
  color: #6366f1;
  word-break: break-all;
}

/* 2. Workspace Working Canvas Area */
.designer-canvas-area {
  flex: 1;
  background-color: #f1f5f9;
  padding: 24px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.empty-canvas-state {
  text-align: center;
  background-color: #ffffff;
  padding: 40px;
  border-radius: 8px;
  border: 2px dashed #cbd5e1;
  margin-top: 40px;
}

.designer-canvas-wrapper {
  position: relative;
  box-sizing: border-box;
}

.page-ruler-horizontal {
  position: relative;
  height: 20px;
  background-color: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  margin-bottom: 4px;
  font-size: 0.65rem;
  color: #94a3b8;
}

.ruler-tick {
  position: absolute;
  bottom: 0;
  padding-left: 2px;
  border-left: 1px solid #cbd5e1;
  height: 10px;
}

.designer-page-sheet {
  position: relative;
  background-color: #ffffff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid #cbd5e1;
  user-select: none;
}

/* Band Layout Styles */
.canvas-band-container {
  position: relative;
  border-bottom: 1px dashed #cbd5e1;
}

.canvas-band-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  user-select: none;
}

.canvas-band-header:hover {
  background-color: #f1f5f9;
}

.band-name {
  color: #4f46e5;
}

.band-size {
  color: #94a3b8;
  font-size: 0.7rem;
}

.canvas-band-workspace {
  position: relative;
  width: 100%;
  overflow: hidden;
  background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
  background-size: 10px 10px;
  transition: border-color 0.2s ease;
}

.canvas-band-workspace.active-band {
  background-color: #fdfdfd;
  box-shadow: inset 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.band-height-resizer {
  height: 4px;
  background-color: transparent;
  cursor: ns-resize;
  transition: background-color 0.2s ease;
}

.band-height-resizer:hover {
  background-color: #818cf8;
}

/* Canvas Element Layouts */
.canvas-element {
  position: absolute;
  cursor: move;
  user-select: none;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  word-break: break-all;
  overflow: hidden;
}

.canvas-element.selected-element {
  outline: 2px solid #6366f1;
  z-index: 100;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
}

.resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: #6366f1;
  border: 1px solid #ffffff;
  right: -4px;
  bottom: -4px;
  cursor: se-resize;
  z-index: 110;
}

.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: #f1f5f9;
  color: #94a3b8;
}

.element-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

/* 3. Property Sidebar Styling */
.designer-property-panel {
  width: 280px;
  background-color: #ffffff;
  border-left: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-header {
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h5 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #1e293b;
}

.element-type-badge {
  background-color: #f1f5f9;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.panel-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: #94a3b8;
  font-size: 0.85rem;
}

.panel-scroll-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.panel-section {
  margin-bottom: 20px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 16px;
}

.panel-section h6 {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.property-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 4px;
  display: block;
}

.property-input {
  font-size: 0.85rem !important;
  border-color: #cbd5e1;
}

.property-input-color {
  padding: 0 2px !important;
  height: 31px !important;
}

.property-help {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 4px;
}

.btn-band-action {
  background: none;
  border: none;
  font-size: 0.7rem;
  padding: 0;
  margin: 0;
  cursor: pointer;
}
