
/* ── DESIGN TOKENS ────────────────────────────────────────── */
:root {
  --color-primary:    #1a1a1a;   /* Genesis dark (left panel) */
  --color-base:       #ffffff;   /* White (right panel) */
  --color-wrap-bg:    #d0d0ce;   /* Outer background */
  --color-eyebrow:    #a6a6a6;   /* "PLEASE LOGIN TO THE" */
  --color-text:       #1a1a1a;
  --color-error-bg:   #ffe6e6;
  --color-error-bdr:  #ff4444;
  --color-error-text: #cc0000;
  --color-success-bg: #e6f4ea;
  --color-success-bdr:#2e7d32;
  --color-success-text:#1b5e20;

  --radius-panel: 0px;
  --header-height: 125px;
}

/* ── GENESIS FONTS ─────────────────────────────────────────*/
@font-face {
  font-family: 'GenesisSansHead';
  src: url('assets/font/GenesisSansHeadGlobal-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'GenesisSansHead';
  src: url('assets/font/GenesisSansHeadGlobal-Light.ttf') format('truetype');
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: 'GenesisSansText';
  src: url('assets/font/GenesisSansTextGlobal-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'GenesisSansText';
  src: url('assets/font/GenesisSansTextGlobal-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--color-wrap-bg);
  color: var(--color-text);
  font-family: 'GenesisSansText', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── HEADER ───────────────────────────────────────────────── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: var(--color-primary);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-inner {
  width: 100%;
  padding: 0 4vw;
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-logo {
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-img {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
}
.logo-text-fallback {
  color: #fff;
  font-family: 'GenesisSansHead', 'Helvetica Neue', Arial, sans-serif;
  font-size: 3.8rem;
  font-weight: 375;
  letter-spacing: 0.01em;
}

/* ── MAIN LAYOUT ──────────────────────────────────────────── */
.portal-main {
  min-height: 100vh;
  padding-top: var(--header-height);
  padding: var(--header-height) 4vw 8vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.split-wrap {
  display: flex;
  width: 100%;
  max-width: 1100px;
  min-height: 520px;
  border-radius: var(--radius-panel);
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
}

/* ── LEFT PANEL ───────────────────────────────────────────── */
.panel-left {
  flex: 1 1 45%;
  background: var(--color-primary);
  display: flex;
  justify-content: center;
  padding: 48px;
  position: relative;
}

.panel-left-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-eyebrow {
  font-family: 'GenesisSansHead', 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--color-eyebrow);
  letter-spacing: 0.05em;
  line-height: 1;
}

.panel-title {
  font-family: 'GenesisSansHead', 'Helvetica Neue', Arial, sans-serif;
  font-size: clamp(2.4rem, 4vw, 3.5rem);
  font-weight: 300;
  line-height: 1;
  color: #ffffff;
  letter-spacing: 0.01em;
}

/* Arrow rule (matches WP original) */
.arrow-rule {
  display: flex;
  align-items: center;
  width: 300px;
  max-width: 100%;
  margin-top: 8px;
}
.arrow-line {
  flex-grow: 1;
  height: 1px;
  background: #ffffff;
}
.arrow-head {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 8px solid #ffffff;
}

/* ── RIGHT PANEL ──────────────────────────────────────────── */
.panel-right {
  flex: 1 1 55%;
  background: var(--color-base);
  display: flex;
  align-items: flex-start;
  padding: 40px 48px;
}

.panel-right-content {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
}

.portal-description {
  font-family: 'GenesisSansText', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.95rem;
  color: var(--color-primary);
  line-height: 1.6;
  margin-bottom: 8px;
}
.portal-description--sub {
  margin-bottom: 24px;
}

/* ── FORM ─────────────────────────────────────────────────── */
.form-message {
  display: none;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  border-radius: 2px;
  line-height: 1.4;
}
.form-message.is-error {
  display: block;
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-bdr);
  color: var(--color-error-text);
}
.form-message.is-success {
  display: block;
  background: var(--color-success-bg);
  border: 1px solid var(--color-success-bdr);
  color: var(--color-success-text);
}

.form-field {
  margin-bottom: 14px;
}

.form-input {
  width: 100%;
  max-width: 300px;
  padding: 12px;
  border: 1px solid #ccc;
  font-size: 1rem;
  font-family: 'GenesisSansText', 'Helvetica Neue', Arial, sans-serif;
  background: #fff;
  color: var(--color-primary);
  border-radius: 0;
  transition: border-color 0.2s;
  outline: none;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--color-primary);
}
.form-input::placeholder { color: #999; }

.btn-login {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  padding: 14px 32px;
  cursor: pointer;
  font-size: 1rem;
  font-family: 'GenesisSansText', 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 0.02em;
  transition: opacity 0.2s;
  margin-top: 4px;
}
.btn-login:hover:not(:disabled) { opacity: 0.85; }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn-login.is-loading .btn-spinner { display: block; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

.portal-help {
  margin-top: 32px;
  text-align: center;
  font-size: 0.85rem;
}
.help-link {
  color: var(--color-primary);
  text-decoration: underline;
  opacity: 0.6;
}
.help-link:hover { opacity: 1; }

/* ── LMS OVERLAY (fullscreen after login) ─────────────────── */
.lms-overlay {
  position: fixed;
  inset: 0;
  z-index: 999998;
  background: #fff;
}
.lms-loading {
  position: absolute;
  inset: 0;
  background: var(--color-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 1;
}
.lms-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.lms-loading-text {
  color: #fff;
  font-family: 'GenesisSansHead', Arial, sans-serif;
  font-size: 1rem;
  letter-spacing: 0.15em;
}
.lms-frame-wrap {
  position: absolute;
  inset: 0;
}
.lms-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .portal-main {
    padding: calc(var(--header-height) + 24px) 0 0;
    align-items: flex-start;
  }

  .split-wrap {
    flex-direction: column;
    border-radius: 0;
    box-shadow: none;
    min-height: auto;
  }

  /* Hide left panel on mobile */
  .panel-left {
    display: none;
  }

  .panel-right {
    flex: 1 1 auto;
    padding: 32px 24px 48px;
    justify-content: center;
  }

  .panel-right-content {
    max-width: 100%;
  }

  .form-input {
    max-width: 100%;
  }

  .btn-login {
    width: 100%;
    justify-content: center;
  }

  .portal-help {
    margin-top: 24px;
  }
}

@media (max-width: 480px) {
  .panel-right {
    padding: 24px 20px 40px;
  }
}

/* ═══════════════════════════════════════════════════════════
   KNOWLEDGE TANK — Floating AI Assistant
   All classes prefixed kt- to avoid any conflicts
   ═══════════════════════════════════════════════════════════ */

/* Floating button */
.kt-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.kt-fab.kt-visible {
  display: flex;
}

.kt-fab.kt-hidden {
  opacity: 0;
  transform: scale(0.85);
  pointer-events: none;
}

.kt-fab-circle {
  width: 56px;
  height: 56px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kt-fab-circle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
}

.kt-fab-circle svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Overlay backdrop */
.kt-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.kt-overlay.kt-open {
  display: flex;
}

/* Chat window */
.kt-window {
  background: var(--color-base);
  width: 100%;
  max-width: 720px;
  height: 82vh;
  max-height: 620px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  animation: kt-appear 0.22s ease;
}

@keyframes kt-appear {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Window header */
.kt-win-header {
  background: var(--color-primary);
  display: flex;
  align-items: stretch;
  flex-shrink: 0;
}

.kt-win-header-body {
  flex: 1;
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
}

.kt-win-eyebrow {
  font-family: 'GenesisSansText', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--color-eyebrow);
}

.kt-win-title {
  font-family: 'GenesisSansHead', 'Helvetica Neue', Arial, sans-serif;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--color-base);
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.kt-win-sub {
  font-family: 'GenesisSansText', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.68rem;
  color: #555;
  letter-spacing: 0.07em;
  margin-top: 2px;
}

.kt-win-close {
  width: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 18px;
  cursor: pointer;
  border-left: 0.5px solid #2a2a2a;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
  font-family: 'GenesisSansText', sans-serif;
}

.kt-win-close:hover {
  color: var(--color-base);
  background: #2a2a2a;
}

/* Messages */
.kt-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  background: #f8f8f8;
  scroll-behavior: smooth;
}

.kt-msg {
  display: flex;
  gap: 10px;
  animation: kt-msg-in 0.2s ease;
}

@keyframes kt-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.kt-msg.kt-user {
  flex-direction: row-reverse;
}

.kt-avatar {
  width: 34px;
  height: 34px;
  background: var(--color-primary);
  color: var(--color-base);
  font-family: 'GenesisSansHead', sans-serif;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.kt-avatar.kt-user-av {
  background: #e8e8e8;
  color: var(--color-primary);
}

.kt-avatar-logo {
  width: 30px;
  height: 30px;
  display: block;
  object-fit: contain;
  object-position: center;
}

.kt-bubble {
  font-family: 'GenesisSansText', 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-base);
  border: 0.5px solid #e0e0e0;
  padding: 0.75rem 1rem;
  max-width: 500px;
}

.kt-msg.kt-user .kt-bubble {
  background: var(--color-primary);
  color: var(--color-base);
  border-color: var(--color-primary);
}

.kt-source {
  font-family: 'GenesisSansText', sans-serif;
  font-size: 0.68rem;
  color: #bbb;
  margin-top: 5px;
  letter-spacing: 0.03em;
}

/* Typing dots */
.kt-typing-dots {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 18px;
  padding: 0 2px;
}

.kt-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #aaa;
  animation: kt-bounce 1.2s infinite;
}

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

@keyframes kt-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-5px); }
}

/* Error bubble */
.kt-bubble.kt-error {
  background: var(--color-error-bg);
  border-color: var(--color-error-bdr);
  color: var(--color-error-text);
}

/* Input row */
.kt-input-row {
  border-top: 1px solid #e8e8e8;
  padding: 0.85rem 1rem;
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--color-base);
  flex-shrink: 0;
}

