* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: #121212; color: #E0E0E0; font-family: 'Poppins', sans-serif; overflow: hidden; }
.creator-container { display: flex; height: 100vh; }
.sidebar { width: 320px; background-color: #1E1E1E; padding: 24px; border-right: 1px solid #333; display: flex; flex-direction: column; flex-shrink: 0; }
.logo { margin-bottom: 24px; }
.logo img { max-width: 180px; margin-bottom: 8px; }
.logo span { font-size: 16px; font-weight: 600; color: #FFA500; display: block; }

.steps-navigation { margin-bottom: 16px; }
.steps-navigation ul { list-style: none; }
.step { display: flex; align-items: center; padding: 8px; border-radius: 8px; margin-bottom: 4px; opacity: 0.6; transition: all 0.3s ease; cursor: not-allowed; }
.step.active { background-color: #2a2d3a; opacity: 1; }
.step.completed { opacity: 1; cursor: pointer; }
.step.completed .step-number { border-color: #28a745; background-color: #28a745; color: white; }
.step-number { width: 28px; height: 28px; font-size: 12px; border-radius: 50%; border: 2px solid #555; display: flex; justify-content: center; align-items: center; font-weight: 700; margin-right: 12px; transition: all 0.3s ease; flex-shrink: 0; }
.step.active .step-number { border-color: #FFA500; color: #FFA500; }
.step-label h4 { font-size: 14px; font-weight: 600; line-height: 1.2; }
.step-label p { display: none; }

.workspace { flex-grow: 1; padding: 24px 40px; display: flex; flex-direction: column; min-width: 0; position: relative; }
.workspace-header { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: flex-start; flex-shrink: 0; }
.header-actions { display: flex; gap: 12px; }
.workspace-content { flex-grow: 1; overflow: auto; background-color: #000; border-radius: 8px; display: flex; justify-content: center; align-items: center; padding: 20px; }
#canvas-container { line-height: 0; box-shadow: 0 8px 24px rgba(0,0,0,0.5); }
#canvas-container .konvajs-content { cursor: grab; }

.upload-box { width: 100%; max-width: 600px; padding: 48px; border: 2px dashed #444; border-radius: 12px; text-align: center; background-color: #1E1E1E; }
.btn-primary, .btn-secondary { display: none; }
.btn-primary.visible, .btn-secondary.visible { display: inline-block; }
.btn-primary { background-color: #FFA500; color: #121212; border: none; padding: 12px 24px; font-size: 16px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: background-color 0.2s ease; }
.btn-primary:hover { background-color: #E59400; }
.btn-secondary { background-color: transparent; color: #FFA500; border: 1px solid #FFA500; padding: 10px 20px; font-size: 14px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: background-color 0.2s ease, color 0.2s ease; }
.btn-secondary:hover { background-color: #FFA500; color: #121212; }

.image-preview { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.canvas-controls { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); background-color: rgba(30, 30, 30, 0.8); padding: 8px; border-radius: 8px; display: none; align-items: center; gap: 10px; backdrop-filter: blur(5px); border: 1px solid #444; }
.canvas-controls.visible { display: flex; }
.canvas-controls button { background-color: #444; color: white; border: none; width: 32px; height: 32px; border-radius: 4px; font-size: 16px; font-weight: bold; cursor: pointer; }
.canvas-controls span { color: white; font-size: 14px; min-width: 50px; text-align: center; }
#fit-screen-btn { width: auto; padding: 0 12px; }

/* --- Panel de Capas y Controles V2 --- */
#layers-panel { border-top: 1px solid #333; padding-top: 16px; margin-top: 16px; display: none; flex-direction: column; flex-grow: 1; min-height: 0; }
#layers-panel.visible { display: flex; }
.panel-subtitle { font-size: 12px; font-weight: 500; color: #888; text-transform: uppercase; margin-bottom: 12px; padding-left: 4px; }
.add-buttons-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 16px; flex-shrink: 0; }
.btn-add { padding: 8px; background-color: #2a2d3a; border: 1px solid #444; color: #E0E0E0; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 500; text-align: center; transition: all 0.2s ease; }
.btn-add:hover { border-color: #FFA500; color: #FFA500; }
#layers-accordion-container { overflow-y: auto; flex-grow: 1; padding-right: 5px; }
.layer-item { background-color: #252525; border-radius: 6px; margin-bottom: 8px; border: 1px solid #383838; }
.layer-item.locked .layer-header { color: #888; }
.layer-header { display: flex; align-items: center; padding: 8px 10px; user-select: none; transition: background-color 0.2s ease; }
.drag-handle { cursor: grab; margin-right: 8px; color: #666; }
.drag-handle:active { cursor: grabbing; }
.layer-header .layer-icon { margin-right: 8px; flex-shrink: 0; line-height: 0; }
.layer-name { flex-grow: 1; font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.layer-actions { display: flex; align-items: center; margin-left: 8px; }
.layer-actions button { background: none; border: none; color: #aaa; cursor: pointer; padding: 4px; line-height: 0; }
.layer-actions button:hover { color: #fff; }
.layer-actions .expand-btn { transition: transform 0.2s ease; transform: rotate(180deg); }
.layer-item.expanded .expand-btn { transform: rotate(0deg); }
.layer-item.selected { border-color: #FFA500; }
.layer-item.selected .layer-header { background-color: #444; }
.layer-item.selected .layer-header .layer-actions button, .layer-item.selected .layer-header .drag-handle { color: #ddd; }
.layer-item.selected .layer-header .layer-actions button:hover { color: white; }
.layer-body { padding: 0 12px; max-height: 0; overflow: hidden; transition: all 0.3s ease-out; }
.layer-item.expanded .layer-body { max-height: 600px; padding-top: 12px; padding-bottom: 12px; border-top: 1px solid #383838; }
.control-group { margin-bottom: 12px; }
.control-group label { display: block; font-size: 11px; color: #aaa; margin-bottom: 4px; font-weight: 500; }
.control-group input, .control-group select, .control-group textarea { width: 100%; padding: 6px 8px; background-color: #333; border: 1px solid #555; border-radius: 4px; color: #E0E0E0; font-size: 12px; font-family: 'Poppins', sans-serif; }
.control-group textarea { resize: vertical; }

/* --- CORRECCIÓN --- */
.control-group-inline { display: flex; gap: 8px; align-items: flex-end; }
.control-group-inline .control-group { flex-grow: 1; margin-bottom: 0; }
.control-group-inline .control-group.font-size { flex-basis: 70px; flex-grow: 0; }
.control-group-inline .control-group.font-color { flex-basis: 40px; flex-grow: 0; }
.control-group input[type="color"] { padding: 4px; height: 31px; }

.style-buttons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.style-buttons button { padding: 6px; background-color: #333; border: 1px solid #555; color: #E0E0E0; border-radius: 4px; cursor: pointer; font-size: 14px; line-height: 0; }
.style-buttons button:hover { border-color: #777; }
.style-buttons button.active { background-color: #FFA500; border-color: #FFA500; color: #121212; }
.layer-upload-box { padding: 16px; border: 2px dashed #444; border-radius: 8px; text-align: center; cursor: pointer; transition: background-color 0.2s ease; }
.layer-upload-box:hover { background-color: #333; }
.layer-upload-box p { font-size: 12px; color: #aaa; margin-top: 8px; }
.layer-image-preview { text-align: center; }
.layer-image-preview img { max-width: 100%; max-height: 100px; border-radius: 4px; background-color: #000; }
.layer-image-preview p { font-size: 11px; color: #888; margin-top: 4px; }

/* --- Estilos Paso 4: Generación y Éxito --- */
.summary-view, .success-view { text-align: center; padding: 20px; max-width: 500px; margin: 0 auto; }
.summary-view h3, .success-view h3 { font-size: 24px; }
.summary-view p, .success-view p { font-size: 14px; color: #aaa; line-height: 1.6; }
.summary-view h3 { margin-bottom: 16px; }
.summary-view p { margin-bottom: 24px; }
.summary-view #generate-button { margin-top: 8px; }

.progress-container { display: none; margin-top: 24px; }
.progress-bar { width: 100%; background-color: #333; border: 1px solid #FFA500; border-radius: 8px; padding: 4px; }
.progress-bar-fill { width: 0%; height: 16px; background-color: #FFA500; border-radius: 4px; transition: width 0.5s ease-in-out; }
.progress-text { font-size: 12px; color: #E0E0E0; margin-top: 8px; font-weight: 500; }

.success-view .icon { font-size: 24px; vertical-align: middle; margin-right: 8px;}
.success-view h3 { display: flex; align-items: center; justify-content: center; }
.success-view .action-buttons { margin-top: 32px; display: flex; gap: 16px; justify-content: center; }
.success-view .action-buttons button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.success-view .action-buttons button svg { width: 16px; height: 16px; }
.powered-by-highlight { font-size: 13px; color: #888; margin-top: 24px; font-style: italic; }