@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --bg: #07080a;
  --bg-subtle: #0d0f13;
  --surface: #11141a;
  --surface-card: #151821;
  --surface-card-hover: #1a1e29;
  --text: #f5f5f7;
  --text-muted: #8b8e99;
  --text-dim: #60636d;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --line-hover: rgba(255, 255, 255, 0.28);
  --accent: #c8ff4d;
  --accent-rgb: 200, 255, 77;
  --accent-subtle: rgba(200, 255, 77, 0.12);
  --max-width: 1200px;
  --header-height: 72px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  width: 100%;
}

/* Accessible focus ring */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast), border-color var(--transition-fast), opacity var(--transition-fast);
}

img, video, iframe {
  display: block;
  max-width: 100%;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.nav {
  position: fixed;
  z-index: 100;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  padding: 0 6vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(7, 8, 10, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transition: background var(--transition-smooth);
}

.brand {
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.04em;
  color: var(--text);
}

.brand span {
  color: var(--accent);
}

.nav nav {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

.nav nav a {
  padding: 8px 0;
  position: relative;
}

.nav nav a:hover,
.nav nav a:focus-visible {
  color: var(--text);
}

.nav nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--transition-fast);
}

.nav nav a:hover::after {
  width: 100%;
}

/* ==========================================================================
   HERO — SCROLL CONTROLLED CINEMATIC VIDEO
   ========================================================================== */
.hero-scrub {
  height: 330vh;
  position: relative;
  width: 100%;
}

.hero-sticky {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #030405;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.82;
  transform: scale(1.01);
  will-change: transform;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 50%, rgba(7, 8, 10, 0.75) 0%, rgba(7, 8, 10, 0.4) 60%, rgba(7, 8, 10, 0.7) 100%),
    linear-gradient(90deg, rgba(7, 8, 10, 0.88) 0%, rgba(7, 8, 10, 0.5) 45%, rgba(7, 8, 10, 0.25) 100%),
    linear-gradient(0deg, var(--bg) 0%, transparent 25%);
  pointer-events: none;
}

.hero-content {
  position: absolute;
  z-index: 2;
  left: 6vw;
  right: 6vw;
  top: 50%;
  transform: translateY(-50%);
  max-width: 780px;
}

.eyebrow, .section-label {
  font-family: "DM Sans", sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero-title {
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: clamp(52px, 8.5vw, 120px);
  line-height: 0.88;
  letter-spacing: -0.06em;
  margin: 18px 0 24px;
  color: var(--text);
}

.hero-title span {
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.7);
  display: inline-block;
}

.hero-copy {
  max-width: 560px;
  color: #cfd2dc;
  font-size: clamp(16px, 1.8vw, 19px);
  line-height: 1.55;
  font-weight: 400;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  min-height: 48px;
  border-radius: var(--radius-pill);
  font-family: "Manrope", sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid var(--line-strong);
  text-align: center;
}

.button-primary {
  background: var(--text);
  color: #07080a;
  border-color: var(--text);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--accent);
  border-color: var(--accent);
  color: #07080a;
  transform: translateY(-1px);
}

.button-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: var(--line-strong);
}

.button-ghost:hover,
.button-ghost:focus-visible {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text);
  transform: translateY(-1px);
}

.scroll-hint {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 48px;
  color: var(--text-muted);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.scroll-indicator {
  width: 28px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
  animation: pulseLine 2s infinite ease-in-out;
}

@keyframes pulseLine {
  0%, 100% { opacity: 0.4; transform: scaleX(0.7); }
  50% { opacity: 1; transform: scaleX(1); }
}

.hero-progress {
  position: absolute;
  bottom: 24px;
  left: 6vw;
  right: 6vw;
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  z-index: 3;
  border-radius: 2px;
  overflow: hidden;
}

.hero-progress i {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 0.05s linear;
}

/* ==========================================================================
   COMMON SECTION STYLES
   ========================================================================== */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 130px 6vw;
  position: relative;
}

.section-label {
  display: inline-block;
  margin-bottom: 20px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  margin-bottom: 60px;
}

