/* =========================================
   DASHBOARD - ULTRA PREMIUM STYLES
   ========================================= */

/* --- 1. AMBIENT BACKGROUND GLOWS --- */
.ambient-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  opacity: 0.6;
  pointer-events: none;
  animation: orbFloat 20s infinite alternate cubic-bezier(0.4, 0, 0.2, 1);
}

.orb-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: rgba(232, 114, 42, 0.15);
}

.orb-2 {
  bottom: -20%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: rgba(16, 185, 129, 0.08);
  animation-delay: -5s;
}

/* --- 2. LAYOUT & TYPOGRAPHY --- */
.dash-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  position: relative;
  z-index: 1;
}

.dash-column-header {
  margin-bottom: 40px;
  animation: fadeDown 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dash-column-header h2 {
  font-size: 36px;
  color: #111827;
  margin: 0;
  letter-spacing: -0.02em;
}

.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 32px;
  align-items: stretch;
}

/* --- 3. ADD BOT CARD (Shimmer Effect) --- */
.add-bot-card {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(20px);
  border: 1px dashed rgba(232, 114, 42, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 290px;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-decoration: none;
  color: #111827;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.5),
    0 10px 30px rgba(0, 0, 0, 0.02);
  animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.add-bot-card:hover {
  border-color: var(--orange);
  background: rgba(255, 255, 255, 0.8);
  transform: translateY(-6px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.8),
    0 20px 40px rgba(232, 114, 42, 0.08);
}

.add-bot-card .add-icon {
  color: var(--orange);
  margin-bottom: 16px;
  background: #fff;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.add-bot-card:hover .add-icon {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 12px 25px rgba(232, 114, 42, 0.2);
}

/* --- 4. PREMIUM GLASS BOT CARDS --- */
.bot-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.04),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  animation: fadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.bot-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.08),
    inset 0 0 0 1px rgba(255, 255, 255, 1);
  background: rgba(255, 255, 255, 0.9);
}

.bot-card.active {
  border: 1px solid var(--orange);
  box-shadow:
    0 20px 40px rgba(232, 114, 42, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 1);
}

.card-banner {
  height: 120px;
  position: relative;
  padding: 20px;
}

.card-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(0, 0, 0, 0.15) 100%
  );
  pointer-events: none;
}

.card-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid #ffffff;
  position: absolute;
  bottom: -36px;
  left: 24px;
  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.12),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: center;
  align-items: center;
  color: #ffffff;
  font-size: 26px;
  font-weight: 800;
  font-family: "Bricolage Grotesque", sans-serif;
  z-index: 5;
  background-color: #fff;
}

.card-body {
  padding: 50px 24px 24px 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-body h3 {
  margin: 0 0 16px 0;
  font-size: 22px;
  font-weight: 700;
  color: #111827;
  font-family: "Sora", sans-serif;
  letter-spacing: -0.01em;
}

/* --- 5. CARD BADGES & KEYS --- */
.card-middle-row {
  margin-bottom: 20px;
}

.tag-success {
  background: #ecfdf5;
  color: #059669;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid #a7f3d0;
  display: inline-block;
}

.pill-status {
  background: #f3f4f6;
  color: #4b5563;
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid #e5e7eb;
  display: inline-block;
}

.pill-status.active {
  background: #fffbeb;
  color: #d97706;
  border-color: #fde68a;
}

.card-key-row {
  background: rgba(255, 255, 255, 0.5);
  border: 1px dashed rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  transition: 0.2s;
}

.card-key-row:hover {
  border-color: var(--orange);
  background: #fff;
  box-shadow: 0 4px 12px rgba(232, 114, 42, 0.05);
}

.key-val {
  font-family: "Fira Code", monospace;
  font-size: 12px;
  color: #374151;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.copy-link {
  background: transparent;
  border: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
  cursor: pointer;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 6px;
  transition: 0.2s;
}

.copy-link:hover {
  background: rgba(232, 114, 42, 0.1);
}

.card-menu-wrapper {
  position: absolute;
  top: 50%; /* Pushes the top edge to the exact middle */
  transform: translateY(
    -50%
  ); /* Pulls it back up by half its own height to perfectly center it */
  right: 16px; /* Slightly adjusted right margin for perfect balance */
  z-index: 10;
}
.dots-btn {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.dots-btn:hover {
  background: rgba(255, 255, 255, 0.9);
  color: #111827;
  transform: scale(1.05);
}

.dropdown-window {
  position: absolute;
  top: 45px;
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  border-radius: 14px;
  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.1),
    0 0 0 1px rgba(0, 0, 0, 0.05);
  padding: 6px;
  width: 160px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 20;
}

.dropdown-window.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
  border-radius: 10px;
  transition: 0.2s;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.dropdown-action:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--orange);
}

.dropdown-action.danger:hover {
  background: #fef2f2;
  color: #dc2626;
}

.btn-action-light,
.btn-action-primary {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.btn-action-light {
  background: #f9fafb;
  border: 1px solid rgba(0, 0, 0, 0.06);
  color: #4b5563;
}

.btn-action-light:hover {
  background: #ffffff;
  border-color: var(--orange);
  color: var(--orange);
  box-shadow: 0 6px 15px rgba(232, 114, 42, 0.1);
  transform: translateY(-2px);
}

.btn-action-primary {
  background: #ffffff;
  border: 1px solid #d1d5db;
  color: #111827;
}

.btn-action-primary:hover {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

/* --- 7. FANCY DELETE MODAL --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(12px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-box {
  background: #ffffff;
  border-radius: 28px;
  padding: 40px;
  max-width: 420px;
  text-align: center;
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
  animation: popIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* --- 8. ANIMATIONS --- */
@keyframes orbFloat {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(5%, 10%) scale(1.1);
  }
  100% {
    transform: translate(-5%, -5%) scale(0.95);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes popIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Staggered loading for cards */
.bot-card:nth-child(1) {
  animation-delay: 0.05s;
}
.bot-card:nth-child(2) {
  animation-delay: 0.1s;
}
.bot-card:nth-child(3) {
  animation-delay: 0.15s;
}
.bot-card:nth-child(4) {
  animation-delay: 0.2s;
}
.bot-card:nth-child(5) {
  animation-delay: 0.25s;
}

/* =========================================
   9. BULLETPROOF MOBILE RESPONSIVENESS FIXES
   ========================================= */
@media (max-width: 768px) {
  /* Remove double padding */
  .dash-container {
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
  }

  .dash-column-header {
    padding-left: 16px;
  }

  .dash-column-header h2 {
    font-size: 28px;
  }

  /* Force Flexbox instead of Grid to prevent horizontal overflow */
  .bot-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 24px !important;
    width: 100% !important;
  }

  /* Constrain the cards to 100% of their parent */
  .bot-card,
  .add-bot-card {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  .add-bot-card {
    min-height: 200px;
  }

  .card-banner {
    height: 100px;
  }

  .card-body {
    padding: 40px 20px 20px 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .card-avatar {
    width: 60px;
    height: 60px;
    font-size: 22px;
    bottom: -30px;
    left: 20px;
  }

  /* Force long access keys to wrap */
  .key-val {
    word-break: break-all !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
  }

  /* Stack the key row neatly */
  .card-key-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .copy-link {
    align-self: stretch !important;
    width: 100% !important;
    text-align: center !important;
    padding: 10px !important;
    background: rgba(232, 114, 42, 0.1) !important;
  }

  /* Fix the delete modal */
  .modal-box {
    padding: 24px;
    margin: 0 16px;
    width: auto;
    box-sizing: border-box;
  }

  .modal-box h3 {
    font-size: 22px !important;
  }
}
