@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@300&display=swap');

/* Global Scrollbar Styling */
* {
  scrollbar-width: 8px;
  scrollbar-color: rgba(255, 255, 255, 0.15) rgba(0, 0, 0, 0.15);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.5);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

:root {
  --color-grey-variant: #9aa6ad;
  --section-spacing: 32px;
  --card-width: 225px;
  --card-thumbnail-height: 200px;
  --card-gap: 20px;
  --card-padding: 12px;
  --content-max-width: 1200px;
}

body {
  margin: 0;
  font-family: 'Figtree', "Avenir", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--color-background);
  color: #e6eef0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

.home-container {
  width: 100%;
  height: 100vh;
  background: var(--color-background);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.toolbar-logo-icon {
  height: 40px;
  width: auto;
}

.toolbar-logo-text {
  font-size: 1.5rem;
  font-weight: 300;
  font-family: 'Figtree', sans-serif;
  color: #fff;
  letter-spacing: 0;
}

/* ===== MAIN CONTENT ===== */

.home-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 120px 0;
  -webkit-overflow-scrolling: touch;
}

/* ===== HERO SECTION ===== */

.hero-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px 80px 20px;
  position: relative;
  min-height: 400px;
}

.hero-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 2;
  position: relative;
  padding-bottom: 50px;
}

.hero-title-line {
  font-size: 44px;
  font-weight: 900;
  color: var(--color-text-primary);
  line-height: 1;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-orb {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}

.orb-image {
  width: 720px;
  height: 720px;
  object-fit: contain;
  opacity: 0.9;
}

/* ===== FEATURED AGENT HERO ===== */

.featured-agent-hero {
  position: relative;
  width: 100%;
  height: 450px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  padding: 50px 0 50px 0;
}

.featured-agent-env {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 70%, transparent 100%);
}

.featured-agent-env[src=""],
.featured-agent-env:not([src]) {
  display: none;
}

.featured-agent-avatar {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  width: 100%;
  max-width: 600px;
  height: 100%;
  object-fit: contain;
  object-position: top center;
  mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 80%, transparent 100%);
}

.featured-agent-avatar[src=""],
.featured-agent-avatar:not([src]) {
  display: none;
}

.featured-agent-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    rgba(8, 10, 12, 0) 0%,
    rgba(8, 10, 12, 0.3) 30%,
    rgba(8, 10, 12, 0.7) 50%,
    rgba(8, 10, 12, 0.95) 85%,
    rgba(8, 10, 12, 1) 100%
  );
  pointer-events: none;
}

.featured-agent-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  max-width: 100%;
}

.featured-agent-title {
  font-size: 46px;
  font-weight: 900;
  color: var(--color-text-primary);
  line-height: 1;
  text-align: center;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.featured-agent-description {
  font-size: 18px;
  font-weight: 900;
  color: var(--color-text-primary);
  line-height: 1.3;
  text-align: center;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  max-width: 100%;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.button-group {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-top: 16px;

  .button:first-child {
    flex: 1;
    min-width: 0;
  }

  @media (max-width: 480px) {
    gap: 8px;
    margin-top: 12px;
  }
}

.home-content {
  scrollbar-width: thin;
}

/* ===== SECTIONS ===== */

.section {
  margin-bottom: var(--section-spacing);
}

@media (min-width: 1240px) {
  .section {
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
  }
}

.section-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--color-text-primary);
  margin: 0 0 16px var(--toolbar-padding);
  line-height: 1;
}

/* ===== HORIZONTAL AGENTS LIST ===== */

.agents-horizontal-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--card-gap);
  padding: 0 var(--toolbar-padding);
}

/* ===== AGENT CARD ===== */

.agent-card {
  position: relative;
  width: 100%;
  border-radius: 20px;
  background: rgba(11, 15, 18, 0.55);
  backdrop-filter: blur(20px) blur(20px);
  -webkit-backdrop-filter: blur(20px) blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.19);
  box-shadow:
    0 0 12px 0 rgba(255, 255, 255, 0.08) inset,
    0 0 1px 0 rgba(255, 255, 255, 0.1),
    0 2px 8px 0 rgba(0, 0, 0, 0.4);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border 0.2s ease;
}

.agent-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 20px;
  background: radial-gradient(
    circle at 50% 0%,
    rgba(255, 255, 255, 0.08) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 1;
}

.agent-card:hover {
  transform: translateY(-4px);
  background: rgba(11, 15, 18, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    0 0 16px 0 rgba(255, 255, 255, 0.12) inset,
    0 0 1px 0 rgba(255, 255, 255, 0.15),
    0 8px 16px 0 rgba(0, 0, 0, 0.5);
}

.agent-card:active {
  transform: translateY(-2px);
}

/* Thumbnail Section */

.agent-card-thumbnail-wrapper {
  position: relative;
  width: 100%;
  height: var(--card-thumbnail-height);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.9);
  border-radius: 20px 20px 0 0;
}

