/* =========================================================
   NOTION-STYLE NAVIGATION SYSTEM (FIXED PERMANENT SIDEBAR)
   Clean Notion workspace layout:
   - Permanently docked, fixed left sidebar (no topbar clutter)
   - Minimalist, refined typography & spacing
   - Clean 4-6px border radius on controls
   - Subtle hover states
   - Notion Command Palette / Quick Find (Ctrl+K / Cmd+K)
   ========================================================= */

:root {
  --notion-sidebar-width: 255px;
  --notion-bg: #090a0d;
  --notion-surface: rgba(14, 17, 24, 0.96);
  --notion-border: rgba(255, 255, 255, 0.08);
  --notion-border-strong: rgba(255, 255, 255, 0.15);
  --notion-text-primary: #f4f4f6;
  --notion-text-secondary: #9a9ca6;
  --notion-text-muted: #6b6d77;
  --notion-hover: rgba(255, 255, 255, 0.055);
  --notion-active: rgba(255, 255, 255, 0.11);
  --notion-accent: #00e676;
  --notion-accent-glow: rgba(0, 230, 118, 0.25);
  --notion-accent-blue: #00b4d8;
  --notion-radius-sm: 5px;
  --notion-radius-md: 7px;
  --notion-radius-lg: 10px;
  --notion-font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --notion-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --notion-shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Remove all legacy top navigation */
.notion-topbar-wrapper,
.nav-bar {
  display: none !important;
}

/* --- Layout Offset for Fixed Sidebar --- */
body {
  padding-left: var(--notion-sidebar-width) !important;
  padding-top: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  min-height: 100vh !important;
}

.container {
  width: 100% !important;
  max-width: 1350px !important;
  margin: 0 auto !important;
  padding: 0 1.75rem 3rem 1.75rem !important;
  box-sizing: border-box !important;
}

/* =========================================================
   NOTION FIXED PERMANENT SIDEBAR
   ========================================================= */
.notion-sidebar-overlay {
  display: none;
}

.notion-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--notion-sidebar-width);
  height: 100vh;
  background: #0c0e14;
  border-right: 1px solid var(--notion-border);
  z-index: 995;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.25);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
  user-select: none;
}

.notion-sidebar::-webkit-scrollbar {
  width: 4px;
}
.notion-sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.notion-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.notion-sidebar-header {
  padding: 1.1rem 1.15rem;
  border-bottom: 1px solid var(--notion-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.015);
}

.notion-sidebar-ws {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.notion-sidebar-ws-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.notion-sidebar-ws-info h4 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--notion-text-primary);
  line-height: 1.2;
}

.notion-sidebar-ws-info span {
  font-size: 0.7rem;
  color: var(--notion-text-muted);
}

.notion-sidebar-body {
  padding: 0.85rem 0.65rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.notion-sidebar-section-title {
  padding: 0 0.5rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--notion-text-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.notion-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notion-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 7px 10px;
  border-radius: var(--notion-radius-sm);
  color: var(--notion-text-secondary);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.notion-sidebar-link:hover {
  background: var(--notion-hover);
  color: var(--notion-text-primary);
}

.notion-sidebar-link.active {
  background: var(--notion-active);
  color: #ffffff;
  font-weight: 600;
  border-left: 2px solid var(--notion-accent);
  border-color: rgba(255, 255, 255, 0.08) rgba(255, 255, 255, 0.08) rgba(255, 255, 255, 0.08) var(--notion-accent);
}

.notion-sidebar-link .badge-right {
  margin-left: auto;
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--notion-text-muted);
}

.notion-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 7px 10px;
  border-radius: var(--notion-radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--notion-border);
  color: var(--notion-text-secondary);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  width: 100%;
}

.notion-search-trigger:hover {
  background: var(--notion-hover);
  color: var(--notion-text-primary);
  border-color: var(--notion-border-strong);
}

.notion-kbd {
  font-size: 0.68rem;
  font-family: monospace;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--notion-text-muted);
}

