/* ═══════════════════════════════════════════════════════════════════════════
VISUDEN ADD TEXT TO IMAGE - EDITOR STYLES
Theme: Modern Purple / Violet - Figma-like Interface
═══════════════════════════════════════════════════════════════════════════ */

:root {
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-light: rgba(139, 92, 246, 0.15);
  --accent: #6366f1;

  --bg-app: #1a1a2e;
  --bg-sidebar: #16162a;
  --bg-toolbar: #1e1e3f;
  --bg-input: rgba(255,255,255,0.05);
  --bg-canvas: #0f0f1a;

  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.7);
  --text-muted: rgba(255,255,255,0.4);

  --border: rgba(255,255,255,0.08);
  --border-focus: var(--primary);
  --selection-blue: #0d99ff;

  --danger: #ef4444;
  --success: #10b981;

  --sidebar-width: 280px;
  --toolbar-height: 52px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --transition: 0.15s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  overflow: hidden;
  font-size: 13px;
}

.hidden, .hero { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   TOP TOOLBAR
   ═══════════════════════════════════════════════════════════════════════════ */

.top-toolbar {
  height: var(--toolbar-height);
  background: var(--bg-toolbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 100;
}

.toolbar-left, .toolbar-center, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
}

.logo-link span { font-size: 1rem; }

.file-name {
  padding: 0.4rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: text;
}

.file-name:hover { border-color: var(--border); }

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  padding: 0.25rem;
}

.zoom-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.zoom-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.zoom-value {
  min-width: 50px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.separator {
  width: 1px;
  height: 24px;
  background: var(--border);
  margin: 0 0.5rem;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.action-btn.secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
}

.action-btn.secondary:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }

.action-btn.secondary.disabled,
.action-btn.secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.action-btn.primary {
  background: var(--primary);
  color: white;
}

.action-btn.primary:hover { background: var(--primary-hover); }

/* ═══════════════════════════════════════════════════════════════════════════
   EDITOR LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.editor-layout {
  display: flex;
  height: calc(100vh - var(--toolbar-height));
}

/* LEFT SIDEBAR - Layers */
.left-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.add-text-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.6rem;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.add-text-btn:hover { background: var(--primary-hover); transform: scale(1.05); }

.layers-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 0.25rem;
}

.layer-item:hover { background: var(--bg-input); }

.layer-item.selected {
  background: var(--primary-light);
  border-color: var(--primary);
}

.layer-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

.layer-item.selected .layer-icon { background: var(--primary); color: white; }

.layer-info { flex: 1; overflow: hidden; }

.layer-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition);
}

.layer-item:hover .layer-actions { opacity: 1; }

.layer-action-btn {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}

.layer-action-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.layer-action-btn.danger:hover { color: var(--danger); }

/* ═══════════════════════════════════════════════════════════════════════════
   CANVAS AREA
   ═══════════════════════════════════════════════════════════════════════════ */

