/* ==============================================================================
   나만의 이미지샷 (ImageShot Pro) - Modern Windows 11 Fluent Design CSS
   ============================================================================== */

:root {
  --bg-primary: #111214;
  --bg-surface: #1e1f22;
  --bg-surface-elevated: #2b2d31;
  --bg-input: #313338;
  --border-subtle: #383a40;
  --border-focus: #00ffcc;
  
  --text-primary: #f2f3f5;
  --text-secondary: #949ba4;
  --text-muted: #6d737f;
  
  --accent-cyan: #00ffcc;
  --accent-blue: #5865f2;
  --accent-blue-hover: #4752c4;
  --accent-green: #23a55a;
  --accent-green-hover: #1d8649;
  --accent-danger: #ed4245;
  --accent-purple: #9b59b6;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.55);
  
  --transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Segoe UI', 'Malgun Gothic', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* 1. 상단 내비게이션 바 */
.top-nav {
  height: 60px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  font-size: 26px;
  animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: #ffffff;
}

.brand-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(0, 255, 204, 0.15);
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 255, 204, 0.3);
}

.capture-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  background: var(--bg-surface-elevated);
}

.nav-link:hover {
  color: #ffffff;
  background: var(--border-subtle);
}

/* 2. 공통 버튼 컴포넌트 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  outline: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-blue);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(88, 101, 242, 0.35);
}

.btn-primary:hover {
  background: var(--accent-blue-hover);
}

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

.btn-secondary:hover {
  background: var(--border-subtle);
  color: #ffffff;
}

.btn-success {
  background: var(--accent-green);
  color: #ffffff;
}

.btn-success:hover {
  background: var(--accent-green-hover);
}

.btn-accent {
  background: linear-gradient(135deg, #0078d4, #00b4d8);
  color: #ffffff;
}

.btn-accent:hover {
  filter: brightness(1.1);
}

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

.btn-ghost:hover {
  background: var(--bg-surface-elevated);
  color: #ffffff;
}

.btn-dark {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(237, 66, 69, 0.2);
  color: var(--accent-danger);
  border: 1px solid rgba(237, 66, 69, 0.4);
}

.btn-danger:hover {
  background: var(--accent-danger);
  color: #ffffff;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-lg {
  padding: 14px 24px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-icon:hover {
  color: #ffffff;
  background: var(--bg-surface-elevated);
}

/* 3. 워크스페이스 레이아웃 */
.workspace-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* 좌측 툴바 사이드바 */
.tool-sidebar {
  width: 200px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}

.tool-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.val-badge {
  font-size: 11px;
  background: var(--bg-surface-elevated);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  background: var(--bg-surface-elevated);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 11px;
  font-weight: 600;
}

.tool-btn i {
  font-size: 15px;
}

.tool-btn:hover {
  color: #ffffff;
  background: var(--border-subtle);
}

.tool-btn.active {
  background: rgba(0, 255, 204, 0.15);
  color: var(--accent-cyan);
  border-color: rgba(0, 255, 204, 0.4);
}

/* 8원소 컬러 팔레트 */
.color-palette {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 4px 0;
}

.color-dot {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: var(--c);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.color-dot:hover {
  transform: scale(1.15);
}

.color-dot.active {
  border-color: #ffffff;
  box-shadow: 0 0 10px var(--c);
}

.range-slider {
  width: 100%;
  accent-color: var(--accent-cyan);
  cursor: pointer;
}

.history-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 4. 중앙 캔버스 뷰포트 */
.canvas-viewport {
  flex: 1;
  background: #0d0e10;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: auto;
  padding: 24px;
}

.empty-state {
  max-width: 580px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.empty-icon-wrap {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-full);
  background: rgba(0, 255, 204, 0.1);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
}

.empty-state h2 {
  font-size: 22px;
  font-weight: 700;
  color: #ffffff;
}

.empty-sub {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.empty-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.shortcut-tip-box {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: var(--bg-surface-elevated);
  font-size: 12px;
  color: var(--text-secondary);
}

.shortcut-tip-box .badge {
  background: var(--accent-cyan);
  color: #111214;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* 캔버스 래퍼 */
.canvas-wrapper {
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
  background-color: #1a1a1a;
}

#mainCanvas {
  display: block;
}

#overlayCanvas {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: auto;
  cursor: crosshair;
}

/* 플로팅 액션 바 */
.floating-action-bar {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(30, 31, 34, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  z-index: 50;
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 15px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.dim-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-cyan);
  background: rgba(0, 255, 204, 0.12);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.fab-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 5. 우측 사진 보관함 사이드바 */
.gallery-sidebar {
  width: 240px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.gallery-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gallery-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.gallery-list {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.gallery-empty {
  text-align: center;
  padding: 30px 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.gallery-item {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  background: var(--bg-surface-elevated);
  transition: var(--transition);
}

.gallery-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent-cyan);
}

.gallery-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

.gallery-item-info {
  padding: 6px 10px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-secondary);
}

.gallery-del-btn {
  opacity: 0;
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #ff5555;
  border: none;
  border-radius: 4px;
  padding: 4px 6px;
  cursor: pointer;
  transition: var(--transition);
}

.gallery-item:hover .gallery-del-btn {
  opacity: 1;
}

/* 6. 토스트 팝업 */
.toast-popup {
  position: fixed;
  top: 24px;
  right: 24px;
  background: rgba(26, 28, 30, 0.96);
  backdrop-filter: blur(8px);
  border: 1px solid var(--accent-cyan);
  box-shadow: var(--shadow-lg);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  z-index: 1000;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-popup.show {
  opacity: 1;
  transform: translateY(0);
}
