/* ── Tawang Premium Space Theme ──────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@400;600;700&family=Noto+Sans:wght@400;500;700&family=Rajdhani:wght@400;500;600;700&display=swap');

:root {
  /* Spiti Palette */
  --primary: #A7C957;
  --primary-hover: #dfe4a0;
  --primary-foreground: #1a1a1a;

  --background: #ffffff;
  --foreground: #1a1a1a;

  --card: #ffffff;
  --card-foreground: #1a1a1a;

  --secondary: #A7C957;
  --secondary-foreground: #1a1a1a;

  --muted: #f5f5f5;
  --muted-foreground: #737373;

  --border: #e5e5e5;
  --tawang-dark: #1a1a1a;

  --user-bubble: #A7C957;
  --bot-bubble: #ffffff;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --radius-lg: 30px;
  --radius-md: 16px;
}




/* ── Layout ──────────────────────────────────────────────────── */

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100dvh;
  overflow: hidden;
  background: rgba(243, 240, 232, 0.80);
  color: var(--foreground);
}



body {
  display: flex;
  flex-direction: column;
  font-family: "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* Full-page paper texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-repeat: repeat;
  background-image: url('background-paper-texture.jpg');
  mix-blend-mode: soft-light;
  background-size: 800px;
  opacity: 0.85;
}

/* Background topographic pattern */
body::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  bottom: -50px;
  right: -50px;
  transform: rotate(-15deg);
  background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10,10 Q50,5 90,10 T170,10 M10,30 Q50,25 90,30 T170,30 M10,50 Q50,45 90,50 T170,50 M10,70 Q50,65 90,70 T170,70 M10,90 Q50,85 90,90 T170,90 M10,110 Q50,105 90,110 T170,110 M10,130 Q50,125 90,130 T170,130 M10,150 Q50,145 90,150 T170,150 M10,170 Q50,165 90,170 T170,170' stroke='%23EDF1B0' stroke-width='1.5' fill='none' opacity='0.5'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  z-index: -1;
  pointer-events: none;
}


/* ── Header ──────────────────────────────────────────────────── */

#app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 60px;
  background: #FFEB46;
  z-index: 60;
  transition: all 300ms;
  box-shadow: 0 2px 2px 0 rgba(212, 185, 45, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  overflow: hidden;
}

/* Paper texture overlay scoped to header */
#app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-repeat: repeat;
  background-image: url('background-paper-texture.jpg');
  mix-blend-mode: soft-light;
  background-size: 800px;
  z-index: 0;
  opacity: 1;
}

#app-header > * {
  position: relative;
  z-index: 1;
}

@media (min-width: 768px) {
  #app-header {
    height: 80px;
    padding: 0 48px;
  }
}

@media (min-width: 1024px) {
  #app-header {
    height: 95px;
  }
}

@media (min-width: 1280px) {
  #app-header {
    height: 110px;
  }
}



.header-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.header-logo {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 148px;
  height: 48px;
  background: rgba(243, 240, 232, 0.80);
  border: 1.5px solid #1A1A1A;
  border-radius: 12px;
  backdrop-filter: blur(4.75px);
  font-family: "Noto Sans", sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: none;
}

.header-action-btn:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.06);
}

.header-action-btn span {
  color: #1A1A1A;
  text-align: center;
  font-family: "Rajdhani", sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: 18px;
  line-height: 26px;
  letter-spacing: -0.44px;
}



.chips {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-start;
  width: 897px;
  max-width: 100%;
}

.chips button {
  flex: 1 1 0;
  min-width: 140px;
  height: 52px;
  border-radius: 12px;
  border: 1.5px solid #1A1A1A;
  background: #FAE21E;
  backdrop-filter: blur(4.75px);
  color: #1A1A1A;
  font-family: "Noto Sans", sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 1rem;
  line-height: 26px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 1.5rem;
  white-space: nowrap;
}

.chips button:hover {
  background: #ffffff;
  border: 1.5px solid #1A1A1A;
  border-radius: 12px;
}



