@keyframes subtleGlow {
  0% {
    box-shadow: 0 0 15px rgba(192, 192, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 25px rgba(192, 192, 255, 0.8);
  }
  100% {
    box-shadow: 0 0 15px rgba(192, 192, 255, 0.4);
  }
}

/* --- Page Layout --- */
html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: #eef1f5;
}
body {
  display: flex;
  flex-direction: column;
}

/* --- Top Branding Bar --- */
.top-branding-bar {
  height: 86px;
  width: 100%;
  background-color: #3e3c3b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
  padding: 0 20px;
  box-sizing: border-box;
}
.branding-logo {
  height: 60px;
  width: auto;
  max-width: 192px;
  object-fit: contain;
}
.settings-pill {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  font-size: 24px;
  border-radius: 25px;
  background-color: #555;
  color: #fff;
  cursor: pointer;
  border: none;
  padding: 0;
  transition: all 0.25s ease-out;
}
.settings-pill:hover {
  transform: scale(1.1);
  background-color: #666;
}

/* --- Map Container --- */
#map {
  width: 100%;
  flex-grow: 1;
  z-index: 1;
}

/* --- Sagebar (Search Container) --- */
header.search-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 65%;
  max-width: 1100px;
  height: 45px;
  background-color: #ffffff;
  border-radius: 25px;
  padding: 4px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  overflow: visible;
  transition: all 0.35s ease-out;
  position: relative;
  z-index: 100;
}

/* ... (L0, L1, L2 button, pill, etc. styles are all unchanged) ... */

.welcome-message {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  font-size: 1rem;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  border-radius: 25px;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  position: absolute;
  top: 0;
  left: 0;
  background: #fff;
  z-index: 120;
  animation: subtleGlow 2.5s infinite ease-in-out;
  overflow: hidden;
  white-space: nowrap;
}
.welcome-icon {
  font-size: 1.2rem;
}

button.geosage-pill,
.l2-interface-container,
nav.search-button-container {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.4s ease-out 0.1s, transform 0.4s ease-out 0.1s;
  pointer-events: none;
}
header.search-container.initialized .welcome-message {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  animation: none;
}
header.search-container.initialized button.geosage-pill,
header.search-container.initialized .l2-interface-container,
header.search-container.initialized nav.search-button-container {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

button.geosage-pill {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  width: 35px;
  height: 35px;
  margin: 0 5px;
  font-size: 18px;
  border-radius: 17.5px;
  background-color: #f0f0f5;
  color: #555;
  cursor: pointer;
  z-index: 110;
  border: none;
  padding: 0;
}
button.geosage-pill:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px #c0c0ff;
}

.l2-interface-container {
  flex-grow: 1;
  height: 100%;
  position: relative;
  min-width: 50px;
  overflow: hidden;
  border-radius: 25px;
}
.l2-interface {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  padding: 0 5px;
}
input[type="search"].search-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 0 15px;
  font-size: 16px;
  background: none;
  -webkit-appearance: none;
}

#l2-find {
  justify-content: space-between;
}
#l2-find input[type="search"] {
  flex-grow: 1;
}
#l2-find .l2-button-group {
  display: flex;
  flex-shrink: 0;
}

.l2-menu-buttons {
  justify-content: flex-start;
  gap: 6px;
  padding: 0 10px;
}

.l2-button {
  height: 30px;
  padding: 0 14px;
  border: none;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease-out;
  flex-shrink: 0;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  color: white;
}
.l2-button:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

#l2-find .l2-button {
  background-color: #d9534f;
}
#l2-ingest .l2-button {
  background-color: #e6b89c;
}
#l2-studio .l2-button {
  background-color: #e69aaa;
}
#l2-workflows .l2-button {
  background-color: #72c472;
}

.l2-more-button {
  width: 30px;
  padding: 0;
  font-size: 16px;
}

nav.search-button-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  white-space: nowrap;
}
button.inner-pill {
  height: 35px;
  padding: 0 15px;
  margin: 0 4px;
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 14px;
  color: #444;
  border-radius: 17.5px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  opacity: 0.7;
  transform: translateY(0) scale(1);
  transition: all 0.35s ease-out;
  cursor: pointer;
  z-index: 1;
  white-space: nowrap;
  border: none;
  font-family: inherit;
}
button.inner-pill.active {
  opacity: 1;
  color: #333;
  transform: translateY(-2px) scale(1.05);
  z-index: 2;
}
.pill-chat.active {
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15), 0 0 12px #add8e6;
}
.pill-find.active {
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15), 0 0 12px #f08080;
}
.pill-ingest.active {
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15), 0 0 12px #ffdab9;
}
.pill-studio.active {
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15), 0 0 12px #ffb6c1;
}
.pill-workflows.active {
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15), 0 0 12px #90ee90;
}

button.inner-pill:not(.active):hover {
  transform: translateY(-3px);
  opacity: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}
