/* ============================================
   Writing Studio - Design System
   ============================================ */

:root {
  /* Brand Colors */
  --primary: #0052D9;
  --primary-hover: #0045B5;
  --primary-light: #E8F0FE;
  --primary-gradient: linear-gradient(135deg, #165DFF, #3B82F6);

  /* Scene Gradients */
  --gradient-drama: linear-gradient(135deg, #F53F3F, #FF7D00);
  --gradient-comic: linear-gradient(135deg, #722ED1, #B37AFF);
  --gradient-novel: linear-gradient(135deg, #165DFF, #6AA1FF);
  --gradient-romance: linear-gradient(135deg, #FF69B4, #FF9A2E);
  --gradient-palace: linear-gradient(135deg, #722ED1, #B37AFF);
  --gradient-rebirth: linear-gradient(135deg, #F53F3F, #FF7D00);
  --gradient-hero: linear-gradient(135deg, #0FC6C2, #56D1B0);
  --gradient-fantasy: linear-gradient(135deg, #667eea, #764ba2);

  /* Neutral Colors */
  --bg-page: #F5F7FA;
  --bg-card: #FFFFFF;
  --bg-sidebar: #FFFFFF;
  --bg-hover: #F2F3FF;
  --bg-input: #F7F8FA;
  --bg-mask: rgba(0,0,0,.45);

  /* Text Colors */
  --text-primary: #1D2129;
  --text-body: #4E5969;
  --text-secondary: #86909C;
  --text-placeholder: #C9CDD4;
  --text-white: #FFFFFF;
  --text-link: #165DFF;

  /* Border */
  --border: #E5E6EB;
  --border-light: #F2F3F5;

  /* Status Colors */
  --success: #00B42A;
  --warning: #FF7D00;
  --danger: #F53F3F;
  --info: #165DFF;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(29,33,41,.06);
  --shadow-md: 0 4px 16px rgba(29,33,41,.08);
  --shadow-lg: 0 8px 24px rgba(29,33,41,.1);
  --shadow-xl: 0 12px 32px rgba(29,33,41,.14);

  /* Radius */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 20px;

  /* Layout */
  --sidebar-width: 220px;
  --left-panel-width: 260px;
  --right-panel-width: 340px;
  --topbar-height: 56px;

  /* Transitions */
  --ease-out: cubic-bezier(.25,.8,.25,1);
  --transition-fast: .15s var(--ease-out);
  --transition-normal: .3s var(--ease-out);
}

/* ============================================
   Reset & Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'PingFang SC', -apple-system, BlinkMacSystemFont, 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

a { color: var(--text-link); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
h4 { font-size: 14px; font-weight: 600; }

input, textarea, select, button { font-family: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D9D9D9; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #BFBFBF; }

/* ============================================
   Sidebar Navigation
   ============================================ */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
}

.sidebar-logo svg { flex-shrink: 0; }

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.sidebar-nav {
  flex: 1;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-body);
  font-size: 14px;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}
.nav-item:hover { background: var(--bg-hover); color: var(--primary); text-decoration: none; }
.nav-item.active { background: var(--bg-hover); color: var(--primary); font-weight: 600; }

/* ============================================
   View Container
   ============================================ */
.app-container {
  margin-left: var(--sidebar-width);
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.view { display: none; height: 100%; overflow-y: auto; }
.view.active { display: block; }

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fadeIn { animation: fadeIn .3s ease; }
.animate-slideUp { animation: slideUp .4s ease; }