.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}




/* ── Chat thread ─────────────────────────────────────────────── */

#chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  padding-top: 70px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  scroll-behavior: smooth;
  mask-image: linear-gradient(to bottom, transparent 0%, black 3%, black 97%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 3%, black 97%, transparent 100%);
}

#chat-thread::-webkit-scrollbar {
  width: 4px;
}

#chat-thread::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 4px;
}


/* ── Messages ────────────────────────────────────────────────── */

.msg {
  width: fit-content;
  max-width: 645px;
  min-width: 100px;
  padding: 1rem 2.5rem;
  line-height: 25px;
  font-size: 18px;
  font-family: "Noto Sans";
  font-weight: 400;
  color: #000;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg.user {
  align-self: flex-end;
  min-width: 95px;
  min-height: 46px;
  padding: 0.75rem 1.5rem;
  background: transparent;
  color: #000;
  text-align: center;
  font-family: 'Noto Sans', sans-serif;
  font-style: normal;
  font-weight: 500;
  line-height: 25px;
  border-radius: 12px;
  border: 1px solid #1A1A1A;
  backdrop-filter: blur(2px);
}

/* WhatsApp-style: image on top, caption below */
.msg.user.has-file {
  flex-direction: column;
  align-items: stretch;
  padding: 0.3rem;
  border-radius: 16px;
  max-width: 300px;
  min-width: 200px;
  overflow: hidden;
  gap: 0;
  white-space: normal;
}

.msg-text {
  text-align: left;
}

.msg.user.has-file .msg-text {
  padding: 0.4rem 0.6rem 0.5rem;
  font-size: 15px;
  line-height: 21px;
  text-align: left;
}

.file-name-label {
  font-size: 0.78rem !important;
  color: #555 !important;
}

.msg.bot {
  align-self: flex-start;
  min-height: 86px;
  border-radius: 12px;
  background: #F4F1EB;
  color: #000;
  font-family: 'Noto Sans', sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: 18px;
  line-height: 25px;
  border: 1px solid #1A1A1A;
}

.file-preview-img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.file-doc {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.msg.status {
  align-self: flex-start;
  background: transparent;
  color: var(--muted-foreground);
  font-style: italic;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: none;
}

.msg.status .dot-pulse {
  display: inline-flex;
  gap: 3px;
}

.msg.status .dot-pulse span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted-foreground);
  animation: pulse 1.2s ease-in-out infinite;
}

.msg.status .dot-pulse span:nth-child(2) {
  animation-delay: 0.2s;
}

.msg.status .dot-pulse span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {

  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: scale(0.8);
  }

  40% {
    opacity: 1;
    transform: scale(1);
  }
}


/* ── Welcome Screen ─────────────────────────────────────────── */

.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  margin-top: -5vh;
  /* Slight upward shift for better visual balance */
}

.welcome h2 {
  width: auto;
  max-width: 95vw;
  color: #1A1A1A;
  text-align: center;
  font-family: "Rajdhani", sans-serif;
  font-size: 60px;
  font-style: normal;
  font-weight: 600;
  line-height: 66px;
  margin: 0;
  letter-spacing: -2.25px;
}

.welcome p {
  width: auto;
  max-width: 95vw;
  color: #1A1A1A;
  text-align: center;
  font-family: "Noto Sans", sans-serif;
  font-size: 28px;
  font-style: normal;
  font-weight: 400;
  line-height: 81px;
  letter-spacing: -0.56px;
  margin: 0;
  white-space: normal;
}



.chips-label {
  width: auto;
  color: #1A1A1A;
  font-family: "Noto Sans", sans-serif;
  font-style: normal;
  font-weight: 400;
  font-size: 18px;
  line-height: 26px;
  margin-bottom: 0.25rem;
  display: block;
}


/* ── Inline cards ────────────────────────────────────────────── */

.msg-card {
  align-self: flex-start;
  max-width: 645px;
}

