/* ============================================
   EDITOR DE ETIQUETAS REDBLACK
   Tema: Escuro com Turquesa/Ciano
   ============================================ */

:root {
  /* Cores principais */
  --primary-cyan: #00b3a4;
  --primary-dark: #008b7f;
  --accent-turquoise: #1dd3c1;
  --bg-dark: #1a1a1a;
  --bg-panel: #252525;
  --bg-input: #2f2f2f;
  --text-light: #ffffff;
  --text-gray: #b0b0b0;
  --border-color: #3a3a3a;
  --danger: #ff4757;
  --warning: #ffa502;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ============================================
   HEADER
   ============================================ */
#header {
  background: var(--bg-panel);
  padding: 15px 20px;
  border-bottom: 2px solid var(--primary-cyan);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

#header h1 {
  font-size: 22px;
  font-weight: 600;
  color: var(--primary-cyan);
  text-shadow: 0 0 10px rgba(0, 179, 164, 0.3);
}

#header-actions {
  display: flex;
  gap: 10px;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
#main-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ============================================
   SIDEBAR ESQUERDA
   ============================================ */
#sidebar-left {
  width: 280px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-section {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-section h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--primary-cyan);
  margin-bottom: 15px;
  letter-spacing: 1px;
}

/* ============================================
   CANVAS CENTRAL
   ============================================ */
#canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  overflow: auto;
  padding: 40px;
  position: relative;
}

#canvas-container {
  background: #ffffff;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  position: relative;
  transition: all 0.3s ease;
}

#paper-canvas {
  display: block;
  cursor: crosshair;
}

#canvas-info {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text-light);
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
}

/* ============================================
   SIDEBAR DIREITA - PROPRIEDADES
   ============================================ */
#sidebar-right {
  width: 300px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ============================================
   PAINEL DE LISTA DE ELEMENTOS (LAYERS)
   ============================================ */
#layers-panel {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

#layers-panel h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--primary-cyan);
  margin-bottom: 15px;
  letter-spacing: 1px;
}

#layers-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.layer-item {
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.layer-item:hover {
  background: #3a3a3a;
  border-color: var(--primary-cyan);
}

.layer-item.active {
  background: rgba(0, 179, 164, 0.2);
  border-color: var(--primary-cyan);
  box-shadow: 0 0 0 2px rgba(0, 179, 164, 0.1);
}

.layer-icon {
  font-size: 20px;
  min-width: 24px;
  text-align: center;
}

.layer-info {
  flex: 1;
  min-width: 0;
}

.layer-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-type {
  font-size: 11px;
  color: var(--text-gray);
  margin-top: 2px;
}

.layer-actions {
  display: flex;
  gap: 5px;
}

.layer-action-btn {
  background: transparent;
  border: none;
  color: var(--text-gray);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.layer-action-btn:hover {
  background: var(--bg-panel);
  color: var(--primary-cyan);
}

.layer-action-btn.delete:hover {
  color: var(--danger);
}

#properties-panel {
  padding: 20px;
}

#properties-panel h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--primary-cyan);
  margin-bottom: 15px;
  letter-spacing: 1px;
}

#no-selection {
  color: var(--text-gray);
  font-size: 13px;
  text-align: center;
  padding: 40px 20px;
}

.property-group {
  margin-bottom: 20px;
}

.property-label {
  display: block;
  font-size: 12px;
  color: var(--text-gray);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ============================================
   BOTÕES
   ============================================ */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.btn-primary {
  background: var(--primary-cyan);
  color: #000;
}

.btn-primary:hover {
  background: var(--accent-turquoise);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 179, 164, 0.4);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-light);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #3a3a3a;
  border-color: var(--primary-cyan);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #ff3838;
  transform: translateY(-2px);
}

.btn-success {
  background: #27ae60;
  color: #fff;
}

