/* 웹 폰트 적용 (트렌디한 Pretendard) */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable.min.css");

:root {
  /* Premium Dark Mode Color Palette */
  --bg-base: #09090b; /* 아주 깊은 블랙 */
  --bg-panel: rgba(24, 24, 27, 0.65); /* 글래스모피즘 패널 배경 */
  --bg-element: rgba(39, 39, 42, 0.8);
  
  --text-main: #f8fafc;
  --text-sub: #94a3b8;
  --text-muted: #64748b;
  
  --accent-blue: #3b82f6;
  --accent-purple: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
  
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  
  --glow-primary: 0 0 20px rgba(139, 92, 246, 0.3);
  --shadow-float: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  
  --glass-blur: blur(16px);
}

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

body {
  font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  /* 단순 단색이 아닌, 은은한 배경 그라데이션 적용 */
  background: radial-gradient(circle at top left, #1a1a2e 0%, var(--bg-base) 40%, var(--bg-base) 100%);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Common Animations */
button, input, .part-item, .plan-card, a {
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------------- HEADER ---------------- */
#global-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 64px;
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 100;
}

.logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 10px rgba(139, 92, 246, 0.2);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
  font-weight: 600;
}

.credit-balance {
  color: #fff;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.1);
}

/* ---------------- MAIN WORKSPACE ---------------- */
#workspace-container {
  display: grid;
  grid-template-columns: 280px 1fr 340px;
  flex: 1;
  height: calc(100vh - 64px - 40px);
  gap: 1px;
  background-color: var(--border-subtle); /* Divider */
}

aside, section {
  background: var(--bg-panel);
  backdrop-filter: var(--glass-blur);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* --- 1. 좌측 사이드바: 파츠 패널 --- */
.parts-tabs {
  display: flex;
  background: transparent;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.parts-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 16px 0;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.parts-tabs button:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.parts-tabs button[aria-selected="true"] {
  color: var(--text-main);
}

/* 탭 하단 활성화 인디케이터 (애니메이션 효과) */
.parts-tabs button::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  transition: width 0.3s ease;
}

.parts-tabs button[aria-selected="true"]::after {
  width: 100%;
}

.parts-content {
  padding: 24px;
  flex: 1;
}

.parts-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  list-style: none;
}

.part-item {
  background: var(--bg-element);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  height: 64px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.part-item:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(63, 63, 70, 0.9);
  box-shadow: var(--shadow-float);
}

.part-item:active {
  cursor: grabbing;
  transform: scale(0.92);
}

/* --- 2. 중앙 캔버스: 에디터 패널 --- */
.editor-header {
  padding: 20px 24px;
  display: flex;
  justify-content: flex-end;
  background: transparent;
}

.btn-ai-generate {
  background: var(--accent-gradient);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: 24px; /* 더 둥글고 세련되게 */
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--glow-primary);
  position: relative;
  overflow: hidden;
}

.btn-ai-generate::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
  transform: skewX(-25deg);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { left: -100%; }
  20% { left: 200%; }
  100% { left: 200%; }
}

.btn-ai-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.6);
}

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

.canvas-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 24px 24px;
}

.main-canvas {
  flex: 1;
  background: radial-gradient(circle at center, rgba(39, 39, 42, 0.4) 0%, rgba(24, 24, 27, 0.8) 100%);
  border: 1px dashed var(--border-strong);
  border-radius: 16px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5);
}

/* 캔버스 드롭 유도 효과 */
.main-canvas.drag-over {
  border-color: var(--accent-blue);
  background: rgba(59, 130, 246, 0.05);
}

.canvas-controls {
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--text-sub);
  font-size: 0.9rem;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.2);
  padding: 12px 20px;
  border-radius: 12px;
}

input[type="range"] {
  flex: 1;
  appearance: none;
  background: var(--bg-element);
  height: 6px;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-main);
  cursor: pointer;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  transition: transform 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* --- 3. 우측 사이드바: 액션 패널 --- */
#sidebar-right {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

#sidebar-right h2 {
  font-size: 1.05rem;
  margin-bottom: 16px;
  color: var(--text-main);
  font-weight: 700;
  letter-spacing: -0.3px;
}

.typing-test-area {
  display: flex;
  flex-direction: column;
}

#font-tester {
  background: var(--bg-element);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

#font-tester::placeholder {
  color: var(--text-muted);
}

#font-tester:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.test-preview-box {
  margin-top: 12px;
  height: 120px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 16px;
  color: var(--text-sub);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.plan-cards-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.plan-card {
  background: var(--bg-element);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* 구독 카드 스페셜 강조 효과 */
.plan-card.subscription {
  border: 1px solid rgba(139, 92, 246, 0.3);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.05) 0%, rgba(0,0,0,0) 100%), var(--bg-element);
}

.plan-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-float);
}

.plan-card h3 {
  font-size: 1.1rem;
  color: var(--text-main);
  margin-bottom: 8px;
  font-weight: 700;
}

.plan-card .price {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
}

.plan-card .desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.plan-benefits {
  list-style-type: none; /* 못생긴 디스크 제거하고 커스텀 */
  padding-left: 0;
  margin-bottom: 24px;
  color: var(--text-sub);
  font-size: 0.85rem;
  line-height: 1.8;
}

.plan-benefits li {
  position: relative;
  padding-left: 20px;
}

.plan-benefits li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent-blue);
  font-weight: bold;
}

.btn-subscribe, .btn-purchase {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  padding: 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}

/* 구독 버튼 프라이머리 스타일 */
.btn-subscribe {
  background: var(--text-main);
  color: var(--bg-base);
  border: none;
}

.btn-subscribe:hover {
  background: #e2e8f0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

.btn-purchase:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-subscribe:active, .btn-purchase:active {
  transform: scale(0.97);
}

/* ---------------- FOOTER ---------------- */
#global-footer {
  height: 48px;
  background: rgba(9, 9, 11, 0.9);
  backdrop-filter: var(--glass-blur);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 100;
}

.footer-links {
  display: flex;
  gap: 32px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
}

.footer-links a:hover {
  color: var(--text-main);
}

/* Custom Scrollbar - 고급스럽고 얇게 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}
