/* ==========================================================================
   LAZYVIM GRUVBOX AESTHETIC
   ========================================================================== */

:root {
  /* Gruvbox Dark Palette */
  --bg-main: #282828;
  --fg-main: #ebdbb2;
  
  --blue: #83a598;
  --green: #b8bb26;
  --yellow: #fabd2f;
  --orange: #fe8019;
  --purple: #d3869b;
  --red: #fb4934;
  --cyan: #8ec07c;
  
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

body {
  background-color: var(--bg-main);
  color: var(--fg-main);
  font-family: var(--font-mono);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
}

/* Base Colors */
.fg-blue { color: var(--blue); }
.fg-green { color: var(--green); }
.fg-yellow { color: var(--yellow); }
.fg-orange { color: var(--orange); }
.fg-purple { color: var(--purple); }
.fg-red { color: var(--red); }
.fg-cyan { color: var(--cyan); }

/* ==========================================================================
   DASHBOARD LAYOUT (Home / LazyVim Splash)
   ========================================================================== */
.dashboard-body {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
}

.dashboard-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dashboard-ascii {
  color: var(--blue);
  font-weight: 700;
  text-align: center;
  margin-bottom: 3rem;
  line-height: 1.2;
}
.dashboard-ascii pre {
  font-family: var(--font-mono);
  margin: 0;
}

.dashboard-menu {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 350px;
}

.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--fg-main);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.05); /* very subtle highlight */
}

.menu-left {
  display: flex;
  align-items: center;
  gap: 15px;
}
.menu-icon {
  width: 20px;
  text-align: center;
}
.menu-text {
  color: var(--cyan);
}
.menu-key {
  color: var(--orange);
}

.dashboard-stats {
  margin-top: 3rem;
  color: var(--blue);
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 10px;
}
/* ==========================================================================
   NEO-TREE EXPLORER LAYOUT 
   ========================================================================== */
.neotree-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Tree */
.neotree-sidebar {
  width: 300px;
  min-width: 300px;
  background-color: #1d2021; /* slightly darker for sidebar */
  border-right: 1px solid #504945;
  display: flex;
  flex-direction: column;
  padding: 10px 0;
  overflow-y: auto;
}

.neotree-header {
  padding: 5px 15px;
  color: var(--yellow);
  font-weight: 700;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.tree-node {
  padding: 4px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--fg-main);
  transition: background-color 0.1s;
  text-decoration: none;
}
.tree-node:hover, .tree-node.active {
  background-color: rgba(255, 255, 255, 0.05);
}
.tree-node.active {
  color: var(--green);
}
.tree-indent {
  padding-left: 35px;
}
.tree-indent-2 {
  padding-left: 55px;
}
.tree-icon {
  width: 16px;
  text-align: center;
}

/* Right Pane Buffer */
.neotree-buffer {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  min-width: 0; /* Prevent flex children from overflowing horizontally */
}

.buffer-tabs {   
  display: flex;
  flex: 0 0 auto; /* explicitly prevent growing or shrinking, height should be autonomous */
  background-color: #1d2021;
  border-bottom: 1px solid #504945;
  padding-top: 8px; /* 8px padding above tabs */
  padding-left: 10px;
  overflow-x: auto;
  gap: 2px;
  scrollbar-width: none; 
  align-items: flex-end; /* This forces tabs to align to the bottom container border */
}
.buffer-tabs::-webkit-scrollbar {
  display: none;
}

