/* ============================================================
   Unicorn Versicherungs AG — Corporate Design System
   Primary: #6B21A8 (Deep Purple), Accent: #F59E0B (Gold)
   ============================================================ */

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

:root {
  --primary: #6B21A8;
  --primary-dark: #4C1D95;
  --primary-light: #EDE9FE;
  --primary-mid: #7C3AED;
  --gold: #F59E0B;
  --gold-dark: #D97706;
  --gold-light: #FEF3C7;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --success: #059669;
  --success-light: #D1FAE5;
  --error: #DC2626;
  --error-light: #FEE2E2;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.08), 0 4px 6px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.10), 0 10px 10px rgba(0, 0, 0, 0.04);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.5;
}

/* ============================================================
   SHARED: CORPORATE HEADER
   ============================================================ */

.corp-header {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-mid) 100%);
  color: var(--white);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(76, 29, 149, 0.35);
  position: relative;
  z-index: 100;
  flex-shrink: 0;
}

.corp-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--gold) 0%, var(--gold-dark) 100%);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.header-brand-logo {
  font-size: 1.5rem;
  line-height: 1;
}

.header-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.header-brand-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--white);
}

.header-brand-sub {
  font-size: 0.7rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.header-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  padding: 0.3rem 0.875rem 0.3rem 0.5rem;
  font-size: 0.825rem;
  color: var(--white);
  font-weight: 500;
}

.header-user-icon {
  width: 26px;
  height: 26px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--primary-dark);
  font-weight: 700;
  flex-shrink: 0;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-body {
  min-height: 100vh;
  background: linear-gradient(160deg, #F5F3FF 0%, #EDE9FE 40%, #DDD6FE 100%);
  display: flex;
  flex-direction: column;
}

.login-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 420px;
  overflow: hidden;
  border: 1px solid rgba(107, 33, 168, 0.08);
}

.login-card-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 2rem 2rem 1.75rem;
  text-align: center;
  position: relative;
}

.login-card-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold) 0%, #FCD34D 50%, var(--gold) 100%);
}

.login-card-icon {
  font-size: 2.5rem;
  margin-bottom: 0.625rem;
  display: block;
}

.login-card-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.01em;
}

.login-card-subtitle {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 0.25rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.login-card-body {
  padding: 2rem;
}

.login-welcome {
  font-size: 0.875rem;
  color: var(--gray-600);
  margin-bottom: 1.5rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
}

.form-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-md);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.12);
}

.form-input::placeholder {
  color: var(--gray-400);
  font-size: 0.85rem;
}

.form-input-icon-wrap {
  position: relative;
}

.form-input-icon-wrap .form-input {
  padding-left: 2.5rem;
}

.form-input-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 0.95rem;
  pointer-events: none;
}

