/**
 * PicDriver HTML to Image Converter - Advanced Studio Stylesheet
 * 100% Fluid, High-Performance, All-Code & Live Interactive Engine
 */

/* Top Action Bar */
.demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.security-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: #34d399;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-full);
}

.sec-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
  display: inline-block;
  animation: pulse-sec 2s infinite ease-in-out;
}

@keyframes pulse-sec {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* Mode Switcher Tabs */
.mode-switch-group {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 4px;
}

.mode-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.mode-tab-btn:hover {
  color: #fff;
}

.mode-tab-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Stage Viewport */
.stage-viewport-scroll {
  position: relative;
  min-height: 440px;
  max-height: 640px;
  background: repeating-conic-gradient(rgba(255,255,255,0.03) 0% 25%, transparent 0% 50%) 50% / 20px 20px, var(--bg-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 28px;
  user-select: none;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.4);
}

/* Outer Backdrop Canvas Frame */
.backdrop-frame {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: padding 0.15s ease, background 0.2s ease;
  max-width: 100%;
}

/* The Core Card Container */
.preview-card-frame {
  position: relative;
  box-sizing: border-box;
  background: var(--code-bg, #0d1117);
  color: var(--code-text, #c9d1d9);
  border: 1px solid var(--code-border, rgba(255, 255, 255, 0.1));
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-radius 0.2s ease;
  max-width: 100%;
}

/* Window Header Bar */
.window-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--code-header, #161b22);
  border-bottom: 1px solid var(--code-border, rgba(255, 255, 255, 0.08));
  font-family: var(--font-mono);
  user-select: none;
}

/* Traffic Light Dots (macOS) */
.window-dots-macos {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mac-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.mac-dot-red { background: #ff5f56; }
.mac-dot-yellow { background: #ffbd2e; }
.mac-dot-green { background: #27c93f; }

/* Windows 11 Controls */
.window-controls-win {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}

.win-btn {
  cursor: default;
  opacity: 0.7;
}

/* Window Title */
.window-title-text {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-align: center;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 12px;
}

.window-lang-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  font-family: var(--font-mono);
}

/* Code Content Area */
.code-render-stage {
  padding: 18px 20px;
  margin: 0;
  font-family: 'JetBrains Mono', 'Fira Code', var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre;
  overflow-x: auto;
  tab-size: 2;
  box-sizing: border-box;
}

.code-with-lines {
  display: table;
  width: 100%;
}

.code-line {
  display: table-row;
}

.line-number {
  display: table-cell;
  text-align: right;
  padding-right: 18px;
  user-select: none;
  color: var(--code-line-num, #5c6370);
  opacity: 0.6;
  font-size: 0.9em;
}

.line-content {
  display: table-cell;
  width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Watermark Pill */
.frame-watermark {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* HTML Component Stage */
.html-component-stage {
  padding: 20px;
  box-sizing: border-box;
  width: 100%;
}

/* Code Editor in Sidebar */
.code-editor-box {
  background: #0d1117;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 8px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #161b22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-tab-btns {
  display: flex;
  gap: 6px;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover { color: var(--text-secondary); }
.tab-btn.active {
  background: #0d1117;
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.3);
}

.code-textarea {
  width: 100%;
  height: 220px;
  background: #090d16;
  color: #7dd3fc;
  border: none;
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}

/* Backdrop Swatches */
.backdrop-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.swatch-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.swatch-dot:hover { transform: scale(1.15); }
.swatch-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
}

/* Control Sections */
.control-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.control-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.control-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.control-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.width-presets {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.width-pill {
  flex: 1;
  padding: 4px 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.width-pill:hover, .width-pill.active {
  color: #fff;
  border-color: var(--brand-primary);
  background: rgba(99, 102, 241, 0.15);
}

.stage-actions-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Language & Theme Selectors */
.select-styled {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  outline: none;
  font-weight: 500;
}
.select-styled:focus {
  border-color: var(--brand-primary);
}

/* Zoom buttons */
.zoom-btn-group {
  display: flex;
  gap: 4px;
}

.zoom-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}
.zoom-btn:hover { color: #fff; border-color: var(--brand-primary); }

/* Mobile Responsiveness */
@media (max-width: 1080px) {
  .stage-viewport-scroll {
    min-height: 360px;
    max-height: 520px;
    padding: 16px;
  }
}

@media (max-width: 768px) {
  .demo-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .mode-switch-group {
    width: 100%;
  }
  .mode-tab-btn {
    flex: 1;
    justify-content: center;
    padding: 8px 10px;
    font-size: 0.76rem;
  }
  .stage-viewport-scroll {
    min-height: 280px;
    max-height: 380px;
    padding: 10px;
  }
  .code-render-stage {
    font-size: 12px;
    padding: 12px 14px;
  }
  .control-grid-2col {
    grid-template-columns: 1fr;
  }
  .stage-actions-bar {
    flex-direction: column;
  }
  .stage-actions-bar .btn {
    width: 100%;
  }
}