.buffer-tab {
  height: 36px;
  padding: 0 15px;
  background-color: transparent; /* INACTIVE tab matches the #1d2021 tab bar */
  color: #a89984; 
  border-radius: 4px 4px 0 0;
  border: 1px solid transparent; /* Invisible border prevents jumping */
  border-bottom: none;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.buffer-tab:hover {
  background-color: #3c3836;
  color: var(--fg-main);
}

.buffer-tab.active {
  background-color: var(--bg-main); /* Active tab matches editor background */
  color: var(--fg-main);
  border: 1px solid #504945;
  border-bottom: 1px solid var(--bg-main);
  margin-bottom: -1px; /* push down over the container's bottom border string */
  z-index: 2; /* Ensure it covers the border */
}

.buffer-tab .tab-close {
  color: var(--red);
  font-size: 0.8em;
  cursor: pointer;
  padding: 2px;
  border-radius: 2px;
}
.buffer-tab .tab-close:hover {
  background-color: rgba(251, 73, 52, 0.2); /* subtle red hover */
}

.buffer-content {
  padding: 30px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0; /* CRITICAL: prevents long content from forcing the parent to grow past 100vh */
}

.buffer-content h1 { color: var(--blue); margin-top: 0; }
.buffer-content h2 { color: var(--green); border-bottom: 1px dashed #504945; padding-bottom: 5px;}
.buffer-content h3 { color: var(--yellow); }
.buffer-content a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
.buffer-content a.fg-green { color: var(--green); }
.buffer-content a.fg-yellow { color: var(--yellow); }
.buffer-content a.fg-purple { color: var(--purple); }
.buffer-content p, .buffer-content ul { margin-bottom: 15px; }
.buffer-content li { margin-bottom: 5px; }

/* Refactored Layout Utilities */
.content-block {
  margin-bottom: 30px;
}
.project-block {
  margin-bottom: 40px; 
  border-bottom: 1px dashed #504945; 
  padding-bottom: 20px;
}
.tags-container {
  margin-top: 15px; 
  display: flex; 
  gap: 10px; 
  flex-wrap: wrap;
}
.post-excerpt {
  font-size: 0.9em; 
  margin-top: 5px; 
  color: #a89984;
}
.post-item {
  margin-bottom: 15px;
}
.hint-text {
  font-size: 0.8em; 
  text-align: center;
}
.profile-pic {
  display: block;
  max-width: 200px;
  border: 2px dashed var(--yellow);
  padding: 5px;
  border-radius: 4px;
  margin-bottom: 20px;
}

/* Statusline styling */
.statusline {
  background-color: #3c3836;
  color: var(--fg-main);
  padding: 2px 10px;
  display: flex;
  justify-content: space-between;
  font-size: 0.85em;
}
.status-left, .status-right {
  display: flex;
  gap: 15px;
}
.status-mode {
  background-color: var(--green);
  color: #282828;
  padding: 0 10px;
  font-weight: 700;
  border-radius: 2px;
}

/* ==========================================================================
   VIM SELECTION HIGHLIGHT & HELP WIDGET
   ========================================================================== */
.vim-selected {
  background-color: rgba(255, 255, 255, 0.1) !important;
  outline: 1px solid var(--blue);
}

#lazyvim-help-widget {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background-color: #1d2021;
  border: 1px solid #504945;
  border-radius: 6px;
  padding: 10px 15px;
  width: max-content;
  min-width: 200px;
  max-width: 300px;
  max-height: 42px; /* Collapsed state */
  overflow: hidden;
  transition: max-height 0.3s ease, border-color 0.3s;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

#lazyvim-help-widget:hover, #lazyvim-help-widget.expanded {
  max-height: 300px;
  border-color: var(--blue);
}

.help-header {
  font-weight: bold;
  font-size: 1.1em;
  color: var(--fg-main);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}

.help-content {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

#lazyvim-help-widget:hover .help-content, 
#lazyvim-help-widget.expanded .help-content {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0.1s;
}

.help-content p {
  margin: 5px 0;
  font-size: 0.9em;
  color: var(--fg-main);
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (Simplified Neovim Look)
   ========================================================================== */
@media (max-width: 768px) {
  /* Scale dashboard ascii to fit mobile */
  .dashboard-ascii pre {
    font-size: 5px;
  }

  /* Hide typical desktop neo-tree UI and help widget on mobile */
  .neotree-sidebar,
  .buffer-tabs,
  .statusline,
  #lazyvim-help-widget {
    display: none !important;
  }

  /* Reset layout structure so content fills viewport */
  .neotree-layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .neotree-buffer {
    height: auto;
    flex-grow: 1;
  }

  /* Mobile Header */
  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #1d2021;
    border-bottom: 1px solid #504945;
    position: sticky;
    top: 0;
    z-index: 100;
  }

  .mobile-ascii {
    color: var(--blue);
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
    font-family: var(--font-mono);
    font-size: 4px; /* Scale using native font-size instead of transform */
    white-space: pre;
    overflow: hidden;
  }
  
  .mobile-ascii pre {
      margin: 0;
  }

  /* Hollow Burger Menu */
  .burger-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 101;
    position: relative;
  }

  .burger-line {
    width: 100%;
    height: 4px;
    border: 1px solid var(--yellow); /* Hollow look */
    border-radius: 2px;
    transition: all 0.3s ease-in-out;
  }

  /* Animated Burger State */
  .burger-btn.active .burger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .burger-btn.active .burger-line:nth-child(2) {
    opacity: 0;
  }
  .burger-btn.active .burger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Mobile Navigation Dropdown */
  .mobile-nav {
    display: none;
    flex-direction: column;
    background-color: #1d2021;
    border-bottom: 1px solid #504945;
    padding: 10px 0;
    position: absolute;
    top: 51px; /* Height of mobile header approx */
    left: 0;
    width: 100%;
    z-index: 99;
  }

  .mobile-nav.open {
    display: flex;
  }

  .mobile-nav-item {
    padding: 12px 20px;
    color: var(--fg-main);
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px dashed #3c3836;
  }

  .mobile-nav-item:last-child {
    border-bottom: none;
  }

  .mobile-nav-item.active {
    color: var(--green);
  }
}

/* Hide mobile header on desktop by default */
.mobile-header,
.mobile-nav {
  display: none;
}

@media (max-width: 768px) {
  .mobile-header {
    display: flex;
  }
}
