<template>
  <nav :class="['sidebar', { collapsed }]">
    <div class="sidebar-header">
      <span class="logo">🛠️</span>
      <span v-if="!collapsed" class="title">Utilities</span>
      <button class="toggle-btn" @click="collapsed = !collapsed" :aria-label="collapsed ? 'Expand sidebar' : 'Collapse sidebar'">
        <span v-if="collapsed">▶</span>
        <span v-else>◀</span>
      </button>
    </div>
    <ul>
      <li>
        <router-link to="/text-to-mermaid" active-class="active-link">
          <span class="nav-icon">TM</span>
          <span v-if="!collapsed">Text to Mermaid</span>
        </router-link>
      </li>
      <li>
        <router-link to="/text-to-markdown" active-class="active-link">
          <span class="nav-icon">MD</span>
          <span v-if="!collapsed">Text to Markdown</span>
        </router-link>
      </li>
    </ul>
  </nav>
</template>

<script setup>
import { ref } from 'vue'
const collapsed = ref(false)
</script>

<style scoped>
.sidebar {
  width: 220px;
  min-width: 220px;
  min-height: 100vh;
  background: #fff;
  box-shadow: 2px 0 8px rgba(0,0,0,0.04);
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  transition: width 0.2s cubic-bezier(.4,2,.6,1), min-width 0.2s cubic-bezier(.4,2,.6,1);
  z-index: 10;
}
.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5em 1em 1em 1em;
  border-bottom: 1px solid #eee;
}
.logo {
  font-size: 1.6em;
  margin-right: 0.5em;
}
.title {
  font-weight: bold;
  font-size: 1.1em;
  letter-spacing: 1px;
}
.toggle-btn {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  outline: none;
  margin-left: 0.5em;
  color: #764ba2;
  transition: color 0.2s;
}
.toggle-btn:hover {
  color: #667eea;
}
ul {
  list-style: none;
  padding: 1.5em 0 0 0;
  margin: 0;
  flex: 1;
}
li {
  margin-bottom: 1.5em;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
.router-link-exact-active,
.active-link {
  font-weight: bold;
  color: #667eea;
  text-decoration: underline;
}
.router-link-exact-active .nav-icon,
.active-link .nav-icon {
  color: #667eea;
}
.router-link {
  display: flex;
  align-items: center;
  padding: 0.7em 1.2em;
  border-radius: 8px;
  color: #333;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.router-link:hover {
  background: #f0f4ff;
  color: #764ba2;
}
.nav-icon {
  font-size: 1.2em;
  margin-right: 1em;
  transition: margin 0.2s;
  font-family: monospace;
  font-weight: bold;
}
.sidebar.collapsed .nav-icon {
  margin-right: 0;
  display: flex;
  justify-content: center;
  width: 100%;
}
.sidebar.collapsed .title,
.sidebar.collapsed .router-link span:not(.nav-icon) {
  display: none;
}
</style> 