.btn-success:hover {
  background: #229954;
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
  margin-bottom: 10px;
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   INPUTS
   ============================================ */
.input-field,
.select-field,
textarea.input-field {
  width: 100%;
  padding: 10px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 13px;
  transition: all 0.2s ease;
  font-family: inherit;
  resize: vertical;
}

.input-field:focus,
.select-field:focus {
  outline: none;
  border-color: var(--primary-cyan);
  box-shadow: 0 0 0 3px rgba(0, 179, 164, 0.2);
}

.input-group {
  display: flex;
  gap: 10px;
}

.input-group .input-field {
  flex: 1;
}

.rotation-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.rotation-group input[type="range"] {
  flex: 1;
}

.rotation-group input[type="number"] {
  width: 70px;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 13px;
  text-align: center;
}

input[type="color"] {
  height: 40px;
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  background: var(--bg-input);
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--primary-cyan);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-turquoise);
  transform: scale(1.2);
}

/* ============================================
   GRID DE BOTÕES DE ELEMENTOS
   ============================================ */
.element-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.element-btn {
  padding: 20px 10px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.element-btn:hover {
  border-color: var(--primary-cyan);
  background: #3a3a3a;
  transform: translateY(-2px);
}

.element-btn-icon {
  font-size: 24px;
}

/* ============================================
   CONFIGURAÇÕES DE PAPEL
   ============================================ */
.paper-presets {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.paper-preset-btn {
  padding: 10px;
  background: var(--bg-input);
  border: 2px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.paper-preset-btn:hover {
  border-color: var(--primary-cyan);
  background: #3a3a3a;
}

.paper-preset-btn.active {
  border-color: var(--primary-cyan);
  background: rgba(0, 179, 164, 0.2);
}

/* ============================================
   SCROLLBAR CUSTOMIZADA
   ============================================ */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-input);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-cyan);
}

/* ============================================
   TOOLTIP
   ============================================ */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  background-color: rgba(0, 0, 0, 0.9);
  color: var(--text-light);
  text-align: center;
  padding: 6px 10px;
  border-radius: 6px;
  position: absolute;
  z-index: 1000;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* ============================================
   ELEMENTOS DO CANVAS
   ============================================ */
.canvas-element {
  position: absolute;
  cursor: move;
  user-select: none;
}

.canvas-element.selected {
  outline: 2px solid var(--primary-cyan);
  outline-offset: 2px;
}

/* Handles de Redimensionamento */
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--primary-cyan);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.resize-handle:hover {
  background: var(--accent-turquoise);
  transform: scale(1.3);
}

.resize-handle.nw { cursor: nw-resize; }
.resize-handle.ne { cursor: ne-resize; }
.resize-handle.sw { cursor: sw-resize; }
.resize-handle.se { cursor: se-resize; }
.resize-handle.n { cursor: n-resize; }
.resize-handle.s { cursor: s-resize; }
.resize-handle.e { cursor: e-resize; }
.resize-handle.w { cursor: w-resize; }

/* Handle de Rotação */
.rotate-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--accent-turquoise);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: grab;
  z-index: 10001;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.rotate-handle:hover {
  background: var(--primary-cyan);
  transform: scale(1.2);
}

.rotate-handle:active {
  cursor: grabbing;
}

.rotate-handle::before {
  content: '↻';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
}

.canvas-element.placeholder {
  border: 2px dashed var(--primary-cyan);
  padding: 5px 10px;
  background: rgba(0, 179, 164, 0.1);
  font-weight: bold;
  font-family: 'Courier New', monospace;
}

.canvas-element.text {
  white-space: pre-wrap;
}

.canvas-element img {
  max-width: 100%;
  display: block;
}

/* ============================================
   FORMAS GEOMÉTRICAS
   ============================================ */
.shape-rect {
  background: transparent;
  border: 2px solid #000;
}

.shape-circle {
  border-radius: 50%;
  background: transparent;
  border: 2px solid #000;
}

.shape-line {
  height: 2px;
  background: #000;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */
@media (max-width: 1200px) {
  #sidebar-left,
  #sidebar-right {
    width: 250px;
  }
}

@media (max-width: 900px) {
  #sidebar-left {
    position: absolute;
    left: -280px;
    height: 100%;
    z-index: 100;
    transition: left 0.3s ease;
  }
  
  #sidebar-left.open {
    left: 0;
  }
}

/* ============================================
   ANIMAÇÕES
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}
