/* Multi-level Menu Scenario Styles */

/* Hover-driven Menu (baseline) */
.menu { font-size: 0.95rem; }

.menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu-list--root {
  display: flex;
  gap: 0.25rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.25rem;
}

.menu-item { position: relative; }

.menu-button {
  font: inherit;
  font-size: 0.92rem;
  padding: 0.5rem 0.9rem;
  background: transparent;
  color: #1f2937;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  width: 100%;
}

.menu-button:hover,
.menu-item:hover > .menu-button { background: #e0e7ff; color: #3730a3; }

.menu-list--level2,
.menu-list--level3 {
  display: none;
  position: absolute;
  min-width: 11rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 0.25rem;
  z-index: 10;
}

.menu-list--level2 { top: 100%; left: 0; }
.menu-list--level3 { top: 0; left: 100%; margin-left: 2px; }

.menu-list--root > .menu-item:hover > .menu-list--level2,
.menu-list--level2 > .menu-item:hover > .menu-list--level3 { display: block; }

.menu-leaf { font-weight: 500; }

/* Context Menu (Right-Click) */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1.5rem;
  padding: 1.5rem;
  background: #f3f4f6;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  margin-bottom: 1.5rem;
  min-height: 250px;
}

.file-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  cursor: context-menu;
  user-select: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.file-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-color: #3b82f6;
  background: #eff6ff;
}

.file-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.file-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  text-align: center;
  word-break: break-all;
}

.custom-context-menu {
  position: absolute;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 0.35rem;
  min-width: 150px;
  z-index: 1000;
}

.context-option {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.context-option:hover {
  background: #2563eb;
  color: #ffffff;
}

.context-option.text-danger {
  color: #dc2626;
}

.context-option.text-danger:hover {
  background: #dc2626;
  color: #ffffff;
}

/* Search-Filterable Menu */
.search-menu-container {
  position: relative;
  max-width: 480px;
  margin: 1rem 0;
}

.search-input {
  width: 100%;
  font-size: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #ffffff;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
  padding: 0.35rem;
}

.dropdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.search-menu-option {
  padding: 0.625rem 0.875rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.search-menu-option:hover {
  background: #eff6ff;
}

.path-prefix {
  font-size: 0.8rem;
  color: #6b7280;
  margin-right: 0.25rem;
}

.path-leaf {
  font-size: 0.925rem;
  font-weight: 600;
  color: #111827;
}

.search-menu-option:hover .path-prefix {
  color: #2563eb;
}

.search-menu-option:hover .path-leaf {
  color: #1e40af;
}

/* Keyboard Navigable Menu */
.keyboard-menu {
  font-size: 0.95rem;
  margin: 1.5rem 0;
}

.k-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.k-menu-list--root {
  display: flex;
  gap: 0.25rem;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.35rem;
}

.k-menu-item {
  position: relative;
}

.k-menu-button {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  background: transparent;
  color: #374151;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  width: 100%;
  outline: none;
  transition: all 0.15s ease;
}

.k-menu-button:focus {
  background: #3b82f6;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

.k-menu-list--level2,
.k-menu-list--level3 {
  position: absolute;
  min-width: 12rem;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  padding: 0.35rem;
  z-index: 100;
}

.k-menu-list--level2 {
  top: 100%;
  left: 0;
  margin-top: 0.25rem;
}

.k-menu-list--level3 {
  top: 0;
  left: 100%;
  margin-left: 0.25rem;
}

.k-menu-leaf {
  font-weight: 600;
}