header.search-container.focused
  nav.search-button-container
  button.inner-pill:not(.active) {
  width: 0;
  padding: 0;
  margin: 0;
  opacity: 0;
  font-size: 0;
}
header.search-container.focused
  nav.search-button-container
  button.inner-pill.active {
  margin: 0 4px;
}

.pill-chat {
  background-color: #add8e6;
}
.pill-find {
  background-color: #f08080;
}
.pill-ingest {
  background-color: #ffdab9;
}
.pill-studio {
  background-color: #ffb6c1;
}
.pill-workflows {
  background-color: #90ee90;
}

.session-ribbon {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1100px;
  background: #fff;
  border-radius: 0 0 20px 20px;
  box-shadow: 0 15px 25px rgba(0, 0, 0, 0.15);
  z-index: 90;
  padding: 15px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out, opacity 0.4s ease-out,
    padding 0.4s ease-out;
}
.session-ribbon.visible {
  max-height: 500px;
  opacity: 1;
}
.session-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.session-list li {
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s;
}
.session-list li:hover {
  background-color: #f4f4f4;
}
.session-list-title {
  font-weight: bold;
  margin-bottom: 10px;
  color: #555;
}

/* --- NEW: WIZARD MODAL STYLES (for fetched content) --- */
.wizard-modal-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-out;
}
.wizard-modal-container.visible {
  opacity: 1;
  pointer-events: auto;
}
.wizard-modal-content {
  width: 90%;
  max-width: 500px;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  /* To contain the fetched content */
  max-height: 90vh;
  overflow: hidden; /* Hide overflow until content loads */
}
#wizard-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: #f0f0f0;
  color: #333;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  line-height: 30px;
  text-align: center;
  z-index: 10;
}

/* --- NEW: Wizard Panel Styling (for fetched HTML) --- */
/* This will style the content of Wizard_1.html */
.wizard-panel-content {
  padding: 30px 25px 25px 25px; /* Padding for the form */
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: calc(90vh - 60px); /* Fit inside modal */
  overflow-y: auto; /* Scroll if form is long */
}
.wizard-panel-content h3 {
  margin: 0;
  color: #333;
  font-size: 1.4rem;
}
.wizard-panel-content p {
  margin: -5px 0 0 0;
  color: #555;
  font-size: 0.95rem;
}
.wizard-panel-content .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wizard-panel-content label {
  font-weight: 500;
  font-size: 0.9rem;
  color: #444;
}
.wizard-panel-content input[type="text"],
.wizard-panel-content input[type="number"],
.wizard-panel-content textarea {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box; /* Important! */
  transition: border-color 0.2s, box-shadow 0.2s;
}
.wizard-panel-content input:focus,
.wizard-panel-content textarea:focus {
  outline: none;
  border-color: #add8e6; /* Match our CHAT pill */
  box-shadow: 0 0 8px #add8e680;
}
.wizard-panel-content textarea {
  resize: vertical;
  min-height: 80px;
}
.wizard-panel-content .form-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end; /* Align button to the right */
}
/* Make the wizard submit button match the L2 style */
.wizard-panel-content .wizard-submit {
  background-color: #72c472; /* Green 'Workflows' color */
  font-size: 14px;
  height: 40px;
  border-radius: 20px;
  padding: 0 20px;
}

.wizard-popup-overlay {
  position: fixed;
  inset: 0;
  /* background: rgba(0, 0, 0, 0.55); */
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* --- Popup Container (holds the iframe) --- */
.wizard-popup-box {
  background: transparent;
  border-radius: 14px;
  width: min(950px, 95%);
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* box-shadow: 0 25px 45px rgba(0, 0, 0, 0.25); */
}

/* --- Iframe for Wizard --- */
#wizardPopupFrame {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 14px;
}

/* Button to trigger wizard */
#openWizardBtn {
  margin: 2rem;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  background: #0ea5a5;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
}
/* ... (Responsive styles are unchanged) ... */
@media (max-width: 900px) {
  .top-branding-bar {
    height: auto;
    flex-direction: column;
    padding: 10px;
    gap: 10px;
  }
  .branding-logo {
    height: 40px;
  }
  .settings-pill {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  header.search-container {
    width: 98%;
    height: 40px;
  }
  button.geosage-pill {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
  button.inner-pill {
    height: 30px;
    font-size: 13px;
    padding: 0 12px;
  }
  .l2-button {
    height: 26px;
    border-radius: 13px;
    font-size: 12px;
  }
  .l2-more-button {
    width: 30px;
  }
  input[type="search"].search-input {
    font-size: 14px;
  }

  .wizard-modal-content {
    width: 95%;
  }
}

@media (max-width: 768px) {
  header.search-container {
    overflow: hidden;
  }
  .l2-interface {
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .l2-interface::-webkit-scrollbar {
    display: none;
  }
  nav.search-button-container {
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  nav.search-button-container::-webkit-scrollbar {
    display: none;
  }
  .l2-menu-buttons {
    justify-content: flex-start;
    gap: 8px;
  }
  .l2-button {
    flex-shrink: 0;
    white-space: nowrap;
    max-width: 140px;
  }
}
