/* =========================================
   Voxliber — Design System Variables
   main.html 스타일 기준: flat, clean, editorial
   ========================================= */

:root {
  /* ── 메인 팔레트 (main.html 기준) ── */
  --accent:         #111111;   /* 주요 액션: 검정 */
  --accent-hover:   #333333;
  --accent-light:   #555555;

  --primary:        #5b4cf5;   /* 포인트 컬러 (버튼 강조 등) */
  --primary-light:  #7c6ff7;
  --primary-dark:   #4035c9;

  --accent-soft:    rgba(91, 76, 245, 0.1);   /* 액센트 틴트 배경 (badge/placeholder 등) */

  /* ── 배경 ── */
  --bg-primary:     #fafafa;   /* 페이지 배경 */
  --bg-secondary:   #ffffff;   /* 카드/섹션 */
  --bg-tertiary:    #f5f5f5;   /* 입력필드, 태그 등 */
  --bg-card:        #ffffff;
  --bg-card-hover:  #f0f0f0;   /* 카드 호버 배경 (book_detail/content_detail) */
  --bg-hover:       #f0f0f0;
  --bg-input:       #f5f5f5;
  --bg-dark:        #111111;   /* 다크 섹션 (main.html dark) */
  --bg-elevated:    #ffffff;

  /* ── 텍스트 ── */
  --text-primary:   #111111;
  --text-secondary: #444444;
  --text-tertiary:  #666666;
  --text-muted:     #888888;
  --text:           #111111;

  /* ── 테두리 ── */
  --border-color:   #e8e8e8;
  --border-hover:   #bbb;
  --border:         #e8e8e8;
  --border-active:  #111111;

  /* ── 상태 색상 ── */
  --success:        #059669;
  --success-light:  #10b981;
  --success-dark:   #047857;

  --warning:        #d97706;
  --warning-light:  #f59e0b;
  --warning-dark:   #b45309;

  --danger:         #dc2626;
  --danger-light:   #ef4444;
  --danger-dark:    #b91c1c;

  --info:           #2563eb;
  --info-light:     #3b82f6;
  --info-dark:      #1d4ed8;

  /* ── 그림자 ── */
  --shadow-color:   rgba(0, 0, 0, 0.08);
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 2px 8px rgba(0,0,0,.08);
  --shadow-lg:      0 4px 16px rgba(0,0,0,.08);
  --shadow-xl:      0 8px 32px rgba(0,0,0,.1);
  --shadow-card:    0 1px 4px rgba(0,0,0,.06);
  --shadow-hover:   0 4px 16px rgba(0,0,0,.12);
  --shadow-glow:    none;

  /* ── 글라스 (라이트 버전) ── */
  --glass-bg:       rgba(255,255,255,0.8);
  --glass-hover:    rgba(255,255,255,0.95);
  --glass:          rgba(255,255,255,0.8);
  --card-bg:        #ffffff;
  --card-hover:     #fafafa;
  --input-bg:       #f5f5f5;
  --input-hover:    #eeeeee;
  --input-focus:    rgba(91,76,245,0.08);
  --overlay-bg:     rgba(0,0,0,0.5);
  --hover-bg:       #f0f0f0;

  /* ── Radius (main.html은 거의 0) ── */
  --radius-sm:      2px;
  --radius-md:      4px;
  --radius-lg:      6px;
  --radius-xl:      8px;
  --radius-2xl:     10px;
  --radius-full:    9999px;

  /* ── 그라디언트 (라이트 톤) ── */
  --gradient-primary:   linear-gradient(135deg, #5b4cf5, #7c6ff7);
  --gradient-accent:    linear-gradient(135deg, #111, #444);
  --gradient-success:   linear-gradient(135deg, #059669, #10b981);
  --gradient-danger:    linear-gradient(135deg, #dc2626, #ef4444);
  --gradient-secondary: linear-gradient(135deg, #f5f5f5, #e8e8e8);
  --gradient-text:      linear-gradient(135deg, #5b4cf5, #111);
  --gradient-info:      linear-gradient(135deg, #2563eb, #3b82f6);
  --gradient-warning:   linear-gradient(135deg, #d97706, #f59e0b);

  /* ── 기타 (마이그레이션된 변수) ── */
  --secondary:        #5b4cf5;
  --secondary-light:  #7c6ff7;
  --secondary-dark:   #4035c9;

  --accent-danger:    #dc2626;
  --accent-primary:   #5b4cf5;
  --accent-success:   #059669;
  --accent-warning:   #d97706;

  /* ── 보조 액센트 (에디터·보이스 등 크리에이터 계열 보라, 브랜드 primary와 구분) ── */
  --creator-accent:       #8b5cf6;
  --creator-accent-light: #a78bfa;
  --creator-accent-dark:  #6d28d9;

  /* AI 관련 (기존 유지, AI 페이지는 별도 처리) */
  --ai-bg:          #0f0f17;
  --ai-bg-card:     #12121a;
  --ai-bg-dark:     #0a0a0f;
  --ai-bg-input:    #1a1a25;
  --ai-border:      #2a2a3a;
  --ai-card:        #1a1a25;
  --ai-card-hover:  #22222f;
  --ai-accent:      #f472b6;
  --ai-danger:      #ef4444;
  --ai-glow:        rgba(0,212,255,0.3);
  --ai-gradient:    linear-gradient(135deg,#00d4ff 0%,#a855f7 50%,#f472b6 100%);
  --ai-gradient-subtle: linear-gradient(135deg,rgba(0,212,255,.1) 0%,rgba(168,85,247,.1) 100%);
  --ai-primary:     #00d4ff;
  --ai-secondary:   #a855f7;
  --ai-success:     #22c55e;
  --ai-text:        #e0e0e0;
  --ai-text-muted:  #8888a0;
  --ai-warning:     #f59e0b;

  /* Novel/Chat 관련 (기존 유지) */
  --novel-accent:       #5b4cf5;
  --novel-bg:           #fafafa;
  --novel-border:       #e8e8e8;
  --novel-dialogue:     #111111;
  --novel-narration:    #555555;
  --novel-paper:        #ffffff;
  --novel-paper-light:  #fafafa;
  --novel-primary:      #5b4cf5;
  --novel-primary-soft: rgba(91,76,245,0.1);
  --novel-text:         #111111;
  --novel-text-muted:   #888888;
  --novel-user:         #5b4cf5;

  --chat-ai-bubble:     #f5f5f5;
  --chat-bg:            #ffffff;
  --chat-border:        #e8e8e8;
  --chat-danger:        #dc2626;
  --chat-primary:       #5b4cf5;
  --chat-primary-hover: #7c6ff7;
  --chat-success:       #059669;
  --chat-surface:       #fafafa;
  --chat-surface-hover: #f0f0f0;
  --chat-text:          #111111;
  --chat-text-muted:    #888888;
  --chat-user-bubble:   #111111;
  --chat-warning:       #d97706;

  --intro-accent:     #5b4cf5;
  --intro-bg:         #fafafa;
  --intro-border:     #e8e8e8;
  --intro-card:       #ffffff;
  --intro-card-hover: #f5f5f5;
  --intro-danger:     #dc2626;
  --intro-muted:      #888888;
  --intro-primary:    #5b4cf5;
  --intro-success:    #059669;
  --intro-text:       #111111;
  --intro-text-muted: #888888;

  --dark:        #111111;
  --dark-light:  #333333;

  --primary-glow: rgba(91,76,245,0.2);

  /* ── 트랜지션 ── */
  --transition-fast:   0.15s ease;
  --transition-base:   0.2s ease;
  --transition-slow:   0.35s ease;
  --transition-spring: cubic-bezier(0.4, 0, 0.2, 1);
  --transition:        0.2s ease;

  /* ── 스페이싱 ── */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  --spacing-3xl: 64px;

  /* ── Z-index ── */
  --z-dropdown:       1000;
  --z-sticky:         1020;
  --z-fixed:          1030;
  --z-modal-backdrop: 1040;
  --z-modal:          1050;
  --z-popover:        1060;
  --z-tooltip:        1070;
}

/* ── body 기본 스타일 ── */
body {
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

body::before { display: none; }  /* 애니메이션 배경 제거 */

/* ── 스크롤바 (라이트 테마) ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f5f5f5; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* ── 선택 ── */
::selection { background: #111; color: #fff; }

/* ── 글로벌 블러 오버레이 ── */
#global-blur-overlay {
  position: fixed; inset: 0; z-index: 9998; pointer-events: auto;
}
#global-blur-overlay .blur-blocker {
  width: 100%; height: 100%;
  backdrop-filter: blur(6px);
  background: rgba(0,0,0,0.3);
}

/* ── 성인 블러 ── */
.adult-blur { position: relative; filter: blur(8px); pointer-events: none; }
.adult-blur .adult-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: rgba(0,0,0,0.5); color: white; font-weight: 600; filter: none;
}
.locked { filter: blur(8px); pointer-events: none; user-select: none; }

/* ── 성인(19+) 게이트 오버레이 — common/adult_gate_overlay.html 전용 ── */
.ag-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(10, 10, 16, .82);
  backdrop-filter: blur(10px);
}
.ag-box {
  width: 100%; max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 30px;
  text-align: center;
}
.ag-icon {
  width: 52px; height: 52px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft, rgba(91,76,245,.1));
  color: var(--primary, #5b4cf5);
  font-size: .95rem; font-weight: 800; letter-spacing: -.02em;
}
.ag-title {
  font-size: 1.2rem; font-weight: 700;
  color: var(--text-primary, #111);
  margin-bottom: 8px;
}
.ag-message {
  font-size: .88rem; line-height: 1.6;
  color: var(--text-secondary, #666);
  margin-bottom: 24px;
}
.ag-btn {
  display: block; width: 100%;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: .9rem; font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.ag-btn + .ag-btn { margin-top: 9px; }
.ag-btn--primary { background: var(--primary, #5b4cf5); color: #fff; }
.ag-btn--primary:hover { background: var(--primary-dark, #4035c9); }
.ag-btn--ghost {
  background: #fff;
  color: var(--text-secondary, #666);
  border-color: var(--border-color, #e8e8e8);
}
.ag-btn--ghost:hover { color: var(--text-primary, #111); border-color: var(--border-hover, #bbb); }

.login-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px); z-index: 999;
  display: flex; align-items: center; justify-content: center;
}
.login-btn {
  display: inline-block; padding: 12px 32px;
  background: #111; color: white; text-decoration: none; margin-top: 16px;
}

/* ── 공통 유틸 ── */
.glass-effect {
  background: #fff; border: 1px solid var(--border-color);
}
.card-base {
  background: #fff; border: 1px solid var(--border-color);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.card-base:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

/* ── 반응형 스페이싱 ── */
@media (max-width: 1024px) {
  :root { --spacing-lg: 20px; --spacing-xl: 24px; --spacing-2xl: 36px; }
}
@media (max-width: 768px) {
  :root { --spacing-md: 14px; --spacing-lg: 18px; --spacing-xl: 22px; }
}
@media (max-width: 480px) {
  :root { --spacing-sm: 6px; --spacing-md: 12px; --spacing-lg: 16px; }
}

/* ── 애니메이션 키프레임 ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes gradientShift { 0%,100% { opacity: .4; } 50% { opacity: .6; } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