.kt-input {
  flex: 1;
  border: 1px solid #ccc;
  padding: 0.65rem 0.9rem;
  font-size: 0.875rem;
  font-family: 'GenesisSansText', 'Helvetica Neue', Arial, sans-serif;
  outline: none;
  color: var(--color-text);
  background: var(--color-base);
  border-radius: 0;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

.kt-input:focus {
  border-color: var(--color-primary);
}

.kt-input::placeholder {
  color: #bbb;
}

.kt-send {
  width: 38px;
  height: 38px;
  background: var(--color-primary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.kt-send:hover:not(:disabled) {
  opacity: 0.8;
}

.kt-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.kt-send svg {
  width: 15px;
  height: 15px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kt-disclaimer {
  font-family: 'GenesisSansText', sans-serif;
  font-size: 0.65rem;
  color: #ccc;
  text-align: center;
  padding: 0 1rem 0.6rem;
  letter-spacing: 0.03em;
  background: var(--color-base);
  flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .kt-fab {
    bottom: 1.25rem;
    right: 1.25rem;
  }
  .kt-fab-circle {
    width: 50px;
    height: 50px;
  }
  .kt-window {
    height: 90vh;
    max-height: none;
  }
  .kt-msgs {
    padding: 1rem;
  }
  .kt-win-header-body {
    padding: 1rem 1.25rem;
  }
}

/* ── Knowledge Tank — Mic button ────────────────────────────
   Three states: idle | recording | processing
   All prefixed kt-mic- to avoid conflicts
──────────────────────────────────────────────────────────── */

.kt-mic {
  width: 38px;
  height: 38px;
  background: none;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
}

.kt-mic:hover:not(:disabled) {
  border-color: var(--color-primary);
}

.kt-mic:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.kt-mic svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #888;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s;
}

/* Idle state */
.kt-mic--idle { background: none; border-color: #ccc; }
.kt-mic--idle svg { stroke: #888; }
.kt-mic--idle .kt-mic-icon--idle     { display: block !important; }
.kt-mic--idle .kt-mic-icon--recording  { display: none !important; }
.kt-mic--idle .kt-mic-icon--processing { display: none !important; }

/* Recording state */
.kt-mic--recording { background: #ff4444; border-color: #ff4444; animation: kt-pulse 1.2s infinite; }
.kt-mic--recording svg { stroke: #fff; fill: #fff; }
.kt-mic--recording .kt-mic-icon--idle       { display: none !important; }
.kt-mic--recording .kt-mic-icon--recording  { display: block !important; }
.kt-mic--recording .kt-mic-icon--processing { display: none !important; }

@keyframes kt-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(255, 68, 68, 0); }
}

/* Processing state */
.kt-mic--processing { background: #f5f5f5; border-color: #ddd; }
.kt-mic--processing svg { stroke: #aaa; animation: kt-spin 1s linear infinite; }
.kt-mic--processing .kt-mic-icon--idle       { display: none !important; }
.kt-mic--processing .kt-mic-icon--recording  { display: none !important; }
.kt-mic--processing .kt-mic-icon--processing { display: block !important; }

@keyframes kt-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ── Knowledge Tank — Suggested questions ───────────────────── */
.kt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.kt-suggestion-chip {
  background: none;
  border: 1px solid #d0d0ce;
  color: var(--color-primary);
  font-family: 'GenesisSansText', Arial, sans-serif;
  font-size: 0.72rem;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.kt-suggestion-chip:hover {
  background: var(--color-primary);
  color: var(--color-base);
  border-color: var(--color-primary);
}

/* ── Knowledge Tank — Follow-up chips ───────────────────────── */
.kt-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.kt-followup-chip {
  background: none;
  border: 1px solid #d0d0ce;
  color: #666;
  font-family: 'GenesisSansText', Arial, sans-serif;
  font-size: 0.70rem;
  padding: 4px 9px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  text-align: left;
}

.kt-followup-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* ── Knowledge Tank — Confidence badge ──────────────────────── */
.kt-confidence {
  font-family: 'GenesisSansText', Arial, sans-serif;
  font-size: 0.65rem;
  margin-top: 6px;
  letter-spacing: 0.03em;
}

.kt-confidence--high   { color: #2e7d32; }
.kt-confidence--medium { color: #e65100; }
.kt-confidence--low    { color: #c62828; }

/* ── Knowledge Tank — Comparison Table ──────────────────────── */
.kt-compare-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-family: 'GenesisSansText', Arial, sans-serif;
  font-size: 0.72rem;
}

.kt-compare-table th {
  background: var(--color-primary);
  color: var(--color-base);
  padding: 7px 10px;
  text-align: left;
  font-weight: bold;
  letter-spacing: 0.04em;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.kt-compare-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e8e8e8;
  color: var(--color-primary);
  vertical-align: top;
}

.kt-compare-table tr:nth-child(even) td {
  background: #f8f8f8;
}

.kt-compare-table tr:last-child td {
  border-bottom: none;
}

.kt-compare-table td:first-child {
  font-weight: bold;
  color: #555;
  width: 35%;
}

/* ── Knowledge Tank — Feedback button ───────────────────────── */
.kt-feedback-btn {
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 4px;
  cursor: pointer;
  padding: 4px 6px;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  opacity: 1;
  transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}

.kt-feedback-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #666666;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kt-feedback-btn:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.35);
}

.kt-feedback-btn:hover:not(:disabled) svg {
  stroke: #222222;
}

.kt-feedback-btn:disabled {
  cursor: default;
  opacity: 0.6;
  border-color: rgba(34, 197, 94, 0.4);
}

.kt-feedback-btn:disabled svg {
  stroke: #22c55e;
}

/* Did you mean chip — same style as suggestion chips */
.kt-suggestion-did-you-mean {
  border-color: #d0d0ce;
  color: #555;
}

.kt-suggestion-did-you-mean:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-base);
}

/* Arabic RTL message layout */
.kt-msg[dir="rtl"] {
  flex-direction: row-reverse;
}

.kt-msg[dir="rtl"] .kt-bubble {
  text-align: right;
}

.kt-msg[dir="rtl"] .kt-source,
.kt-msg[dir="rtl"] .kt-confidence,
.kt-msg[dir="rtl"] .kt-followups {
  text-align: right;
  direction: rtl;
}