.section-title, .contact-title {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: clamp(38px, 5.2vw, 68px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  margin-top: 8px;
}

.section-title em, .display em, .contact-title em {
  font-style: normal;
  color: var(--text-muted);
}

.section-note {
  max-width: 360px;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.6;
}

.display {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: clamp(32px, 4.5vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin: 8px 0 0;
}

.body-copy {
  color: #c0c3ce;
  font-size: 16px;
  line-height: 1.8;
}

/* ==========================================================================
   ABOUT / PROFILE SECTION
   ========================================================================== */
.intro {
  border-top: 1px solid var(--line);
}

.intro-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 8vw;
  margin-top: 28px;
  align-items: start;
}

.intro-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.location-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-muted);
  width: fit-content;
}

.location-badge strong {
  color: var(--text);
}

.location-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 10px var(--accent);
}

/* ==========================================================================
   SELECTED WORK (PROJECTS) — 1 PROJECT PER ROW SHOWCASE
   ========================================================================== */
.work {
  border-top: 1px solid var(--line);
}

.project-grid {
  display: flex;
  flex-direction: column;
  gap: 100px;
}

.project-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 80px;
  border-bottom: 1px solid var(--line);
}

.project-card:last-child {
  padding-bottom: 0;
  border-bottom: none;
}

.project-info-full {
  max-width: 100%;
  padding: 36px 40px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-smooth), transform var(--transition-smooth);
}

.project-card:hover .project-info-full {
  border-color: var(--line-hover);
  transform: translateY(-2px);
}

.project-media {
  aspect-ratio: 16 / 9;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  transition: border-color var(--transition-smooth), transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.project-card:hover .project-media,
.project-card:focus-within .project-media {
  border-color: var(--line-hover);
  transform: translateY(-4px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.6s ease;
  filter: brightness(0.94) contrast(1.04);
}

.project-card:hover .project-media img {
  transform: scale(1.025);
  filter: brightness(0.99) contrast(1.05);
}

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 8, 10, 0.35);
  border: none;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity var(--transition-smooth), background-color var(--transition-smooth);
  cursor: pointer;
}

.project-card:hover .play-overlay,
.project-media:focus-visible .play-overlay,
.play-overlay:focus-visible {
  opacity: 1;
}

.play-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 14px 26px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  color: #07080a;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  transform: translateY(6px);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.project-card:hover .play-button,
.play-overlay:focus-visible .play-button {
  transform: translateY(0);
}

.play-icon {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid #07080a;
  margin-left: 2px;
}

.project-media iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000000;
}

.project-info {
  padding-top: 32px;
  display: flex;
  flex-direction: column;
}

.project-index {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
}

.project-title {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 3.2vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.035em;
  margin: 10px 0 16px;
  color: var(--text);
}

.project-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.75;
  margin-bottom: 24px;
  max-width: 840px;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 4px;
}

.project-links a {
  font-family: "Manrope", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.project-links a:hover,
.project-links a:focus-visible {
  color: #07080a;
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ==========================================================================
   SKILLS / TOOLKIT
   ========================================================================== */
.skills {
  border-top: 1px solid var(--line);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 32px 30px;
  transition: border-color var(--transition-smooth), background-color var(--transition-smooth);
}

.skill-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-card);
}

.skill-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.skill-index {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.skill-card h3 {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  color: var(--text);
}

.skill-card p {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.75;
}

/* ==========================================================================
   CV SECTION
   ========================================================================== */
.cv-section {
  border-top: 1px solid var(--line);
}

.cv-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 8vw;
  align-items: start;
}