.msg-card .card {
  margin: 0;
  font-size: 0.88rem;
  font-family: 'Noto Sans', sans-serif;
  border: 1.5px solid #1A1A1A;
  background: #F4F1EB;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
  transition: transform 0.2s ease;
}

.msg-card .card.summary {
  background: #F4F1EB;
  border: 1px solid #1A1A1A;
  border-radius: 12px;
  backdrop-filter: blur(4.75px);
}

.msg-card .card:hover {
  transform: translateY(-2px);
}

.msg-card .card header {
  padding: 0.8rem 1.1rem;
  background: transparent;
  border-bottom: 1px solid #1A1A1A;
}

.msg-card .card.summary header {
  background: #FFEB46;
}

.msg-card .card header h4 {
  margin: 0;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: #1A1A1A;
}

.msg-card .card .card-body {
  padding: 0.6rem 1.1rem;
  font-size: 18px;
  line-height: 25px;
  color: #000;
}

.msg-card .card footer {
  padding: 0.5rem 0.8rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.msg-card .card footer button {
  width: 148px;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid #1A1A1A;
  background: #FAE21E;
  backdrop-filter: blur(4.75px);
  font-family: 'Noto Sans', sans-serif;
  font-style: normal;
  font-weight: 600;
  line-height: 26px;
  font-size: 0.9rem;
  color: #1A1A1A;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-card .card footer button:hover {
  background: #ffffff;
  border: 1.5px solid #1A1A1A;
  transform: translateY(-1px);
}


/* ── Metric grid (summary card) ──────────────────────────────── */

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.5rem 0;
}

.metric {
  background: #FAE21E;
  border: 1.5px solid #1A1A1A;
  backdrop-filter: blur(4.75px);
  border-radius: 12px;
  padding: 0.5rem 0.6rem;
  text-align: center;
}

.metric .label {
  font-family: 'Noto Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  color: #1A1A1A;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 26px;
}

.metric .value {
  font-family: 'Noto Sans', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #1A1A1A;
  margin-top: 0.15rem;
  line-height: 26px;
}

.metric .value.highlight {
  color: var(--tawang-blue);
}




/* ── OCR card fields ─────────────────────────────────────────── */

.ocr-fields {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.2rem 0.6rem;
  font-size: 0.82rem;
}

.ocr-fields .field-label {
  color: var(--muted-foreground);
  font-weight: 500;
}

.ocr-fields .field-value {
  font-weight: 600;
}


/* ── Precedent list ──────────────────────────────────────────── */

.precedent-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.precedent-item:last-child {
  border-bottom: none;
}

.precedent-item .case-title {
  font-weight: 600;
  font-size: 0.82rem;
}

.precedent-item .case-meta {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}


/* ── Input Bar ───────────────────────────────────────────────── */

#input-bar {
  padding: 2rem 1.5rem;
  background: transparent;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
}

#input-main-card {
  width: 933px;
  max-width: 98vw;
  height: auto;
  min-height: 323px;
  background: transparent;
  border: none;
  border-radius: 26px;
  backdrop-filter: none;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
  box-shadow: none;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#input-main-card.chat-active {
  min-height: 250px;
  gap: 0.5rem;
  padding: 1rem;
}

.input-container {
  width: 897px;
  max-width: 100%;
  height: 180px;
  background: #F4F1EB;
  border: 1.5px solid #1A1A1A;
  border-radius: 12px;
  backdrop-filter: blur(2px);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s ease;
}

.input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 0.5rem;
}

.actions-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#suggestions-area {
  width: 897px;
  max-width: 100%;
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  width: 100%;
  flex: 1;
}

#msg-input {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  padding: 0.5rem;
  font-family: inherit;
  font-size: 1.05rem;
  color: var(--foreground);
  resize: none;
  outline: none;
  overflow-y: hidden;
}

#msg-input::placeholder {
  color: #6B6B6B;
  font-family: "Noto Sans", sans-serif;
  font-style: normal;
  font-weight: 400;
  line-height: 26px;
  letter-spacing: -0.44px;
}

