/* HAIRA AI Studio Polish V4 */

:root {
  --haira-vh: 100dvh;
  --studio-max-width: 980px;
  --studio-side-gap: clamp(12px, 3vw, 24px);
  --studio-header-height: 76px;

  --studio-blue: #149dff;
  --studio-blue-soft: #67c8ff;
  --studio-yellow: #ffd500;

  --studio-surface: rgba(5, 8, 12, 0.91);
  --studio-surface-strong: rgba(7, 10, 15, 0.97);
  --studio-border: rgba(255, 255, 255, 0.09);
}

/* Kunci ukuran dan cegah halaman bergeser */

html,
body.studio-body {
  width: 100%;
  max-width: 100%;
  height: var(--haira-vh, 100dvh);
  margin: 0;
  overflow: hidden !important;
  overscroll-behavior: none;

  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.haira-studio-locked {
  touch-action: pan-y;
}

body.studio-body {
  position: fixed;
  inset: 0;
  min-height: 0;
  background: #000;
  touch-action: pan-y;
}

.studio-body,
.studio-body * {
  min-width: 0;
}

.studio-body img,
.studio-body svg,
.studio-body video,
.studio-body canvas {
  max-width: 100%;
}

.studio-body input,
.studio-body textarea,
.studio-body select,
.studio-body button {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

/* Background */

.studio-motion {
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
}

.studio-motion::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 14% 18%,
      rgba(20, 157, 255, 0.08),
      transparent 26%
    ),
    radial-gradient(
      circle at 88% 82%,
      rgba(255, 213, 0, 0.055),
      transparent 25%
    );
  pointer-events: none;
}

/* Header */

.studio-header {
  height: var(--studio-header-height);
  min-height: var(--studio-header-height);

  padding-left:
    max(var(--studio-side-gap), env(safe-area-inset-left));

  padding-right:
    max(var(--studio-side-gap), env(safe-area-inset-right));

  border-bottom: 1px solid rgba(255, 255, 255, 0.075);

  background:
    linear-gradient(
      180deg,
      rgba(4, 5, 7, 0.97),
      rgba(2, 3, 5, 0.91)
    );

  box-shadow:
    0 14px 45px rgba(0, 0, 0, 0.4);

  backdrop-filter: blur(24px) saturate(135%);
  -webkit-backdrop-filter: blur(24px) saturate(135%);
}

.studio-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(20, 157, 255, 0.6),
      rgba(255, 213, 0, 0.48),
      transparent
    );

  opacity: 0.34;
}

