.agent-dashboard-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fit, 130px);
  gap: 10px;
  justify-content: center;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 0;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  .agent-dashboard-wrapper {
    max-width: 300px;
    margin: 0 auto;
    justify-content: center;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
}

.widget-tile {
  position: relative;
  width: 130px;
  height: 130px;
  border-radius: 15px;
  overflow: hidden;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  background: linear-gradient(to bottom, #ccc, #333);
  display: block;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.widget-tile img {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 95px;
  height: 95px;
  object-fit: contain;
  z-index: 1;
}

.preview-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 30px;
  background: linear-gradient(to top, #000, transparent);
  z-index: 2;
}

.preview-label {
  position: absolute;
  bottom: 5px;
  width: 100%;
  text-align: center;
  font-family: Arial, sans-serif;
  font-size: 13px;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 1px;
  z-index: 3;
  pointer-events: none;
}

.agent-dashboard-wrapper.remove-mode .widget-tile {
  border: 2px dashed red;
}

.agent-dashboard-wrapper.remove-mode .widget-tile.locked {
  border: none;
}

.widget-placeholder {
  width: 130px;
  height: 130px;
  border: 2px dashed #0073aa;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 15px;
}

#widget-menu {
  margin-top: 20px;
  display: flex;
  justify-content: center;
  gap: 20px;
  align-items: center;
}

#widget-menu a {
  text-decoration: none;
  font-weight: bold;
}

#add-widget-frontend-link {
  color: #0073aa;
}

#remove-widget-frontend-link {
  color: #c00;
}

/* Modal Styling for Add Widget */
.widget-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.widget-modal-window {
  background: #fff;
  padding: 20px;
  max-width: 400px;
  width: 90%;
  border-radius: 8px;
  text-align: center;
}

.widget-list {
  margin: 15px 0;
  max-height: 250px;
  overflow-y: auto;
  text-align: left;
}

.widget-option {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.widget-thumb {
  width: 50px;
  height: 50px;
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.widget-thumb img {
  max-width: 70%;
  max-height: 70%;
}

.widget-modal-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
}

/* Hide Add/Remove buttons on tablet and mobile */
@media (max-width: 1024px) {
  #add-widget-frontend-link,
  #remove-widget-frontend-link {
    display: none !important;
  }
}