#msg-input:focus {
  outline: none;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted-foreground);
  transition: all 0.2s;
}

.icon-btn:hover {
  background: #ffffff;
  border: 1.5px solid #1A1A1A;
  border-radius: 50%;
  color: var(--foreground);
}

#btn-send {
  background: #F4F1EB;
  color: #1A1A1A;
  width: 43px;
  height: 43px;
  border-radius: 50%;
  border: 1.5px solid #1A1A1A;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: scale 0.2s;
}

#btn-send:hover {
  scale: 1.05;
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
  padding: 0.3rem 0.6rem;
  background: var(--accent);
  border-radius: 0.5rem;
  font-size: 0.8rem;
  color: var(--accent-foreground);
}


/* ── Analysis dialog ─────────────────────────────────────────── */

#analysis-dialog {
  max-width: 640px;
  width: 95vw;
  max-height: 85dvh;
  border-radius: 12px;
  background: rgba(243, 240, 232, 0.80);
  border: 1.5px solid #1A1A1A;
  backdrop-filter: blur(4.75px);
  box-shadow: none;
  padding: 0;
  overflow: hidden;
}

#analysis-dialog form {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
}

#analysis-dialog header {
  padding: 1.5rem 2rem;
  background: transparent;
  border-bottom: 1px solid #1A1A1A;
}

#analysis-dialog header h3 {
  margin: 0;
  font-family: 'Rajdhani', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: #1A1A1A;
}

#analysis-dialog header p {
  margin: 0.25rem 0 0;
  font-family: "Noto Sans", sans-serif;
  font-size: 0.9rem;
  color: var(--muted-foreground);
}

#analysis-dialog footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #1A1A1A;
  display: flex;
  justify-content: flex-end;
  background: transparent;
}

#analysis-dialog footer button {
  width: 148px;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid #1A1A1A;
  background: #FAE21E;
  backdrop-filter: blur(4.75px);
  font-family: 'Noto Sans', sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 26px;
  color: #1A1A1A;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#analysis-dialog footer button:hover {
  background: #ffffff;
  border: 1.5px solid #1A1A1A;
  transform: translateY(-1px);
}

.analysis-body {
  overflow-y: auto;
  flex: 1;
  font-family: 'Noto Sans', sans-serif;
  font-style: normal;
  font-weight: 500;
  font-size: 18px;
  line-height: 25px;
  color: #000;
  white-space: pre-wrap;
  padding: 1.5rem 2rem;
  max-height: calc(85dvh - 200px);
}


/* ── Chat summary text ───────────────────────────────────────── */

.summary-text {
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}


/* ── Utility ─────────────────────────────────────────────────── */


/* ── Utility ─────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

.text-sm {
  font-size: 0.82rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.text-muted {
  color: var(--muted-foreground);
}

.fw-bold {
  font-weight: 700;
}

@media (min-width: 768px) {
  #chat-thread {
    padding-top: 90px;
  }
}

@media (min-width: 1024px) {
  #chat-thread {
    padding-top: 105px;
  }
}

@media (min-width: 1280px) {
  #chat-thread {
    padding-top: 120px;
  }
}

@media (max-width: 600px) {
  .welcome h2 {
    font-size: 2.5rem;
  }

  .welcome p {
    font-size: 1.1rem;
  }

  .input-container {
    padding: 0.75rem;
  }

  .msg {
    max-width: 90%;
  }
}

.file-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: white;
  border: 1px solid #1A1A1A;
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}

.file-preview svg {
  color: #A7C957;
  stroke: #1a1a1a;
}

#btn-remove-file {
  background: #f5f5f5;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #1a1a1a;
  margin-left: 0.4rem;
  transition: all 0.2s;
}

#btn-remove-file:hover {
  background: #e5e5e5;
  color: #000;
}

.file-preview[hidden] {
  display: none !important;
}