.notion-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 7px 12px;
  border-radius: var(--notion-radius-sm);
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.15) 0%, rgba(0, 180, 216, 0.15) 100%);
  border: 1px solid rgba(0, 230, 118, 0.35);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.notion-action-btn:hover {
  background: linear-gradient(135deg, rgba(0, 230, 118, 0.28) 0%, rgba(0, 180, 216, 0.28) 100%);
  border-color: rgba(0, 230, 118, 0.6);
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.2);
  transform: translateY(-1px);
}

.notion-action-btn:active {
  transform: translateY(0);
}

.notion-sidebar-footer {
  padding: 0.9rem 1.15rem;
  border-top: 1px solid var(--notion-border);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notion-sidebar-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  color: var(--notion-text-muted);
}

.notion-sidebar-status-row strong {
  color: var(--notion-text-secondary);
}

.notion-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00e676;
  box-shadow: 0 0 6px #00e676;
  animation: notionPulse 2s infinite ease-in-out;
}

@keyframes notionPulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(0, 230, 118, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); }
}

/* =========================================================
   NOTION COMMAND PALETTE / QUICK FIND (Ctrl+K)
   ========================================================= */
.notion-cmd-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.18s ease;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}

.notion-cmd-overlay.active {
  opacity: 1;
  visibility: visible;
}

.notion-cmd-modal {
  width: 580px;
  max-width: 90vw;
  background: #14161e;
  border: 1px solid var(--notion-border-strong);
  border-radius: var(--notion-radius-lg);
  box-shadow: var(--notion-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: notionCmdPop 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes notionCmdPop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.notion-cmd-search-bar {
  display: flex;
  align-items: center;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--notion-border);
  gap: 0.75rem;
}

.notion-cmd-search-bar svg {
  width: 18px;
  height: 18px;
  fill: var(--notion-text-muted);
}

.notion-cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--notion-text-primary);
  font-family: inherit;
}

.notion-cmd-input::placeholder {
  color: var(--notion-text-muted);
}

.notion-cmd-list {
  max-height: 380px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notion-cmd-group-title {
  padding: 6px 10px 3px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--notion-text-muted);
}

.notion-cmd-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 8px 12px;
  border-radius: var(--notion-radius-sm);
  color: var(--notion-text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s ease;
  user-select: none;
}

.notion-cmd-item:hover,
.notion-cmd-item.selected {
  background: var(--notion-hover);
  color: var(--notion-text-primary);
}

.notion-cmd-item.selected {
  background: var(--notion-active);
  color: #fff;
}

.notion-cmd-item-icon {
  font-size: 1rem;
  width: 22px;
  text-align: center;
}

.notion-cmd-item-desc {
  font-size: 0.75rem;
  color: var(--notion-text-muted);
  margin-left: 0.25rem;
}

.notion-cmd-item-shortcut {
  margin-left: auto;
  font-size: 0.7rem;
  color: var(--notion-text-muted);
  font-family: monospace;
}

.notion-cmd-footer {
  padding: 0.6rem 1.15rem;
  background: rgba(0, 0, 0, 0.25);
  border-top: 1px solid var(--notion-border);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  font-size: 0.72rem;
  color: var(--notion-text-muted);
}

.notion-cmd-footer span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* =========================================================
   PROJECTS TREE & NESTED STEPS IN SIDEBAR
   ========================================================= */
.notion-sidebar-projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem 0.4rem;
}

.notion-sidebar-projects-header span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--notion-text-muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.notion-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--notion-text-muted);
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: all 0.15s ease;
}

.notion-icon-btn:hover {
  background: var(--notion-hover);
  color: var(--notion-text-primary);
  border-color: var(--notion-border);
}

.notion-projects-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.notion-project-item {
  display: flex;
  flex-direction: column;
}

.notion-project-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 5px 8px;
  border-radius: var(--notion-radius-sm);
  color: var(--notion-text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.notion-project-row:hover {
  background: var(--notion-hover);
  color: var(--notion-text-primary);
}

.notion-project-item.active > .notion-project-row {
  color: #ffffff;
  font-weight: 600;
}

.notion-chevron {
  width: 12px;
  height: 12px;
  color: var(--notion-text-muted);
  transition: transform 0.18s ease;
  flex-shrink: 0;
}

.notion-project-item.expanded .notion-chevron {
  transform: rotate(90deg);
}

.notion-project-icon {
  font-size: 0.85rem;
  line-height: 1;
  flex-shrink: 0;
}

.notion-project-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.notion-project-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--notion-accent);
  box-shadow: 0 0 6px var(--notion-accent-glow);
  flex-shrink: 0;
}

