@import url("https://fonts.googleapis.com/css2?family=Figtree:wght@300;400;500;700;900&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 {
  --toolbar-padding: 15px;
  --toolbar-spacing: 6px;
  --color-background: #080a0c;
  --color-text-primary: #ffffff;
  --color-text-secondary: rgba(255, 255, 255, 0.5);
  --color-grey-variant: #9aa6ad;
  --section-spacing: 32px;
  --card-width: 165px;
  --card-thumbnail-height: 200px;
  --card-gap: 20px;
  --card-padding: 12px;
  --content-max-width: 1200px;
}

body {
  margin: 0;
  font-family: "Figtree", 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;
}

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

/* ===== TOOLBAR ===== */

app-topbar {
  position: relative;
}

.topbar-left,
.topbar-right {
  min-width: 65px;
}

.project-info-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 2;

  .project-logo {
    height: 60px;
    width: 60px;
    object-fit: cover;
    border-radius: 12px;
  }

  .project-name {
    font-size: 30px;
    font-weight: 400;
    color: var(--color-text-primary);
    margin: 0;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .project-description {
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
  }
}

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

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

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

/* ===== LOADING ===== */

.project-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 40vh;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--color-text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== PROJECT INFO ===== */

.project-info {
  text-align: center;
  padding-top: 124px;
}

/* ===== FEATURED AGENT HERO (copied from home) ===== */

.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: fixed;
  top: 0;
  z-index: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  pointer-events: none;
  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: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 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: 400;
  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: 400;
  color: var(--color-text-primary);
  line-height: 1.3;
  text-align: center;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  line-clamp: 2;
  -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;
  }
}

/* Project overrides .button.primary with its own gradient */
.button.primary {
  background: linear-gradient(
    to right,
    rgba(76, 206, 214, 1) 0%,
    rgba(61, 122, 255, 1) 100%
  );
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ===== AGENTS GRID ===== */

.project-agents-section {
  position: relative;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding: 40px 20px;
  z-index: 2;
  margin: 0 auto;
  max-width: var(--content-max-width);

  .agents-title {
    margin: 0;
    font-size: 30px;
    font-weight: 400;
    color: var(--color-text-primary);
    line-height: 1;
    text-align: left;
  }

  .agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--card-gap);
    width: 100%;
  }
}

/* ===== AGENT CARD (copied from home) ===== */

.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;
}

.agent-card-badge[data-state="draft"] {
  background: rgba(2, 57, 234, 0.6);
}

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

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

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

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

/* 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: 400;
  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: 400;
  color: var(--color-grey-variant);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  line-clamp: 2;
  -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: 400;
  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;
}

/* ===== LOGIN OVERLAY ===== */

.project-login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(8, 10, 12, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
}

.login-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
}

.login-overlay-text {
  font-size: 20px;
  font-weight: 400;
  color: var(--color-text-primary);
  text-align: center;
  margin: 0;
}

.login-overlay-button {
  padding: 16px 48px;
  border: none;
  border-radius: 32px;
  font-size: 18px;
  font-weight: 400;
  color: #fff;
  background: var(--gradient-brand);
  background-size: 225% 225%;
  background-position: 45% 0%;
  cursor: pointer;
  box-shadow: 0 0 20px 0 rgba(255, 255, 255, 0.15) inset;
  transition:
    background-position 0.5s ease-out,
    box-shadow 0.3s ease-in-out;
}

.login-overlay-button:hover,
.login-overlay-button:active {
  background-position: 100% 100%;
  box-shadow: 0 0 20px 0 rgba(255, 255, 255, 0.5) inset;
}

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

@media (min-width: 1240px) {
  .project-info,
  .agents-grid {
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
  }
}

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

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

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

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

  .project-name {
    font-size: 26px;
  }

  .project-description {
    font-size: 18px;
  }

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

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

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

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

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

  .project-name {
    font-size: 24px;
  }

  .project-description {
    font-size: 16px;
  }

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

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

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