.cv-intro {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.cv-action {
  margin-top: 8px;
}

.cv-card {
  background: linear-gradient(150deg, var(--surface-card) 0%, var(--surface) 100%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.cv-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.cv-top strong {
  font-family: "Manrope", sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.cv-top span {
  color: var(--text-muted);
  font-size: 12.5px;
}

.cv-rule {
  height: 1px;
  background: var(--line);
  margin: 22px 0 24px;
}

.cv-entry {
  margin-bottom: 22px;
}

.cv-entry:last-child {
  margin-bottom: 0;
}

.cv-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.cv-entry h3 {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 15.5px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.cv-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-subtle);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.cv-badge-cert {
  font-size: 11.5px;
  font-weight: 700;
  color: #79c0ff;
  background: rgba(56, 139, 253, 0.15);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.cv-sub {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* ==========================================================================
   CONTACT SECTION
   ========================================================================== */
.contact {
  border-top: 1px solid var(--line);
  padding-bottom: 160px;
}

.contact-card {
  margin-top: 48px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.contact-name {
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.email {
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: clamp(24px, 4.6vw, 54px);
  letter-spacing: -0.04em;
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 10px;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  word-break: break-word;
}

.email:hover,
.email:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 36px;
  margin-top: 16px;
}

.contact-meta-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-dim);
  font-weight: 700;
}

.meta-value {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
}

a.meta-value:hover,
a.meta-value:focus-visible {
  color: var(--accent);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
footer {
  border-top: 1px solid var(--line);
  padding: 32px 6vw;
  background: #040506;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--text-dim);
  font-size: 12px;
}

/* ==========================================================================
   RESPONSIVENESS & MEDIA QUERIES (DEVICE-SENSITIVE MOBILE OPTIMIZATION)
   ========================================================================== */

/* Touch interaction optimizations */
@media (pointer: coarse) {
  a, button, input, select, textarea {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

@media (max-width: 960px) {
  .section-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .intro-grid, .cv-layout {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .project-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}

@media (max-width: 768px) {
  .hero-scrub {
    height: 300vh;
  }
  .hero-title {
    font-size: clamp(38px, 11vw, 76px);
    margin: 14px 0 18px;
  }
  .hero-copy {
    font-size: 15px;
    margin-bottom: 24px;
  }
  .location-badge {
    width: 100%;
    justify-content: center;
  }
  .cv-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}

/* Touch devices optimization (Always visible play buttons & pill links) */
@media (hover: none) {
  .play-overlay {
    opacity: 0.92;
    background: rgba(7, 8, 10, 0.45);
  }
  .play-button {
    transform: translateY(0);
  }
  .project-links a {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-pill);
    border: 1px solid var(--line-strong);
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 60px;
  }
  .nav {
    padding: 0 16px;
  }
  .brand {
    font-size: 19px;
  }
  .nav nav {
    gap: 8px;
  }
  .nav nav a {
    padding: 6px 10px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.08);
  }
  .nav nav a::after {
    display: none;
  }
  .section {
    padding: 70px 18px;
  }
  .section-title, .contact-title, .display {
    font-size: clamp(28px, 8vw, 42px);
  }
  .hero-content {
    left: 18px;
    right: 18px;
  }
  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  .hero-actions .button {
    width: 100%;
  }
  .scroll-hint {
    margin-top: 24px;
  }
  .skills-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .skill-card {
    padding: 22px 18px;
  }
  .cv-card {
    padding: 22px 18px;
  }
  .contact-card {
    margin-top: 32px;
  }
  .email {
    font-size: clamp(20px, 6.5vw, 36px);
  }
  .contact-meta {
    flex-direction: column;
    gap: 16px;
  }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 380px) {
  .nav nav {
    gap: 4px;
  }
  .nav nav a {
    padding: 5px 8px;
    font-size: 11px;
  }
  .hero-title {
    font-size: 34px;
  }
  .section {
    padding: 60px 14px;
  }
}

/* ==========================================================================
   REDUCED MOTION SUPPORT
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero-scrub {
    height: auto;
    min-height: 100vh;
  }
  .hero-sticky {
    position: relative;
    height: auto;
    min-height: 100vh;
    padding: 120px 0;
  }
  .hero-content {
    position: relative;
    top: auto;
    transform: none;
    padding: 40px 0;
  }
  .hero-progress, .scroll-hint {
    display: none;
  }
  .hero-video {
    position: absolute;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   AI ASSISTANT CHATBOT (BOTTOM-LEFT FLOATING WIDGET)
   ========================================================================== */
.ai-chatbot {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1000;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}

.chat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: rgba(15, 18, 24, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  border: 1px solid rgba(200, 255, 77, 0.35);
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(200, 255, 77, 0.12);
  transition: all var(--transition-fast);
  position: relative;
}

.chat-toggle:hover,
.chat-toggle:focus-visible {
  background: var(--surface-card);
  border-color: var(--accent);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(200, 255, 77, 0.25);
}

.chat-toggle-icon {
  color: var(--accent);
  font-size: 15px;
}

.chat-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 10px var(--accent);
  animation: pulseDot 2s infinite ease-in-out;
}

@keyframes pulseDot {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.chat-window {
  position: absolute;
  bottom: 60px;
  left: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 100px);
  background: rgba(13, 15, 19, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s;
  pointer-events: none;
}

.chat-window.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-header {
  padding: 16px 20px;
  background: rgba(7, 8, 10, 0.85);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-family: "Manrope", sans-serif;
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-title {
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.chat-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.chat-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4de680;
  box-shadow: 0 0 8px #4de680;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  position: relative;
  transition: all var(--transition-fast);
}

.chat-header-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent);
}

.key-active-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  position: absolute;
  top: 2px;
  right: 2px;
}

.chat-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.chat-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

/* In-Chat Key Alert & Action Button */
.chat-key-banner {
  background: rgba(255, 100, 100, 0.1);
  border: 1px solid rgba(255, 100, 100, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 8px;
}

.chat-key-banner p {
  color: #ff9b9b;
  font-size: 12.5px;
  margin-bottom: 10px;
}

.chat-key-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #07080a;
  font-family: "Manrope", sans-serif;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.chat-key-action-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(200, 255, 77, 0.3);
}

.chat-messages {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.chat-msg {
  max-width: 86%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
}

.bot-msg {
  align-self: flex-start;
  background: var(--surface-card);
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-top-left-radius: 4px;
}

.bot-msg p {
  margin-bottom: 8px;
}

.bot-msg p:last-child {
  margin-bottom: 0;
}

.bot-msg ul, .bot-msg ol {
  margin-left: 18px;
  margin-top: 6px;
  margin-bottom: 6px;
}

.bot-msg li {
  margin-bottom: 4px;
}

.bot-msg strong {
  color: #ffffff;
}

.user-msg {
  align-self: flex-end;
  background: var(--accent);
  color: #07080a;
  font-weight: 600;
  border-top-right-radius: 4px;
}

.chat-suggestions-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 6px;
  margin-bottom: 4px;
}

.chat-suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 9px 14px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.suggestion-chip:hover {
  background: var(--surface-card);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(3px);
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

.chat-input-area {
  padding: 12px 14px;
  background: rgba(7, 8, 10, 0.9);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-input-area input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  padding: 10px 16px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.chat-input-area input:focus {
  border-color: var(--accent);
}

.chat-input-area button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent);
  color: #07080a;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.chat-input-area button:hover {
  transform: scale(1.05);
}

/* ==========================================================================
   API KEY CONFIGURATION MODAL (BYOK)
   ========================================================================== */
.api-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(4, 5, 7, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.api-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.api-modal-card {
  background: #11141a;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 30px 28px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), 0 0 30px rgba(200, 255, 77, 0.08);
  transform: translateY(16px) scale(0.96);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.api-modal-overlay.open .api-modal-card {
  transform: translateY(0) scale(1);
}

.api-modal-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  margin-bottom: 20px;
}

.api-modal-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface-card);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.api-modal-title {
  font-family: "Manrope", sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.api-modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

.api-modal-close {
  position: absolute;
  top: -6px;
  right: -6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.api-modal-close:hover {
  color: var(--text);
}

.api-modal-desc {
  font-size: 13.5px;
  color: #c4c7d2;
  line-height: 1.6;
  margin-bottom: 16px;
}

.api-modal-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(200, 255, 77, 0.08);
  border: 1px solid rgba(200, 255, 77, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 12px;
  color: #dce0ea;
  line-height: 1.5;
  margin-bottom: 20px;
}

.api-modal-tip a {
  color: var(--accent);
  text-decoration: underline;
  font-weight: 600;
}

.api-modal-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.api-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 22px;
}

.api-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 42px 12px 14px;
  color: var(--text);
  font-family: monospace;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast);
}

.api-input:focus {
  border-color: var(--accent);
}

.api-visibility-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 15px;
  opacity: 0.7;
  padding: 4px;
  transition: opacity var(--transition-fast);
}

.api-visibility-btn:hover {
  opacity: 1;
}

.api-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.api-active-info {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #4de680;
}

.api-remove-btn {
  background: transparent;
  border: 1px solid rgba(255, 100, 100, 0.4);
  color: #ff8b8b;
  font-size: 11.5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.api-remove-btn:hover {
  background: rgba(255, 100, 100, 0.15);
  border-color: #ff8b8b;
}

@media (max-width: 480px) {
  .ai-chatbot {
    bottom: 16px;
    left: 16px;
  }
  .chat-window {
    position: fixed;
    bottom: 16px;
    left: 16px;
    right: 16px;
    width: auto;
    max-width: none;
    height: calc(85vh - 20px);
  }
  .api-modal-card {
    padding: 24px 18px;
  }
  .api-modal-actions {
    flex-direction: column;
  }
  .api-modal-actions .button {
    width: 100%;
  }
}