.notion-project-delete-btn {
  opacity: 0;
  pointer-events: none;
  background: transparent;
  border: none;
  color: var(--notion-text-muted);
  border-radius: var(--notion-radius-sm);
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 2px;
  flex-shrink: 0;
  padding: 0;
  transition: all 0.15s ease;
}

.notion-project-row:hover .notion-project-delete-btn {
  opacity: 1;
  pointer-events: auto;
}

.notion-project-delete-btn:hover {
  color: #ff5252 !important;
  background: rgba(255, 82, 82, 0.15) !important;
}

.notion-project-delete-btn svg {
  display: block;
}

.notion-project-steps {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin-left: 14px;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 2px;
  margin-bottom: 4px;
}

.notion-project-item.expanded > .notion-project-steps {
  display: flex;
}

.notion-project-step-link {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--notion-text-secondary);
  text-decoration: none;
  font-size: 0.77rem;
  transition: all 0.12s ease;
}

.notion-project-step-link:hover {
  background: var(--notion-hover);
  color: var(--notion-text-primary);
}

.notion-project-step-link.active {
  background: rgba(0, 230, 118, 0.12);
  color: #00e676;
  font-weight: 600;
}

.notion-step-badge {
  font-size: 0.65rem;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--notion-text-muted);
  flex-shrink: 0;
}

.notion-project-step-link.active .notion-step-badge {
  background: rgba(0, 230, 118, 0.25);
  color: #00e676;
}

/* --- Project Creation Modal --- */
.notion-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.notion-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.notion-modal-card {
  width: 100%;
  max-width: 420px;
  background: #14171f;
  border: 1px solid var(--notion-border-strong);
  border-radius: var(--notion-radius-lg);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
  padding: 1.5rem;
  font-family: var(--notion-font);
  color: var(--notion-text-primary);
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.notion-modal-overlay.active .notion-modal-card {
  transform: scale(1);
}

.notion-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--notion-border);
}

.notion-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.notion-modal-field {
  margin-bottom: 1rem;
}

.notion-modal-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--notion-text-secondary);
  margin-bottom: 0.35rem;
}

.notion-modal-field input,
.notion-modal-field textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--notion-border-strong);
  border-radius: var(--notion-radius-sm);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.85rem;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease;
}

.notion-modal-field input:focus,
.notion-modal-field textarea:focus {
  border-color: var(--notion-accent);
  box-shadow: 0 0 0 2px var(--notion-accent-glow);
}

.notion-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.4rem;
}

.notion-modal-btn-cancel {
  background: transparent;
  border: 1px solid var(--notion-border);
  color: var(--notion-text-secondary);
  padding: 0.5rem 0.9rem;
  border-radius: var(--notion-radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-modal-btn-cancel:hover {
  background: var(--notion-hover);
  color: var(--notion-text-primary);
}

.notion-modal-btn-submit {
  background: var(--notion-accent);
  border: 1px solid var(--notion-accent);
  color: #0b0f14;
  padding: 0.5rem 1.1rem;
  border-radius: var(--notion-radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-modal-btn-submit:hover {
  background: #00ff84;
  box-shadow: 0 0 12px var(--notion-accent-glow);
}

.notion-modal-btn-danger {
  background: #e53935;
  border: 1px solid #d32f2f;
  color: #ffffff;
  padding: 0.5rem 1.1rem;
  border-radius: var(--notion-radius-sm);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.notion-modal-btn-danger:hover {
  background: #c62828;
  box-shadow: 0 0 10px rgba(229, 57, 53, 0.4);
}

.notion-modal-btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =========================================================
   RESPONSIVENESS (SMALL SCREENS)
   ========================================================= */
@media (max-width: 860px) {
  body {
    padding-left: 0 !important;
  }
  .notion-sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 1050;
  }
  .notion-sidebar.mobile-open {
    transform: translateX(0);
  }
  .notion-sidebar-overlay.mobile-active {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1040;
  }
}
