/* florex lab kod editörü styles live kod editörü düzen sekmeler konsol preview panel */

/* toolbar */
.ce-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.ce-toolbar-left,
.ce-toolbar-center,
.ce-toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ce-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.ce-toolbar-btn:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.ce-toolbar-icon-btn {
  padding: 6px 8px;
}

.ce-toolbar-icon-btn:hover {
  color: var(--retro-yellow);
}

.ce-toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 var(--space-1);
}

/* template seçim kutusuor */
.ce-template-selector {
  position: relative;
}

.ce-template-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-dropdown);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--duration-fast) var(--ease-out);
  overflow: hidden;
}

.ce-template-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ce-template-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 10px 14px;
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-align: left;
}

.ce-template-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.ce-template-item svg {
  flex-shrink: 0;
  opacity: 0.6;
}

/* sekmeler */
.ce-tabs {
  display: flex;
  gap: 2px;
  background: var(--surface);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.ce-tab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px 14px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.ce-tab-btn:hover {
  color: var(--text-secondary);
}

.ce-tab-btn.active {
  color: var(--text-primary);
  background: var(--bg-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.ce-tab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.ce-dot-html { background: var(--retro-red); }
.ce-dot-css  { background: var(--retro-teal); }
.ce-dot-js   { background: var(--retro-yellow); }

/* editor wrapper */
.ce-editor-wrapper {
  display: grid;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
  background: var(--bg-secondary);
  min-height: 520px;
  height: calc(100vh - var(--navbar-height) - 220px);
  max-height: 800px;
}

.ce-editor-wrapper[data-layout="horizontal"] {
  grid-template-columns: 1fr 6px 1fr;
  grid-template-rows: 1fr;
}

.ce-editor-wrapper[data-layout="vertical"] {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 6px 1fr;
}

/* code panel */
.ce-code-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.ce-code-area {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.ce-line-numbers {
  width: 44px;
  flex-shrink: 0;
  padding: 14px 8px 14px 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.65;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  border-right: 1px solid var(--border);
  overflow: hidden;
  user-select: none;
}

.ce-line-numbers div {
  opacity: 0.5;
}

.ce-code-textarea {
  flex: 1;
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: none;
  outline: none;
  resize: none;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  min-height: 0;
}

.ce-code-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.ce-code-textarea::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.ce-code-textarea::-webkit-scrollbar-track {
  background: transparent;
}

.ce-code-textarea::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

/* konsol */
.ce-console {
  border-top: 1px solid var(--border);
  max-height: 160px;
  display: flex;
  flex-direction: column;
}

.ce-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.ce-console-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ce-console-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all var(--duration-fast) var(--ease-out);
}

.ce-console-clear:hover {
  color: var(--retro-red);
  background: var(--surface-hover);
}

.ce-console-output {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  background: var(--bg-tertiary);
}

.ce-console-output::-webkit-scrollbar {
  width: 4px;
}

.ce-console-output::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 2px;
}

.ce-console-empty {
  color: var(--text-muted);
  opacity: 0.5;
  font-style: italic;
}

.ce-console-line {
  display: flex;
  gap: var(--space-2);
  padding: 2px 0;
  border-bottom: 1px solid var(--border-subtle);
  word-break: break-all;
}

.ce-console-prefix {
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  opacity: 0.6;
}

.ce-console-log { color: var(--text-secondary); }
.ce-console-info { color: var(--retro-teal); }
.ce-console-warn { color: var(--retro-yellow); }
.ce-console-error { color: var(--retro-red); }

.ce-console-error .ce-console-prefix {
  color: var(--retro-red);
}

.ce-console-warn .ce-console-prefix {
  color: var(--retro-yellow);
}

/* resize handle */
.ce-resize-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border: none;
  transition: background var(--duration-fast) var(--ease-out);
  position: relative;
  z-index: 2;
}

.ce-editor-wrapper[data-layout="horizontal"] .ce-resize-handle {
  cursor: col-resize;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

.ce-editor-wrapper[data-layout="vertical"] .ce-resize-handle {
  cursor: row-resize;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.ce-resize-handle:hover {
  background: var(--surface-hover);
}

.ce-resize-dots {
  display: flex;
  gap: 3px;
}

.ce-editor-wrapper[data-layout="horizontal"] .ce-resize-dots {
  flex-direction: column;
}

.ce-resize-dots span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.4;
}

.ce-resize-handle:hover .ce-resize-dots span {
  opacity: 0.8;
  background: var(--retro-yellow);
}

/* preview panel */
.ce-preview-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.ce-preview-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px 14px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.ce-preview-dots {
  display: flex;
  gap: 6px;
}

.ce-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
}

.ce-dot-red    { background: var(--retro-red); }
.ce-dot-yellow { background: var(--retro-yellow); }
.ce-dot-green  { background: var(--retro-green); }

.ce-preview-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--weight-medium);
  flex: 1;
}

/* auto run toggle */
.ce-auto-run-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.ce-auto-run-label input {
  display: none;
}

.ce-auto-run-slider {
  width: 28px;
  height: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  position: relative;
  transition: all var(--duration-fast) var(--ease-out);
}

.ce-auto-run-slider::after {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all var(--duration-fast) var(--ease-out);
}

.ce-auto-run-label input:checked + .ce-auto-run-slider {
  background: var(--accent-green-soft);
  border-color: var(--retro-green);
}

.ce-auto-run-label input:checked + .ce-auto-run-slider::after {
  transform: translateX(12px);
  background: var(--retro-green);
}

.ce-auto-run-text {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* preview frame */
.ce-preview-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  min-height: 0;
}

/* responsive */
@media (max-width: 768px) {
  .ce-toolbar {
    padding: var(--space-2) var(--space-3);
    gap: var(--space-2);
  }

  .ce-toolbar-left,
  .ce-toolbar-right {
    flex-wrap: wrap;
  }

  .ce-toolbar-center {
    order: -1;
    width: 100%;
    justify-content: center;
  }

  .ce-editor-wrapper {
    min-height: 400px;
    height: calc(100vh - var(--navbar-height) - 180px);
  }

  .ce-editor-wrapper[data-layout="horizontal"] {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 6px 1fr;
  }

  .ce-editor-wrapper[data-layout="horizontal"] .ce-resize-handle {
    cursor: row-resize;
    border-left: none;
    border-right: none;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .ce-editor-wrapper[data-layout="horizontal"] .ce-resize-dots {
    flex-direction: row;
  }

  .ce-tabs {
    width: 100%;
    justify-content: center;
  }
}
