/* WrytaEngine — Three-Column Layout */
/* Dark writer's console theme */

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #16162a;
  --bg-tertiary: #1e1e38;
  --bg-hover: #28284a;
  --bg-active: #32325c;
  --border-color: #2a2a4a;
  --border-light: #3a3a5a;
  --text-primary: #e8e8f0;
  --text-secondary: #a0a0c0;
  --text-muted: #6a6a8a;
  --accent-primary: #5b9bd5;
  --accent-hover: #7ab5e8;
  --accent-dim: #3a6a9a;
  --success: #4caf84;
  --warning: #d4a843;
  --danger: #d44a5a;
  --sidebar-width-left: 300px;
  --sidebar-width-right: 320px;
  --header-height: 0px;
  --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
  --font-sans: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-serif: 'Crimson Text', 'Georgia', 'Times New Roman', serif;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow: hidden;
}

/* App Shell */
#app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Left Sidebar */
#sidebar-left {
  width: var(--sidebar-width-left);
  min-width: var(--sidebar-width-left);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-header .logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent-primary);
  letter-spacing: -0.5px;
}

.sidebar-header .logo-icon {
  font-size: 1.5rem;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.sidebar-section {
  margin-bottom: 16px;
}

.sidebar-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 4px;
  font-weight: 600;
}

/* Main Panel */
#main-panel {
  flex: 1;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
}

.main-toolbar {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  background: var(--bg-secondary);
}

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Right Sidebar */
#sidebar-right {
  width: var(--sidebar-width-right);
  min-width: var(--sidebar-width-right);
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Responsive — stack on narrow screens */
@media (max-width: 1100px) {
  #sidebar-right {
    position: fixed;
    right: 0;
    top: 0;
    z-index: 100;
    transform: translateX(100%);
    transition: transform var(--transition-normal);
  }

  #sidebar-right.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  #sidebar-left {
    width: 260px;
    min-width: 260px;
  }
}

@media (max-width: 768px) {
  #sidebar-left {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    width: 280px;
    min-width: 280px;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
  }

  #sidebar-left.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  #main-panel {
    width: 100%;
  }

  .mobile-nav-toggle {
    display: flex !important;
  }
}

.mobile-nav-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: white;
  font-size: 1.4rem;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: background var(--transition-fast);
}

.mobile-nav-toggle:hover {
  background: var(--accent-hover);
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  min-width: 400px;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin-bottom: 16px;
  color: var(--text-primary);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Toast notifications */
#toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 300ms ease;
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.info    { border-left: 3px solid var(--accent-primary); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(50px); }
  to   { opacity: 1; transform: translateX(0); }
}