/* Layout container for sidebar + main content */
.container {
  display: flex;
  flex-direction: row;
  gap: 2em;
}

/* Sticky Blue Header */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: #0074D9;
  color: white;
  padding: 1em 2em;
  text-align: left;
  border-radius: 0 0 8px 8px;
  margin-bottom: 2em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
  margin: 0;
  font-size: 2em;
  font-weight: bold;
  color: white;
}

/* Sidebar container */
.sidebar {
  position: sticky;
  top: 0;
  left: 0;
  height: 100vh;
  width: 240px;
  overflow-y: auto;
  background-color: #f0f4ff;
  border-right: 1px solid #d0d8ef;
  padding: 1em;
  font-family: sans-serif;
  font-size: 0.95em;
}

/* Tree structure */
.sidebar ul {
  list-style-type: none;
  margin: 0;
  padding-left: 1em;
}

.sidebar li {
  margin: 0.2em 0;
  position: relative;
}

/* Add folder marker before items with sublists */
.sidebar li:has(ul)::before {
  content: "📂 ";
  cursor: pointer;
}

/* Add file icon (for future, if files included) */
.sidebar li:not(:has(ul))::before {
  content: "📄 ";
  opacity: 0.6;
}

/* Collapsible behavior using <details>/<summary> style */
.sidebar li > ul {
  display: inline-block;
  margin-left: 1em;
  border-left: 1px dotted #ccc;
  padding-left: 0.5em;
}

/* Show children on hover (pure CSS trick) */
.sidebar li:hover > ul {
  display: block;
}

/* Optional hover and link styles */
.sidebar li:hover {
  background-color: #e3ebff;
  border-radius: 4px;
}

/* Main content area (grid, search, etc.) */
.main {
  flex: 1;
}

/* Search box */
#search {
  display: block;
  width: 100%;
  max-width: 400px;
  margin-bottom: 1.5em;
  padding: 0.5em;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Grid for gallery items */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1em;
}

/* Individual items */
.item {
  background: #fff;
  border-radius: 8px;
  text-align: center;
  padding: 0.5em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}

.item:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.item img {
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.item p {
  font-size: 0.9em;
  margin-top: 0.5em;
  word-break: break-word;
}