.canvas-area {
  flex: 1;
  background: var(--bg-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Drop Zone */
.drop-zone {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone-content {
  text-align: center;
  padding: 3rem;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  max-width: 500px;
}

.drop-zone-content:hover, .drop-zone.dragover .drop-zone-content {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-icon { color: var(--primary); margin-bottom: 1.5rem; opacity: 0.7; }
.drop-text { font-size: 1.25rem; font-weight: 600; margin-bottom: 0.5rem; }
.drop-or { color: var(--text-muted); margin-bottom: 1rem; }

.browse-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.browse-btn:hover { background: var(--primary-hover); transform: translateY(-2px); }

.file-requirements { margin-top: 1.5rem; color: var(--text-muted); font-size: 0.8rem; }

/* Canvas Container */
.canvas-container {
  width: 100%;
  height: 100%;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.canvas-wrapper {
  position: relative;
  box-shadow: var(--shadow-md);
  background: #000;
}

#main-canvas { display: block; }

.text-layers-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Text Box */
.text-box {
  position: absolute;
  pointer-events: auto;
  min-width: 50px;
  min-height: 30px;
}

.text-box.selected {
  outline: 2px solid var(--selection-blue);
  outline-offset: 2px;
}

.text-box.drawing { outline: 2px dashed var(--selection-blue); }

.text-box-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: move;
  z-index: 1;
}

.text-box-content {
  width: 100%;
  height: 100%;
  outline: none;
  background: transparent;
  border: none;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
  z-index: 2;
}

.text-box-content:focus { cursor: text; }

.text-box-bg {
  position: absolute;
  border-radius: 4px;
  pointer-events: none;
  z-index: 0;
}

/* Resize Handles */
.resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: white;
  border: 2px solid var(--selection-blue);
  border-radius: 2px;
  z-index: 10;
  display: none;
}

.text-box.selected .resize-handle { display: block; }

.resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.resize-handle.n { top: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.s { bottom: -5px; left: 50%; transform: translateX(-50%); cursor: ns-resize; }
.resize-handle.e { top: 50%; right: -5px; transform: translateY(-50%); cursor: ew-resize; }
.resize-handle.w { top: 50%; left: -5px; transform: translateY(-50%); cursor: ew-resize; }

/* ═══════════════════════════════════════════════════════════════════════════
   RIGHT SIDEBAR - Properties
   ═══════════════════════════════════════════════════════════════════════════ */

.right-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

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

.sidebar-section h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.property-group {
  margin-bottom: 1rem;
}

.property-group:last-child { margin-bottom: 0; }

.property-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.property-row {
  display: flex;
  gap: 0.75rem;
}

.property-group.half { flex: 1; }

.prop-select, .prop-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color var(--transition);
}

.prop-select:focus, .prop-input:focus { border-color: var(--primary); }

.prop-select option { background: var(--bg-sidebar); }

.input-with-unit {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-with-unit input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  width: 100%;
}

.input-with-unit span {
  padding: 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  background: rgba(255,255,255,0.03);
}

.input-with-unit.small { max-width: 100px; }
.input-with-unit.small input { padding: 0.4rem 0.5rem; }
.input-with-unit.small span { padding: 0 0.5rem; }

/* Style Buttons */
.style-buttons {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
}

.style-btn {
  flex: 1;
  padding: 0.5rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.style-btn:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.style-btn.active { background: var(--primary); color: white; }

/* Color Picker */
.color-picker-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.color-type-toggle {
  display: flex;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}

.color-type-btn {
  flex: 1;
  padding: 0.4rem 0.6rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.color-type-btn.active { background: var(--primary); color: white; }

.color-inputs { display: flex; gap: 0.5rem; }

.color-input {
  width: 40px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
}

.color-input::-webkit-color-swatch-wrapper { padding: 2px; }
.color-input::-webkit-color-swatch { border-radius: 4px; border: none; }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.checkbox-group label {
  margin-bottom: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Slider */
.prop-slider {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  background: var(--bg-input);
  border-radius: 3px;
  outline: none;
}

.prop-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.slider-with-value {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.slider-with-value .prop-slider {
  flex: 1;
}

.slider-with-value .slider-value {
  min-width: 45px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.shadow-options { margin-top: 0.75rem; }

.gradient-options { margin-top: 0.5rem; }

/* Danger Zone */
.danger-zone { border-bottom: none; }

.delete-layer-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.delete-layer-btn:hover { background: rgba(239, 68, 68, 0.2); }

/* ═══════════════════════════════════════════════════════════════════════════
   DRAWING MODE INDICATOR
   ═══════════════════════════════════════════════════════════════════════════ */

.drawing-mode-indicator {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-toolbar);
  border: 1px solid var(--primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  z-index: 1000;
  color: var(--text-primary);
}

.drawing-mode-indicator svg { color: var(--primary); }

.drawing-mode-indicator button {
  padding: 0.3rem 0.6rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
}

.drawing-mode-indicator button:hover { background: rgba(255,255,255,0.1); }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  :root { --sidebar-width: 240px; }
}

@media (max-width: 900px) {
  .left-sidebar { display: none; }
  :root { --sidebar-width: 220px; }
}

@media (max-width: 768px) {
  .right-sidebar { 
    position: fixed;
    right: 0;
    top: var(--toolbar-height);
    height: calc(100vh - var(--toolbar-height));
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 50;
  }
  .right-sidebar.open { transform: translateX(0); }
  .toolbar-center { display: none; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }