/* ==========================================================================
   VectorLayer AI — Dark Studio Design System
   ========================================================================== */

:root {
  --bg-app: #0c0e14;
  --bg-card: #151821;
  --bg-card-hover: #1c202d;
  --bg-input: #1f2433;
  --border-subtle: #272d3f;
  --border-active: #ff9a00;
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --brand-ai: #ff9a00;
  --brand-ai-hover: #ffad33;
  --brand-svg: #3b82f6;
  --brand-success: #10b981;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html, body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.app-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 100vw;
}

/* ==========================================================================
   Top Header
   ========================================================================== */
.top-bar {
  height: 60px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #ff9a00, #ff5500);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.logo-group h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-group h1 span {
  color: var(--brand-ai);
  font-weight: 800;
}

.subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 20px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
}

.status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-pill.active .dot {
  background-color: var(--brand-success);
  box-shadow: 0 0 8px var(--brand-success);
}

.status-pill.inactive .dot {
  background-color: #6b7280;
}

/* ==========================================================================
   Workspace 3-Column Grid
   ========================================================================== */
.workspace-grid {
  display: grid;
  grid-template-columns: 360px 1fr 320px;
  height: calc(100vh - 60px);
  overflow: hidden;
}

/* Sidebar Panels */
.sidebar-panel, .layers-panel {
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 18px 18px 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.layers-panel {
  border-right: none;
  border-left: 1px solid var(--border-subtle);
}

.card {
  background-color: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px;
}

.card h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* ==========================================================================
   Drop Zone
   ========================================================================== */
.drop-zone {
  border: 2px dashed var(--border-subtle);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: rgba(255, 255, 255, 0.01);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--brand-ai);
  background-color: rgba(255, 154, 0, 0.04);
}

.upload-icon {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drop-prompt {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}

.drop-prompt span {
  color: var(--brand-ai);
  text-decoration: underline;
}

.drop-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.thumb-preview-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.thumb-preview-container img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Mode Selection Options
   ========================================================================== */
.mode-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-option:hover {
  background: var(--bg-card-hover);
  border-color: #3b4259;
}

.mode-option input {
  margin-top: 4px;
  accent-color: var(--brand-ai);
}

.mode-option.active {
  border-color: var(--brand-ai);
  background: rgba(255, 154, 0, 0.05);
}

.mode-title {
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mode-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

/* Controls */
.control-row {
  margin-top: 12px;
}

.control-row label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.control-row input[type="range"] {
  width: 100%;
  accent-color: var(--brand-ai);
  background: var(--bg-input);
}

.toggle-group {
  display: flex;
  background: var(--bg-input);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.toggle-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-btn.active {
  background: var(--brand-ai);
  color: #000;
  font-weight: 600;
}

/* Action Buttons */
.btn-primary {
  background: linear-gradient(135deg, #ff9a00, #ff7700);
  color: #000;
  font-weight: 700;
  font-size: 0.9rem;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 154, 0, 0.25);
}

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

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
  border-radius: 4px;
  cursor: pointer;
}

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

/* ==========================================================================
   Center Panel: Canvas & Viewer
   ========================================================================== */
.center-panel {
  display: flex;
  flex-direction: column;
  background-color: #10121a;
  position: relative;
  overflow: hidden;
}

.canvas-toolbar {
  height: 48px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.canvas-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 2px 8px;
  border-radius: 12px;
  color: var(--text-muted);
}

.canvas-view-controls {
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 4px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}

/* Canvas Area */
.canvas-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 24px;
  position: relative;
}

.transparency-grid {
  background-color: #161822;
  background-image: 
    linear-gradient(45deg, #1c1f2b 25%, transparent 25%), 
    linear-gradient(-45deg, #1c1f2b 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #1c1f2b 75%), 
    linear-gradient(-45deg, transparent 75%, #1c1f2b 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.empty-state {
  text-align: center;
  max-width: 320px;
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.empty-state p {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.vector-container {
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  background: transparent;
  max-width: 90%;
  max-height: 90%;
}

.vector-container svg {
  max-width: 100%;
  max-height: calc(100vh - 200px);
  display: block;
}

/* ==========================================================================
   Bottom Export Bar
   ========================================================================== */
.export-bar {
  height: 64px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}

.export-info {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.export-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-export {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-export.ai {
  background: #ff9a00;
  color: #000;
}

.btn-export.ai:hover {
  background: #ffad33;
}

.btn-export.svg {
  background: var(--bg-input);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-export.svg:hover {
  border-color: var(--brand-svg);
}

.btn-export.jsx {
  background: var(--bg-input);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.btn-export.zip {
  background: var(--bg-input);
  border-color: var(--border-subtle);
  color: var(--brand-success);
}

.btn-export.live {
  background: #2563eb;
  color: #fff;
}

/* ==========================================================================
   Right Panel: Layers Inspector
   ========================================================================== */
.layers-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.layers-header h2 {
  font-size: 0.95rem;
  font-weight: 700;
}

.layers-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.layers-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.layers-empty {
  text-align: center;
  padding: 40px 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  transition: all 0.15s ease;
}

.layer-item:hover {
  border-color: #3b4259;
}

.layer-item.hidden-layer {
  opacity: 0.45;
}

.layer-eye {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.05rem;
  cursor: pointer;
  width: 24px;
  text-align: center;
}

.layer-eye:hover {
  color: var(--text-primary);
}

.layer-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  object-fit: cover;
  background: #111;
}

.layer-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

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

.layer-name {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.layer-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.hidden {
  display: none !important;
}
