/* css/ai-request.css — AI Request Chat + Live Form Layout
   Feature: ai-request-chat | To remove: delete this file */

/* ── Layout: Side by Side ────────────────────────────────────────────────── */

.ai-request-layout {
  display: flex;
  height: calc(100vh - 118px); /* viewport minus header */
  overflow: hidden;
}

/* ── Auth Gate ────────────────────────────────────────────────────────────── */

.auth-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 118px);
  padding: 40px 20px;
}

.auth-gate-inner {
  text-align: center;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  padding: 48px 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.auth-gate-inner h2 {
  color: #1d3557;
  margin-bottom: 8px;
}

.auth-gate-inner p {
  color: #64748b;
  margin-bottom: 24px;
}

.auth-gate-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

/* ── Chat Panel (Left) ───────────────────────────────────────────────────── */

.chat-panel {
  flex: 0 0 55%;
  display: flex;
  flex-direction: column;
  background: #f8f9fb;
  border-right: 1px solid #e2e8f0;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.chat-header-icon {
  font-size: 1.75rem;
}

.chat-header h2 {
  font-size: 1.1rem;
  color: #1d3557;
  margin: 0;
}

.chat-header-sub {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0;
}

.classic-form-link {
  margin-left: auto;
  font-size: 0.8rem;
  color: #64748b;
  text-decoration: none;
  white-space: nowrap;
}

.classic-form-link:hover {
  color: #1d3557;
}

/* ── Messages ────────────────────────────────────────────────────────────── */

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 0.95rem;
  animation: msgFadeIn 0.25s ease;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-msg.ai {
  align-self: flex-start;
  background: #fff;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-bottom-left-radius: 4px;
}

.chat-msg.user {
  align-self: flex-end;
  background: #1d3557;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}

.chat-typing span {
  width: 8px;
  height: 8px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* ── Suggestions / Quick Replies ─────────────────────────────────────────── */

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 24px;
  min-height: 0;
}

.chat-suggestions:empty {
  display: none;
}

.suggestion-chip {
  padding: 6px 14px;
  background: #fff;
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  color: #4338ca;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.suggestion-chip:hover {
  background: #eef2ff;
  border-color: #818cf8;
}

/* ── Chat Input ──────────────────────────────────────────────────────────── */

.chat-input-area {
  padding: 12px 24px 16px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-upload-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.25rem;
  color: #64748b;
  transition: background 0.15s;
}

.chat-upload-btn:hover {
  background: #f1f5f9;
}

#chat-input {
  flex: 1;
  resize: none;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  line-height: 1.5;
  max-height: 120px;
  overflow-y: auto;
  transition: border-color 0.15s;
}

#chat-input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1d3557;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.chat-send-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.chat-send-btn:not(:disabled):hover {
  background: #15293e;
}

/* Chat image previews */
.chat-image-previews {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.chat-image-previews:empty {
  display: none;
}

.chat-img-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
}

.chat-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat-img-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Form Panel (Right) ──────────────────────────────────────────────────── */

.form-panel {
  flex: 0 0 45%;
  display: flex;
  flex-direction: column;
  background: #fff;
  overflow: hidden;
}

.form-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.form-panel-header h3 {
  font-size: 1.1rem;
  color: #1d3557;
  margin: 0;
}

.form-progress {
  font-size: 0.85rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 4px 12px;
  border-radius: 12px;
}

.form-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 4px 0;
}

/* ── Live Fields ─────────────────────────────────────────────────────────── */

.live-field {
  position: relative;
}

.live-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.required-star {
  color: #e63946;
}

.live-field input,
.live-field select,
.live-field textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1e293b;
  background: #fdfdff;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.live-field input:focus,
.live-field select:focus,
.live-field textarea:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.live-field textarea {
  resize: vertical;
  min-height: 80px;
}

.live-field .char-count {
  font-size: 0.75rem;
  color: #94a3b8;
  text-align: right;
  display: block;
  margin-top: 2px;
}

/* Field highlight animation when AI fills a value */
.field-highlight {
  position: absolute;
  inset: -2px;
  border-radius: 10px;
  border: 2px solid #22c55e;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.live-field.just-filled .field-highlight {
  opacity: 1;
  animation: fieldPulse 1.2s ease-out;
}

@keyframes fieldPulse {
  0%   { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3); }
  50%  { opacity: 1; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
  100% { opacity: 0; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Filled state checkmark */
.live-field.filled label::after {
  content: " \2713";
  color: #22c55e;
  font-weight: 700;
}

/* ── Style Chips ─────────────────────────────────────────────────────────── */

.style-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.style-chip {
  padding: 5px 12px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  font-size: 0.8rem;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.style-chip:hover {
  background: #e2e8f0;
}

.style-chip.selected {
  background: #1d3557;
  color: #fff;
  border-color: #1d3557;
}

/* ── Form Image Previews ─────────────────────────────────────────────────── */

.form-image-previews {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-image-previews:empty::after {
  content: "No images uploaded yet";
  color: #94a3b8;
  font-size: 0.85rem;
  font-style: italic;
}

.form-img-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.form-img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Form Footer / Submit ────────────────────────────────────────────────── */

.form-panel-footer {
  padding: 16px 24px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}

.btn-submit {
  flex: 1;
  padding: 12px 24px;
  background: #1d3557;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-submit:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-submit:not(:disabled):hover {
  background: #15293e;
}

.btn-draft {
  padding: 12px 24px;
  background: transparent;
  color: #64748b;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-draft:hover {
  background: #f1f5f9;
  color: #1d3557;
}

/* ── AI Fallback ─────────────────────────────────────────────────────────── */

.ai-fallback {
  text-align: center;
  padding: 60px 20px;
}

.ai-fallback p {
  color: #64748b;
  margin-bottom: 16px;
  font-size: 1.1rem;
}

/* ── Suspension Banner ───────────────────────────────────────────────────── */

.suspension-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 16px 24px;
  text-align: center;
}

.suspension-banner h3 {
  margin: 0 0 4px;
}

/* ── Mobile Responsive ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .ai-request-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 118px);
  }

  .chat-panel {
    flex: none;
    height: 60vh;
    min-height: 400px;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }

  .form-panel {
    flex: none;
    min-height: 50vh;
  }

  .chat-msg {
    max-width: 90%;
  }

  .classic-form-link {
    display: none;
  }

  .form-panel-footer {
    flex-direction: column;
  }
}

/* ── Utility ─────────────────────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ── Footer (landing-style) ─────────────────────────────────────────────── */

.footer { background-color: #d6dee6; color: #555; padding: 60px 0 30px; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-brand p { color: #8c9ca4; font-size: 0.9rem; line-height: 1.6; margin-top: 12px; }
.footer-brand img { height: 60px; opacity: 0.9; }
.footer-col h4 { color: #fff; font-size: 1rem; margin-bottom: 12px; }
.footer-col a { display: block; color: #8c9ca4; text-decoration: none; font-size: 0.9rem; margin-bottom: 8px; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding-top: 20px; display: flex; justify-content: space-between; align-items: center; }
.footer-bottom p { color: #8c9ca4; font-size: 0.85rem; }
.footer-bottom-links a { color: #8c9ca4; text-decoration: none; margin-left: 16px; font-size: 0.85rem; }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-brand { text-align: center; }
  .footer-brand img { margin: 0 auto; display: block; max-width: 200px; height: auto; }
}
