/* --- style.css --- */
:root {
  --brand: #0a2540;
  --slate-900: #0f172a;
  --slate-300: #cbd5e1;
  --white: #ffffff;
  --accent: #22d3ee;
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.18);
  --shadow-strong: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 6px 18px rgba(0, 0, 0, 0.24);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --transition-fast: 160ms cubic-bezier(0.2, 0.8, 0.2, 1);
  --transition-slow: 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--white);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(135deg, var(--slate-900), var(--brand));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: radial-gradient(circle at 30% 30%, var(--accent), rgba(255, 255, 255, 0.2) 35%, transparent 36%), linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent 50%);
  box-shadow: var(--shadow-soft);
}

.brand h1 {
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
  font-weight: 700;
}

.card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  backdrop-filter: saturate(130%) blur(12px);
  padding: 24px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 16px 0 24px;
}

.step {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-fast);
}

.step.active {
  border-color: rgba(34, 211, 238, 0.7);
  background: rgba(34, 211, 238, 0.1);
  transform: translateY(-1px);
}

.step span:first-child {
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(34, 211, 238, 0.18);
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: var(--white);
  font-size: 12px;
  font-weight: 700;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 900px) {
  .upload-grid {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
  }
}

.dropzone {
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1.5px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
  transition: all var(--transition-fast);
  min-height: 156px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  position: relative;
}

.dropzone-label {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.dropzone:hover {
  border-color: rgba(34, 211, 238, 0.6);
  background: rgba(34, 211, 238, 0.08);
}

.dz-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
}

.dz-sub {
  font-size: 12px;
  color: var(--slate-300);
  margin: 0 0 8px;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 12px;
}

.file-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
}

.file-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  justify-content: center;
}

.action-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: 12px;
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.action-btn.remove {
  background: rgba(255, 80, 80, 0.2);
}

.action-btn.remove:hover {
  background: rgba(255, 80, 80, 0.4);
}

.swap {
  display: grid;
  place-items: center;
}

.swap-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--white);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-soft);
}

.swap-btn:hover {
  transform: translateY(-1px) scale(1.02);
  background: rgba(34, 211, 238, 0.1);
}

.actions {
  text-align: center;
  padding-top: 24px;
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1024px) {
  .results-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.panel {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex-direction: column;
  height: 70vh;
  max-height: 700px;
}

.panel h3 {
  margin: 0;
  padding: 12px 16px;
  font-size: 16px;
  border-bottom: 1px solid var(--glass-border);
  font-weight: 700;
}

.analysis-content,
.chat-log {
  padding: 16px;
  overflow-y: auto;
  flex-grow: 1;
}

.chat {
  padding: 0;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow-soft);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  margin-bottom: 8px;
}

.msg.user {
  margin-left: auto;
  background: rgba(34, 211, 238, 0.15);
  border-color: rgba(34, 211, 238, 0.5);
}

.msg.assistant {
  margin-right: auto;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--slate-300);
  animation: blink 1.3s infinite ease-in-out;
}

.dot:nth-child(2) {
  animation-delay: .15s;
}

.dot:nth-child(3) {
  animation-delay: .3s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.2;
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  border-top: 1px solid var(--glass-border);
  padding: 12px 16px;
}

.textarea-wrap {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  transition: all var(--transition-fast);
}

.textarea-wrap:focus-within {
  border-color: rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
}

textarea {
  width: 100%;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--white);
  resize: none;
  min-height: 24px;
  max-height: 160px;
  font-size: 14px;
  line-height: 1.5;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  border: 1px solid rgba(34, 211, 238, 0.3);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.28), rgba(34, 211, 238, 0.18));
  color: var(--white);
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 12px rgba(34, 211, 238, 0.1);
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: none;
  transform: none;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.6);
  backdrop-filter: blur(8px);
  display: none;
  place-items: center;
  z-index: 50;
}

.overlay.show {
  display: grid;
}

.loader-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-strong);
  min-width: 260px;
  display: grid;
  gap: 12px;
  place-items: center;
}

.loader-title {
  font-size: 14px;
  color: var(--slate-300);
}

.rubik {
  --size: 72px;
  width: var(--size);
  height: var(--size);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}

.cubelet {
  width: 100%;
  height: 100%;
  background: var(--accent);
  border-radius: 6px;
  animation: twist 1.6s infinite ease-in-out;
}

.cubelet:nth-child(odd) {
  animation-delay: .15s;
}

@keyframes twist {
  0%,
  100% {
    transform: scale(0.2);
  }
  50% {
    transform: scale(1.0);
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--transition-slow);
  z-index: 60;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}


/* =============================================== */
/* === STYLES FOR AI-GENERATED ANALYSIS REPORT === */
/* =============================================== */

.analysis-section {
  margin-top: 2rem;
  border-top: 1px solid var(--glass-border);
  padding-top: 1.5rem;
}

.analysis-section:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}

.analysis-section h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--glass-border);
}

.changes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.change-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem;
  transition: background-color var(--transition-fast);
}

.change-card:hover {
    background: rgba(34, 211, 238, 0.1);
}

.change-title {
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.5rem;
}

.change-clause {
  font-size: 0.875rem;
  color: var(--slate-300);
}

.change-clause strong {
  color: #e2e8f0;
}

.proscons {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
}

.proscons summary {
  padding: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.04);
  outline: none;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
}

.proscons summary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.proscons summary::before {
  content: '►';
  margin-right: 0.75rem;
  font-size: 0.7em;
  transition: transform 0.2s ease-in-out;
}

.proscons[open]>summary::before {
  transform: rotate(90deg);
}

.pc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  padding: 1rem;
  background-color: transparent;
  border-top: 1px solid var(--glass-border);
}

.pc-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.pc-col li {
  padding-left: 1.5rem;
  position: relative;
  margin-bottom: 0.5rem;
  color: var(--slate-300);
}

.pc-col:first-child li::before {
  content: '✔';
  color: #4ade80; /* Brighter Green */
  position: absolute;
  left: 0;
}

.pc-col:last-child li::before {
  content: '✖';
  color: #f87171; /* Brighter Red */
  position: absolute;
  left: 0;
}

.pc-col strong {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--white);
}

.legal-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.legal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}

.legal-term {
  font-weight: 600;
  color: var(--white);
}

.legal-status {
  font-size: 0.9rem;
  color: var(--slate-300);
  text-align: right;
  padding-left: 1rem;
}