.studio-header .brand {
  gap: 11px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.studio-header .brand-mark.small {
  width: 43px;
  height: 43px;
  border-radius: 14px;

  box-shadow:
    0 0 0 5px rgba(255, 213, 0, 0.035),
    0 12px 34px rgba(255, 213, 0, 0.12);
}

.studio-header .brand-name {
  font-size: 20px;
  letter-spacing: -0.035em;
}

.studio-header-actions {
  flex: 0 0 auto;
}

.studio-header-actions button,
.studio-header-actions a {
  min-height: 44px;
  padding: 0 16px;

  border-radius: 14px;
  background: rgba(255, 255, 255, 0.028);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

/* Struktur utama */

.studio-shell {
  width: min(100%, var(--studio-max-width));
  max-width: 100%;

  height:
    calc(
      var(--haira-vh, 100dvh) -
      var(--studio-header-height)
    );

  min-height: 0;
  margin: 0 auto;

  padding:
    15px
    max(var(--studio-side-gap), env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(var(--studio-side-gap), env(safe-area-inset-left));

  overflow: hidden;

  grid-template-rows:
    auto
    minmax(0, 1fr)
    auto;
}

/* Pemilih model */

.studio-toolbar {
  width: 100%;
  gap: 12px;
  padding: 2px 0 14px;
  align-items: end;
}

.studio-toolbar label {
  flex: 1 1 auto;
  width: 100%;
  gap: 8px;
}

.studio-toolbar label > span {
  padding-left: 2px;
  color: #8f98a6;
  font-size: 10px;
  letter-spacing: 0.16em;
}

.studio-toolbar select {
  width: 100%;
  min-width: 0;
  height: 52px;
  padding: 0 46px 0 16px;

  border:
    1px solid rgba(20, 157, 255, 0.32);

  border-radius: 16px;
  color: #f7f9fc;

  background:
    linear-gradient(
      180deg,
      rgba(10, 13, 18, 0.98),
      rgba(5, 7, 10, 0.98)
    );

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 12px 35px rgba(0, 0, 0, 0.22);
}

.settings-button {
  flex: 0 0 auto;
  min-width: 116px;
  height: 52px;
  padding: 0 16px;

  justify-content: center;
  border-radius: 16px;
  color: #f4f6f8;

  background:
    linear-gradient(
      180deg,
      rgba(12, 16, 22, 0.95),
      rgba(5, 8, 12, 0.95)
    );

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.035),
    0 12px 35px rgba(0, 0, 0, 0.22);
}

.settings-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
}

/* Percakapan */

.chat-panel {
  width: 100%;
  max-width: 100%;
  min-height: 0;

  padding: 12px 2px 18px;

  overflow-y: auto;
  overflow-x: hidden !important;

  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;

  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;

  scrollbar-gutter: stable;
}

.chat-panel::-webkit-scrollbar {
  width: 5px;
}

.chat-panel::-webkit-scrollbar-thumb {
  border-radius: 999px;

  background:
    linear-gradient(
      var(--studio-blue),
      var(--studio-yellow)
    );
}

/* Tampilan awal Studio */

.empty-state {
  width: 100%;
  max-width: 760px;
  min-height: 100%;

  margin: 0 auto;
  padding: 34px 0 28px;
}

.empty-state h1 {
  max-width: 670px;
  margin: 11px auto 12px;

  font-size:
    clamp(36px, 7vw, 58px);

  line-height: 1.02;
  text-wrap: balance;
}

.empty-state > p {
  max-width: 580px;
  margin-inline: auto;

  font-size: 15px;
  text-wrap: pretty;
}

.studio-core-wrap {
  filter:
    drop-shadow(
      0 22px 45px rgba(20, 157, 255, 0.1)
    );
}

.prompt-grid {
  width: min(100%, 590px);

  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 11px;
}

.prompt-grid button {
  width: 100%;
  min-height: 62px;
  border-radius: 17px;

  background:
    linear-gradient(
      135deg,
      rgba(20, 157, 255, 0.045),
      rgba(255, 213, 0, 0.025)
    ),
    rgba(6, 9, 13, 0.91);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 12px 38px rgba(0, 0, 0, 0.22);
}

/* Bubble pesan */

.messages {
  width: min(100%, 850px);
  max-width: 100%;

  gap: 18px;
  padding: 3px 0 8px;
}

.message {
  width: 100%;
  max-width: 100%;
  align-items: start;
}

.message-content {
  width: 100%;
  max-width: 100%;
  overflow: hidden;

  border-radius: 20px;

  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.017),
      transparent 48%
    ),
    rgba(6, 9, 13, 0.93);

  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.025),
    0 16px 45px rgba(0, 0, 0, 0.24);
}

.message.user .message-content {
  border-color:
    rgba(20, 157, 255, 0.29);

  background:
    linear-gradient(
      135deg,
      rgba(20, 157, 255, 0.08),
      rgba(20, 157, 255, 0.025)
    ),
    rgba(5, 10, 15, 0.94);
}

.message.assistant .message-content {
  border-color:
    rgba(255, 213, 0, 0.17);

  background:
    linear-gradient(
      135deg,
      rgba(255, 213, 0, 0.025),
      transparent 45%
    ),
    rgba(6, 8, 11, 0.95);
}

.markdown-body,
.message-content p,
.message-content li,
.message-content blockquote,
.message-content pre,
.message-content code {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
}

