* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', sans-serif; background-color: #1e1e1e; color: #ddd; height: 100vh; overflow: hidden; }

#app { display: flex; flex-direction: column; height: 100vh; }
#workspace { display: flex; flex-grow: 1; height: calc(100vh - 40px); }

/* Left Toolbar */
#left-toolbar {
  width: 50px;
  background-color: #252526;
  border-right: 1px solid #111;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  z-index: 10;
  box-shadow: 2px 0 10px rgba(0,0,0,0.5);
}
.tool-btn {
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  background: transparent;
  color: #a0a0a0;
  font-size: 18px;
  cursor: pointer;
  border-radius: 6px;
  margin-bottom: 3px;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.1s linear;
}
.tool-btn:hover { background: #333; color: #fff; }
.tool-btn.active { background: #363a40; color: #60a5fa; border: 1px solid #4b525d; box-shadow: inset 0 2px 4px rgba(0,0,0,0.2); }
.divider { width: 24px; height: 1px; background: #3c3c3c; margin: 6px 0; }

.tool-group { position: relative; width: 100%; display: flex; justify-content: center;}
.flyout-arrow {
  position: absolute;
  bottom: 2px;
  right: 2px;
  border-left: 4px solid transparent;
  border-bottom: 4px solid #888;
}
.flyout-menu {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
  background: #252526;
  border: 1px solid #111;
  box-shadow: 4px 4px 15px rgba(0,0,0,0.7);
  border-radius: 4px;
  flex-direction: column;
  min-width: 160px;
  z-index: 100;
  padding: 6px;
  margin-left: 2px;
}
.tool-group:hover .flyout-menu { display: flex; }

.flyout-btn, .flyout-btn-tx {
  background: transparent;
  border: none;
  color: #a0a0a0;
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 4px;
}
.flyout-btn i, .flyout-btn-tx i { font-size: 16px; width: 16px; text-align: center; }
.flyout-btn:hover, .flyout-btn-tx:hover { background: #333; color: #fff; }
.flyout-btn.active, .flyout-btn-tx.active { background: #0e639c; color: #fff; }

/* Right Panel */
#right-panel {
  width: 280px;
  background-color: #252526;
  border-left: 1px solid #111;
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: -2px 0 10px rgba(0,0,0,0.5);
}
.panel-header {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  background: #2d2d2d;
  border-bottom: 1px solid #111;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #dfdfdf;
}
.panel-content {
  padding: 16px;
  flex-grow: 1;
  overflow-y: auto;
}
.panel-content label {
  display: block;
  font-size: 11px;
  color: #9da0a8;
  margin-bottom: 6px;
  font-weight: 500;
}
textarea {
  width: 100%;
  background: #1e1e1e;
  border: 1px solid #3c3c3c;
  color: #fff;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 16px;
  outline: none;
}
textarea:focus {
  border-color: #60a5fa;
}
.generate-btn {
  width: 100%;
  background: #0e639c;
  color: white;
  border: 1px solid #1177bb;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
  transition: background 0.2s;
}
.generate-btn:hover {
  background: #1177bb;
}
.generate-btn:disabled {
  background: #3c3c3c;
  border-color: #333;
  color: #888;
  cursor: not-allowed;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal.active {
  display: flex;
}
.modal-content {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 8px;
  width: 90%;
  max-width: 1200px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #fff;
}
.close-btn {
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 20px;
  cursor: pointer;
}
.close-btn:hover { color: #fff; }
.comparison-container {
  display: flex;
  padding: 20px;
  gap: 20px;
  overflow: auto;
  align-items: flex-start;
  justify-content: center;
}
.img-wrapper {
  flex: 1;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.img-label {
  font-size: 12px;
  color: #aaa;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.img-wrapper img {
  max-width: 100%;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  background: #111;
}
.modal-footer {
  padding: 16px 20px;
  border-top: 1px solid #333;
  display: flex;
  justify-content: flex-end;
}

/* Main View */
#main-view {
  flex-grow: 1;
  position: relative;
  background-color: #111;
  overflow: hidden;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 20px 20px;
}
#canvas-wrapper { width: 100%; height: 100%; position: relative; }
canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

/* Floating Panel */
.floating-window {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 250px;
  background: rgba(30,30,30,0.85);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  z-index: 20;
}
.window-header {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background: rgba(0,0,0,0.3);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: #ccc;
  cursor: grab;
}
.window-content { padding: 16px; }
.window-content label { display: block; font-size: 11px; color: #9da0a8; margin-bottom: 6px; font-weight: 500;}

select {
  width: 100%;
  padding: 8px 10px;
  background: #252526;
  border: 1px solid #3c3c3c;
  color: #fff;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
}
select:focus { border-color: #60a5fa; }

.props-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.props-grid div { display: flex; align-items: center; }
.props-grid label { margin-bottom: 0; margin-right: 6px; width: 12px; color:#aaa; font-size:11px;}
.props-grid input {
  width: 100%;
  background: #252526;
  border: 1px solid #3c3c3c;
  color: #fff;
  padding: 5px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
}
.props-grid input:focus { border-color: #60a5fa; outline:none;}

input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; height: 12px; width: 12px; border-radius: 50%;
  background: #60a5fa; cursor: pointer; margin-top: -4px;
}
input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; background: #3c3c3c; border-radius: 2px; }

/* Bottom Bar */
#bottom-bar {
  height: 40px;
  background: #1e1e1e;
  border-top: 1px solid #2d2d2d;
  display: flex;
  align-items: center;
  padding: 0 15px;
  font-size: 12px;
  z-index: 30;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}

.status-group { display: flex; align-items: center; gap: 10px; }
.status-group label { color: #888; font-size: 11px; font-weight: 500;}
.status-group span { color: #fff; font-size: 11px; font-variant-numeric: tabular-nums; width: 30px;}
.divider-v { width: 1px; height: 18px; background: #333; margin: 0 5px; }

.mini-btn {
  background: #2d2d2d;
  color: #cfcfcf;
  border: 1px solid #3c3c3c;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.1s;
}
.mini-btn i { font-size: 14px; }
.mini-btn:hover { background: #3c3c3c; color: #fff; }
.mini-btn:active { transform: translateY(1px); }
.mini-btn.primary { background: #0e639c; color: white; border-color: #1177bb; }
.mini-btn.primary:hover { background: #1177bb; }
.mini-btn.danger { color: #f48771; }
.mini-btn.danger:hover { background: rgba(244,135,113,0.1); border-color: #f48771; }

/* Layer Panel */
.layer-hdr-btn {
  background: transparent; border: none; color: #888; cursor: pointer; font-size: 14px; padding: 2px 4px; border-radius: 3px;
}
.layer-hdr-btn:hover { color: #fff; background: #444; }

.layer-item {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 6px; border-radius: 4px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 2px;
  font-size: 11px; color: #ccc; transition: background 0.1s;
}
.layer-item:hover { background: rgba(255,255,255,0.05); }
.layer-item.active { background: rgba(96,165,250,0.15); border-color: rgba(96,165,250,0.4); }
.layer-item.drag-over { border-top: 2px solid #60a5fa; }

.layer-swatch {
  width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.2); flex-shrink: 0;
}
.layer-name {
  flex: 1; background: transparent; border: none; color: #ccc; font-size: 11px; font-family: inherit;
  outline: none; padding: 1px 3px; border-radius: 2px; min-width: 0;
}
.layer-name:focus { background: #333; color: #fff; }
.layer-icon-btn {
  background: transparent; border: none; color: #666; cursor: pointer; font-size: 13px; padding: 1px 2px; border-radius: 2px;
}
.layer-icon-btn:hover { color: #fff; }
.layer-icon-btn.on { color: #60a5fa; }
.layer-icon-btn.locked { color: #f59e0b; }

