/* Reset and base */
body, html {
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  background: #f0f2f5;
  color: #333;
}

.top-bar {
  display: flex;
  background: #ffffff;
  padding: 8px;
  border-bottom: 1px solid #ddd;
  overflow-x: auto;
}

.tabs {
  display: flex;
  gap: 4px;
}

.tab {
  padding: 6px 12px;
  background: #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.tab.active {
  background: #4a72ff;
  color: white;
}

.tab.drag-target {
  outline: 2px dashed #4a72ff;
}

.container {
  padding: 12px;
}

.search-bar {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.search-bar input[type="text"] {
  flex: 1 1 200px;
  padding: 6px;
}

.search-bar button, .search-bar select {
  padding: 6px 10px;
}

/* -------------------------
   Tiles
-------------------------*/
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  cursor: pointer;
  font-size: 10px; /* smaller font for 96px tiles */
  height: 80px;
  width: 80px;
  text-align: center;
  overflow: hidden;
}

.tile img {
  width: 32px;  /* favicon size */
  height: 32px;
  margin-bottom: 3px;
}

.tile strong {
  display: block;
  word-break: break-word;
  font-size: 10px;
}

.tile[title] {
  position: relative;
}

.tile.selected {
  outline: 3px solid #4a72ff;
}

.add-tile {
  margin-top: 12px;
  padding: 8px 12px;
  font-size: 18px;
}

/* -------------------------
   Modal
-------------------------*/
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden { display: none; }

.modal-content {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  min-width: 280px;
  max-width: 400px;
}

.modal-content input[type="text"],
.modal-content input[type="color"] {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 6px;
}

/* Context menu */
.context-menu {
  position: absolute;
  background: white;
  border: 1px solid #ccc;
  border-radius: 4px;
  min-width: 100px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 2000;
}

.context-menu.hidden {
  display: none;
}

.context-menu div {
  padding: 6px 10px;
  cursor: pointer;
}

.context-menu div:hover {
  background: #f0f0f0;
}

