/* Character Builder Styles */

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

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-size: 11px;
  margin: 0;
  padding: 0;
}

header {
  padding: 0.35rem 0.5rem;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

a {
  text-decoration: none;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#canvas-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  position: relative;
  overflow: hidden;
}

#canvas {
  border: 2px solid rgba(96, 165, 250, 0.3);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  cursor: grab;
  transition: box-shadow 0.3s;
  max-width: 90%;
  max-height: 90%;
}

#canvas:active {
  cursor: grabbing;
}

#canvas:hover {
  box-shadow: 0 20px 80px rgba(96, 165, 250, 0.3);
}

.canvas-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(96, 165, 250, 0.2);
}

.zoom-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.sidebar {
  width: 280px;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.5rem;
  overflow-y: auto;
  border-left: 1px solid rgba(96, 165, 250, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.5);
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 165, 250, 0.7);
}

.panel {
  background: rgba(51, 65, 85, 0.6);
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(96, 165, 250, 0.15);
  transition: all 0.3s;
}

.panel:hover {
  border-color: rgba(96, 165, 250, 0.3);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.1);
}

.panel h3 {
  margin: 0 0 0.35rem;
  color: #60a5fa;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
}

button {
  width: 100%;
  padding: 0.35rem 0.5rem;
  margin: 0.15rem 0;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

button:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

button:active {
  transform: translateY(0);
}

button.secondary {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  box-shadow: 0 2px 4px rgba(100, 116, 139, 0.3);
}

button.secondary:hover {
  background: linear-gradient(135deg, #475569 0%, #334155 100%);
  box-shadow: 0 4px 8px rgba(100, 116, 139, 0.4);
}

button.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
}

button.danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
}

button.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

button.success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

button.icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  min-width: unset;
}

.slider-group {
  margin: 0.35rem 0;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.2rem;
  font-size: 0.65rem;
  color: #cbd5e1;
}

.slider-label .value {
  color: #60a5fa;
  font-weight: 600;
  font-family: 'Courier New', monospace;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  background: rgba(51, 65, 85, 0.8);
  outline: none;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(96, 165, 250, 0.5);
  transition: all 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.7);
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(96, 165, 250, 0.5);
}

label.checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.2rem 0;
  cursor: pointer;
  font-size: 0.65rem;
  color: #cbd5e1;
  padding: 0.2rem;
  border-radius: 3px;
  transition: all 0.2s;
}

label.checkbox:hover {
  background: rgba(96, 165, 250, 0.1);
}

input[type="checkbox"] {
  width: 12px;
  height: 12px;
  cursor: pointer;
  accent-color: #60a5fa;
}

.tree {
  font-size: 0.65rem;
  max-height: 150px;
  overflow-y: auto;
}

.tree::-webkit-scrollbar {
  width: 6px;
}

.tree::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
  border-radius: 3px;
}

.tree::-webkit-scrollbar-thumb {
  background: rgba(96, 165, 250, 0.4);
  border-radius: 3px;
}

.tree-item {
  padding: 0.3rem;
  cursor: pointer;
  border-radius: 3px;
  margin: 0.1rem 0;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.tree-item:hover {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.3);
}

.tree-item.selected {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  font-weight: 600;
  border-color: #60a5fa;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* NEW: Sub-item styling for hands and feet */
.tree-item.sub-item {
  margin-left: 0.75rem;
  padding: 0.25rem 0.35rem;
  font-size: 0.6rem;
  background: rgba(15, 23, 42, 0.3);
  border-left: 2px solid rgba(96, 165, 250, 0.3);
}

.tree-item.sub-item:hover {
  background: rgba(96, 165, 250, 0.1);
  border-left-color: rgba(96, 165, 250, 0.5);
}

.tree-item.sub-item.selected {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 100%);
  border-left-color: #60a5fa;
}

/* NEW: Attachment controls styling */
.attachment-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.attachment-group h4 {
  margin-bottom: 0.2rem;
  color: #94a3b8;
  font-size: 0.65rem;
  font-weight: 600;
}

.attachment-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
}

.attachment-btn {
  padding: 0.3rem 0.4rem;
  background: rgba(30, 41, 59, 0.8);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 3px;
  color: #e2e8f0;
  font-size: 0.6rem;
  cursor: pointer;
  transition: all 0.2s;
}

.attachment-btn:hover {
  background: rgba(96, 165, 250, 0.15);
  border-color: rgba(96, 165, 250, 0.5);
  transform: translateY(-1px);
}

.attachment-btn:active {
  transform: translateY(0);
}

/* NEW: Section headers in editors */
.panel h4 {
  margin: 0.35rem 0 0.2rem 0;
  color: #60a5fa;
  font-size: 0.65rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  padding-bottom: 0.1rem;
}

.arrow-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.arrow-btn {
  height: 30px;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: #60a5fa;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.arrow-btn:hover {
  background: rgba(59, 130, 246, 0.4);
  border-color: #60a5fa;
  transform: scale(1.05);
}

.arrow-btn:active {
  transform: scale(0.95);
}

.arrow-btn.center {
  background: rgba(167, 139, 250, 0.2);
  border-color: rgba(167, 139, 250, 0.3);
  color: #a78bfa;
  font-size: 0.85rem;
}

input[type="text"],
input[type="file"],
select {
  width: 100%;
  padding: 0.35rem;
  margin: 0.2rem 0;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 3px;
  color: #e2e8f0;
  font-size: 0.65rem;
  transition: all 0.2s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.preset-btn {
  padding: 0.3rem;
  font-size: 0.6rem;
}

.info-box {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 4px;
  padding: 0.35rem;
  font-size: 12pxrem;
  line-height: 1;
  color: #cbd5e1;
}

.info-box strong {
  color: #60a5fa;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.3rem;
  background: rgba(96, 165, 250, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.4);
  border-radius: 6px;
  font-size: 0.55rem;
  font-weight: 600;
  color: #60a5fa;
  margin: 0.1rem;
}

.badge.new {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.4);
  color: #10b981;
}

.badge.fixed {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
  color: #3b82f6;
}

.grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 49px, rgba(96, 165, 250, 0.05) 50px),
    repeating-linear-gradient(90deg, transparent, transparent 49px, rgba(96, 165, 250, 0.05) 50px);
  pointer-events: none;
  opacity: 0.5;
}

.tabs {
  display: flex;
  gap: 0.2rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  padding-bottom: 0.2rem;
}

.tab {
  padding: 0.3rem 0.5rem;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 0.65rem;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
  transition: all 0.2s;
}

.tab:hover {
  color: #cbd5e1;
  background: rgba(96, 165, 250, 0.1);
}

.tab.active {
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.15);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

#status {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1.5rem;
  border-radius: 24px;
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: #60a5fa;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  z-index: 1000;
}

#status.show {
  opacity: 1;
}