:root {
  --primary: #8cb365;
  --accent: #e2b740;
  --bg: #1e1d1b;
  --grey: #6b7280;
  --border: #484c53;
  --sidebar-width: 200px;
  --danger: #e5484d;
}
* {
  scrollbar-color: var(--border) transparent;
}
body {
  margin: 0;
  background: var(--bg);
  font-family: "Inter", sans-serif;
  display: flex;
  user-select: none;
  width: 100vw;
  height: 100vh;
}
.bot-header{
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.bot-header p {
  margin: 0;
}

.bot-box {
  position: fixed;
  top: 0;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  transform: none;
  width: auto;
  height: auto;
  box-sizing: border-box;
  padding: 24px 32px;
  border: none;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  color: #fff;
  overflow: hidden;
}

.bot-list {
  width: 100%;
  max-width: 1100px;
  flex: 1;
  min-height: 0;
  padding: 0;
}

#user-bot-list {
  overflow-y: auto;
}

.bots-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 16px;
  width: 100%;
  align-content: start;
  justify-content: center;
}

/* ===== Bot tile hover: name + dark glow ===== */
.bot-option {
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.bot-option:hover {
  border-color: var(--primary);
  box-shadow: 0 0 14px rgba(140, 179, 101, 0.25);
}

/* Slight dimming on the picture */
.bot-option:not(#bot-add) img {
  transition: filter 0.45s ease;
}
.bot-option:not(#bot-add):hover img {
  filter: brightness(0.85);
}

/* Dark glow layer behind the name */
.bot-option:not(#bot-add)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 6px;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.75) 0%, rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.bot-option:not(#bot-add):hover::before {
  opacity: 1;
}

/* The name, read from the tile's name="" attribute */
.bot-option:not(#bot-add)::after {
  content: attr(name);
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  box-sizing: border-box;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;

  color: #fff;
  font-weight: 600;
  font-size: 0.95em;
  letter-spacing: 0.02em;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.9), 0 0 26px rgba(0, 0, 0, 0.8);

  /* Centering is permanent, so it never changes between states */
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.bot-option:not(#bot-add):hover::after {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .bot-option,
  .bot-option:not(#bot-add) img,
  .bot-option:not(#bot-add)::before,
  .bot-option:not(#bot-add)::after {
    transition: none;
  }
}

/* ===== Bot info popup ===== */
.bot-info-popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3000;
  width: min(380px, 90vw);
  box-sizing: border-box;
  padding: 20px;
  background: var(--bg);
  color: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.bot-info-popup.active { display: flex; }

.bot-info-popup .add-bot-header { width: 100%; margin-bottom: 0; }

.bot-info-picture {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border: 2px solid var(--border);
  border-radius: 12px;
}

.bot-info-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bot-info-name-row h2 { margin: 0; font-size: 1.4em; }
.bot-info-flag { font-size: 1.4em; line-height: 1; display: none; }

.bot-info-details {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bot-info-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
}
.bot-info-row span { color: var(--grey); }

.bot-info-error {
  margin: 0;
  min-height: 1em;
  color: var(--danger);
  font-size: 0.85em;
  text-align: center;
}

.bot-info-actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.bot-info-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
  transition: background 0.15s ease;
}
.bot-info-btn.refresh { color: var(--primary); border-color: var(--primary); }
.bot-info-btn.delete  { color: var(--danger);  border-color: var(--danger); }
.bot-info-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.bot-info-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.bot-list-header{
  display: flex;
  flex-direction: row;
  align-items: center;
  color: var(--grey);
  gap: 5px;
  height: 30px;
  margin-left: 3px;
}
.bot-option{
  border: 2px solid var(--border);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  display: flex;
  position: relative;
}
.bot-option.selected::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.711);
  z-index: 1;
  border-radius: 6px;
}
.bot-option .fa-regular.fa-circle-xmark{
  display: none;
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--primary);
  font-size: 1.8em;
}
.bot-option#bot-add{
  border: 2px dashed var(--border);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.bot-option#bot-add i, .bot-option#bot-add p{
  color: var(--grey);
  margin: 0;
}
.bot-option img{
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  justify-self: flex-end;
}
.bot-refresh-button, .bot-delete-button{
  height: 32px;
  aspect-ratio: 1/1;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bot-refresh-button i, .bot-delete-button i{
  width: 20px;
  text-align: center;
  line-height: 1;
}
.bot-refresh-button{
  border: 1px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  color: var(--primary);
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.spin-animation {
  animation: spin 1s linear infinite;
}
.bot-delete-button{
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
  color: var(--grey);
}
.add-bot-popup {
  display: none;
  width: 25vw;
  z-index: 3000;
  background: var(--bg);
}
.add-bot-popup.active {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 15px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.popup-overlay{
  display: none;
}
.popup-overlay.active {
  display: block;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2999;
  backdrop-filter: blur(2px);
}
.add-bot-header{
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 20px;
  margin-bottom: 15px;
  position: relative;
  color: var(--primary);
}
.exit-popup-button{
  border: 1px solid var(--border);
  border-radius: 20%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--grey);
  position: absolute;
  right: 0;
}
.exit-popup-button:hover{
  cursor: pointer;
}
#input-button-custom-bot{
  width: 100%;
  background-color: var(--primary);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  height: 40px;
}
#input-button-custom-bot:hover{
  cursor: pointer;
}
.sources-container{
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center; 
  justify-content: center;
  width: 100%;
}
.source-option{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  width: 100%;
  position: relative;
}
.source-option .fide-warning{
  display: none;
  position: absolute;
  top: -36px;
  right: 50%;
  transform: translateX(50%);
  background-color: var(--bg);
  padding: 2px 2px;
  color: var(--primary);
  border-radius: 4px;
  border: 1px solid var(--border);
  font-size: 0.8em;
  height: 25px;
  width: 90px;
  align-items: center;
  justify-content: center;
}
.source-option.selected{
  border: 1px solid var(--primary);
  cursor: default;
  pointer-events: none;
}
#source-fide:hover .fide-warning{
  display: flex;
}
.source-option img{
  height: 35px;
}
.input-bot-pseudo{
  width: 100%;
}
.input-box-bot-pseudo{
  width: 100%;
}
.input-box-bot-pseudo input{
  all: unset;
  display: inline-block;
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  height: 45px;
  font-size: 1em;
  padding: 0 10px;
  color: var(--grey);
}