.agent-card-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.agent-card-thumbnail-gradient {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(
    to bottom,
    rgba(8, 10, 12, 0) 0%,
    rgba(8, 10, 12, 0.4) 40%,
    rgba(8, 10, 12, 0.85) 100%
  );
  pointer-events: none;
}

/* State Badge */

.agent-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 8px;
  border-radius: 20px;
  z-index: 3;
}

/* State-specific colors matching iOS */
.agent-card-badge[data-state="draft"] {
  background: rgba(2, 57, 234, 0.6); /* eliBlue */
}

.agent-card-badge[data-state="preview"] {
  background: rgba(255, 130, 35, 0.6); /* eliOrange */
}

.agent-card-badge[data-state="published"] {
  background: rgba(102, 198, 54, 0.6); /* eliGreen */
}

.agent-card-badge[data-state="archived"] {
  background: rgba(108, 108, 108, 1); /* eliGreyVariant2 */
}

.badge-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Star Button */

.agent-card-star-button {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.2) inset,
    0 2px 8px 0 rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
  z-index: 10;
}

.agent-card-star-button:hover {
  transform: scale(1.1);
  background: rgba(255, 255, 255, 0.22);
}

.agent-card-star-button:active {
  transform: scale(0.95);
}

.star-icon {
  width: 18px;
  height: 18px;
  pointer-events: none;
}

/* Info Section */

.agent-card-info {
  position: relative;
  padding: var(--card-padding);
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(11, 15, 18, 0.3);
  backdrop-filter: blur(20px) blur(10px);
  -webkit-backdrop-filter: blur(20px) blur(10px);
  z-index: 2;
}

.agent-card-name {
  font-size: 20px;
  font-weight: 500;
  color: var(--color-text-primary);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-card-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--color-grey-variant);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  min-height: calc(2 * 1.2em);
}

.agent-card-tenant {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-grey-variant);
}

.tenant-by {
  padding-bottom: 1px;
}

.tenant-name {
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 1px 0 rgba(255, 255, 255, 0.1);
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100px;
}

/* Template Hidden */

template {
  display: none !important;
}

/* Hidden utility class */

.hidden {
  display: none !important;
}

/* ===== BOTTOM BAR ===== */

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px var(--toolbar-padding) 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.bottom-bar::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 150px;
  background: linear-gradient(
    to bottom,
    rgba(8, 10, 12, 0) 0%,
    rgba(8, 10, 12, 0.3) 30%,
    rgba(8, 10, 12, 0.7) 60%,
    rgba(8, 10, 12, 1) 100%
  );
  pointer-events: none;
  z-index: -1;
}

.bottom-bar.hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.bottom-bar-button {
  --button-width: 100%;
  --button-max-width: 600px;
  --button-margin: 0 auto;
}

.bottom-bar-button-text {
  font-family: 'Figtree', "Avenir", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 18px;
  font-weight: 900;
  color: var(--color-text-primary);
  text-align: center;
  letter-spacing: 0.3px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  :root {
    --card-thumbnail-height: 180px;
    --card-gap: 16px;
    --section-spacing: 24px;
  }

  .agents-horizontal-list {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .section-title {
    font-size: 24px;
  }

  .agent-card-name {
    font-size: 18px;
  }

  .agent-card-title {
    font-size: 14px;
  }

  .hero-section {
    padding: 60px 20px 60px 20px;
    min-height: 350px;
  }

  .hero-title {
    gap: 12px;
  }

  .hero-title-line {
    font-size: 36px;
  }

  .orb-image {
    width: 560px;
    height: 560px;
  }

  .featured-agent-hero {
    height: 400px;
  }

  .featured-agent-title {
    font-size: 38px;
  }

  .featured-agent-description {
    font-size: 16px;
  }

  .bottom-bar-button-text {
    font-size: 17px;
  }
}

@media (max-width: 480px) {
  :root {
    --card-thumbnail-height: 170px;
    --card-gap: 12px;
    --section-spacing: 20px;
    --toolbar-padding: 16px;
  }

  .agents-horizontal-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-title {
    font-size: 22px;
  }

  .hero-section {
    padding: 50px 16px 50px 16px;
    min-height: 300px;
  }

  .hero-title {
    gap: 10px;
  }

  .hero-title-line {
    font-size: 32px;
  }

  .orb-image {
    width: 480px;
    height: 480px;
  }

  .featured-agent-hero {
    height: 350px;
  }

  .featured-agent-title {
    font-size: 32px;
  }

  .featured-agent-description {
    font-size: 15px;
  }

  .bottom-bar {
    padding: 12px 16px 16px;
  }

  .bottom-bar-button-text {
    font-size: 16px;
  }
}