.btn-primary {
  width: 100%;
  padding: 0.7rem 1.5rem;
  font-size: 0.9375rem;
  font-family: var(--font);
  font-weight: 600;
  color: var(--white);
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 4px 12px rgba(107, 33, 168, 0.3);
  margin-top: 0.5rem;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  box-shadow: 0 6px 16px rgba(107, 33, 168, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(107, 33, 168, 0.3);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-error {
  display: none;
  background: var(--error-light);
  border: 1px solid #FECACA;
  border-left: 3px solid var(--error);
  color: var(--error);
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  margin-top: 0.875rem;
  align-items: center;
  gap: 0.5rem;
}

.login-error.visible {
  display: flex;
}

.login-card-footer {
  padding: 1rem 2rem;
  border-top: 1px solid var(--gray-100);
  text-align: center;
}

.login-help-text {
  font-size: 0.75rem;
  color: var(--gray-400);
}

.login-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* ============================================================
   CHAT PAGE LAYOUT
   ============================================================ */

.chat-body {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--gray-100);
}

/* Sub-header / breadcrumb bar */
.chat-subheader {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0.625rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-subheader-title {
  font-size: 0.8125rem;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chat-subheader-title strong {
  color: var(--gray-700);
  font-weight: 600;
}

.btn-new-trip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.875rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border: 1.5px solid rgba(107, 33, 168, 0.25);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  letter-spacing: 0.01em;
}

.btn-new-trip:hover {
  background: #DDD6FE;
  border-color: rgba(107, 33, 168, 0.45);
  box-shadow: 0 2px 6px rgba(107, 33, 168, 0.12);
}

/* ============================================================
   MESSAGE AREA
   ============================================================ */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

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

.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 99px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

/* Message rows */
.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 820px;
  width: 100%;
}

.msg-row--bot {
  align-self: flex-start;
  margin-right: auto;
}

.msg-row--user {
  align-self: flex-end;
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.msg-avatar--bot {
  background: var(--primary-light);
}

.msg-avatar--user {
  background: var(--gold-light);
}

/* Bubbles */
.msg-bubble {
  padding: 0.625rem 0.9375rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--gray-800);
  position: relative;
}

.msg-bubble--bot {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-bottom-left-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  max-width: 560px;
}

.msg-bubble--user {
  background: linear-gradient(135deg, #EDE9FE, #DDD6FE);
  border: 1px solid rgba(107, 33, 168, 0.15);
  border-bottom-right-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  max-width: 420px;
  color: var(--primary-dark);
}

.msg-time {
  font-size: 0.6875rem;
  color: var(--gray-400);
  margin-top: 0.25rem;
  padding: 0 0.25rem;
}

.msg-row--user .msg-time {
  text-align: right;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.75rem 1rem;
}

.typing-dot {
  width: 7px;
  height: 7px;
  background: var(--gray-400);
  border-radius: 50%;
  animation: typingBounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* ============================================================
   SPECIAL MESSAGE TYPES
   ============================================================ */

/* Summary card */
.msg-summary {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  max-width: 560px;
  width: 100%;
}

.msg-summary-header {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.msg-summary-header-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--white);
}

.msg-summary-header-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 99px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.msg-summary-body {
  padding: 1rem;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.825rem;
}

.summary-table tr {
  border-bottom: 1px solid var(--gray-100);
}

.summary-table tr:last-child {
  border-bottom: none;
}

.summary-table td {
  padding: 0.45rem 0.5rem;
  color: var(--gray-700);
  vertical-align: top;
}

.summary-table td:first-child {
  font-weight: 600;
  color: var(--gray-500);
  width: 40%;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-top: 0.5rem;
}

.summary-table .summary-total-row td {
  padding-top: 0.625rem;
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 0.9rem;
  border-top: 2px solid var(--primary-light);
}

.summary-table .summary-total-row td:first-child {
  text-transform: none;
  font-size: 0.9rem;
}

/* Download button */
.msg-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.125rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 3px 10px rgba(245, 158, 11, 0.35);
  transition: transform 0.1s, box-shadow 0.15s;
  letter-spacing: 0.01em;
}

.msg-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(245, 158, 11, 0.45);
}

.msg-download:active {
  transform: translateY(0);
}

/* Success message */
.msg-success {
  background: var(--success);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  color: var(--white);
  max-width: 560px;
  width: 100%;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

.msg-success-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.msg-success-body {
  font-size: 0.825rem;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
}

/* ============================================================
   CHAT INPUT BAR
   ============================================================ */

.chat-input-bar {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: flex-end;
  gap: 0.625rem;
  flex-shrink: 0;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
}

.chat-input-wrap {
  flex: 1;
  position: relative;
}

.chat-input {
  width: 100%;
  padding: 0.625rem 0.9375rem;
  font-size: 0.9rem;
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-lg);
  resize: none;
  outline: none;
  line-height: 1.5;
  min-height: 44px;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.chat-input:focus {
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(107, 33, 168, 0.1);
}

.chat-input::placeholder {
  color: var(--gray-400);
}

.btn-send {
  height: 44px;
  min-width: 44px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--white);
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 3px 10px rgba(107, 33, 168, 0.3);
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(107, 33, 168, 0.4);
}

.btn-send:active {
  transform: translateY(0);
}

.btn-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ============================================================
   ERROR MESSAGE (in chat)
   ============================================================ */

.msg-error {
  background: var(--error-light);
  border: 1px solid #FECACA;
  border-left: 3px solid var(--error);
  color: var(--error);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  font-size: 0.825rem;
  font-weight: 500;
  max-width: 480px;
}

/* ============================================================
   DATE SEPARATOR
   ============================================================ */

.msg-date-sep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
  align-self: center;
}

.msg-date-sep span {
  font-size: 0.7rem;
  color: var(--gray-400);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--gray-100);
  padding: 0.2rem 0.625rem;
  border-radius: 99px;
}

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

@media (max-width: 640px) {
  .corp-header {
    padding: 0 1rem;
  }

  .chat-messages {
    padding: 1rem 0.75rem;
  }

  .chat-input-bar {
    padding: 0.75rem 1rem;
  }

  .msg-bubble--bot,
  .msg-summary,
  .msg-success {
    max-width: calc(100vw - 80px);
  }

  .msg-bubble--user {
    max-width: calc(100vw - 80px);
  }

  .btn-send span {
    display: none;
  }
}

@media (min-width: 1024px) {
  .chat-messages {
    padding: 1.5rem 2rem;
  }

  .chat-input-bar {
    padding: 1rem 2rem;
  }
}