.md-code-block,
.message-content pre {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

/* Kolom penulisan */

.composer {
  width: min(100%, 880px);
  max-width: 100%;
  min-height: 88px;

  margin: 0 auto;
  padding: 14px 72px 31px 17px;

  border:
    1px solid rgba(20, 157, 255, 0.34);

  border-radius: 22px;

  background:
    linear-gradient(
      145deg,
      rgba(20, 157, 255, 0.035),
      rgba(255, 213, 0, 0.018)
    ),
    rgba(5, 8, 12, 0.96);

  box-shadow:
    0 -15px 55px rgba(0, 0, 0, 0.28),
    0 18px 65px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);

  backdrop-filter:
    blur(24px) saturate(130%);

  -webkit-backdrop-filter:
    blur(24px) saturate(130%);

  overflow: hidden;
  touch-action: manipulation;
}

.composer:focus-within {
  border-color:
    rgba(20, 157, 255, 0.68);

  box-shadow:
    0 0 0 3px rgba(20, 157, 255, 0.065),
    0 22px 65px rgba(0, 0, 0, 0.48);
}

.composer textarea {
  width: 100%;
  max-width: 100%;
  min-height: 48px;

  padding: 2px 0;

  font-size: 16px;
  line-height: 1.55;

  caret-color: var(--studio-yellow);
  touch-action: pan-y;
}

.composer button {
  right: 13px;
  top: 13px;

  width: 49px;
  height: 49px;

  border-radius: 16px;

  background:
    linear-gradient(
      145deg,
      #ffe65f,
      var(--studio-yellow)
    );

  box-shadow:
    0 13px 34px rgba(255, 213, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.composer small {
  right: 72px;
  max-width: calc(100% - 92px);
}

.settings-card input {
  font-size: 16px;
}

/* Tampilan HP */

@media (max-width: 640px) {
  :root {
    --studio-header-height: 72px;
    --studio-side-gap: 13px;
  }

  .studio-header .brand-name {
    font-size: 18px;
  }

  .studio-header .brand-mark.small {
    width: 42px;
    height: 42px;
  }

  .studio-header-actions button {
    min-height: 44px;
    padding: 0 14px;
    font-size: 12px;
  }

  .studio-shell {
    padding-top: 12px;

    padding-bottom:
      max(
        11px,
        env(safe-area-inset-bottom)
      );
  }

  .studio-toolbar {
    gap: 10px;
    padding-bottom: 12px;
  }

  .studio-toolbar select,
  .settings-button {
    height: 54px;
    border-radius: 16px;
  }

  .settings-button {
    min-width: 82px;
    width: 82px;
    padding: 0 10px;
  }

  .settings-button::after {
    font-size: 10px;
  }

  .empty-state {
    justify-content: flex-start;

    padding-top:
      clamp(30px, 7vh, 66px);
  }

  .empty-state h1 {
    font-size:
      clamp(37px, 10.5vw, 47px);
  }

  .empty-state > p {
    font-size: 14px;
  }

  .prompt-grid {
    gap: 10px;
  }

  .prompt-grid button {
    min-height: 65px;
    padding: 12px;
    font-size: 12px;
  }

  .message {
    grid-template-columns:
      38px minmax(0, 1fr);

    gap: 10px;
  }

  .message-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }

  .message-content {
    padding: 15px;
    border-radius: 19px;
  }

  .markdown-body,
  .message-content p {
    font-size: 14px;
    line-height: 1.72;
  }

  .composer {
    min-height: 91px;

    padding:
      14px 69px 31px 16px;

    border-radius: 21px;
  }

  .composer button {
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 380px) {
  .studio-header-actions button {
    padding: 0 11px;
    font-size: 11px;
  }

  .prompt-grid {
    grid-template-columns: 1fr;
  }

  .settings-button {
    min-width: 72px;
    width: 72px;
  }
}

@media
  (orientation: landscape)
  and (max-height: 520px) {

  .empty-state {
    padding-top: 18px;
  }

  .studio-core-wrap,
  .assistant-label,
  .empty-state > p {
    display: none;
  }

  .empty-state h1 {
    font-size: 34px;
  }

  .prompt-grid {
    margin-top: 14px;
  }
}
