/* ==============================================================================
   STYLES - CHATBOT PORTFOLIO YANN GREDER (DESIGN ÉPURÉ & MODERNE)
   ============================================================================== */

:root {
  --bg-color: #f8fafc;
  --panel-bg: #ffffff;
  --panel-border: #f1f5f9;
  
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-glow: rgba(37, 99, 235, 0.12);

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  
  --user-msg-bg: #2563eb;
  --user-msg-text: #ffffff;
  --bot-msg-bg: #f8fafc;
  --bot-msg-border: #e2e8f0;
  --bot-msg-text: #1e293b;

  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  --card-hover-border: #93c5fd;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 4px 15px -2px rgba(15, 23, 42, 0.04), 0 2px 6px -1px rgba(15, 23, 42, 0.02);
  --shadow-main: 0 25px 50px -12px rgba(15, 23, 42, 0.08);
}

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

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.03) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(99, 102, 241, 0.03) 0px, transparent 50%);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.5;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.app-container {
  width: 100%;
  max-width: 860px;
  height: 94vh;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-main);
  position: relative;
  overflow: hidden;
}

/* ==============================================================================
   HEADER ÉPURÉ
   ============================================================================== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--panel-border);
  background: #ffffff;
}

.profile-summary {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar-wrapper {
  position: relative;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-primary);
  border: 2px solid #ffffff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-indicator {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background-color: #10b981;
  border: 2.5px solid #ffffff;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.name-badge-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.name-badge-row h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.badge-role {
  font-size: 0.74rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent-primary);
  padding: 3px 10px;
  border-radius: 999px;
}

.tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--accent-primary);
  background: var(--accent-soft);
}

/* ==============================================================================
   CHAT CONTAINER
   ============================================================================== */
.chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  scroll-behavior: smooth;
}

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

.chat-container::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 4px;
}

/* ==============================================================================
   WELCOME HERO SCREEN
   ============================================================================== */
.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: auto 0;
  padding: 20px 10px;
  animation: fadeIn 0.4s ease-out;
}

.hero-title {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-main);
  margin-bottom: 22px;
  max-width: 620px;
  line-height: 1.3;
}

.hero-avatar-wrapper {
  position: relative;
  margin-bottom: 22px;
}

.hero-avatar {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid #ffffff;
  box-shadow: 0 16px 36px rgba(37, 99, 235, 0.18), 0 4px 14px rgba(0, 0, 0, 0.06);
  transition: transform 0.3s ease;
}

.hero-avatar:hover {
  transform: scale(1.03);
}

.hero-badge {
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-primary);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.35);
  letter-spacing: 0.02em;
}

.hero-description-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 580px;
  margin-bottom: 28px;
}

.hero-role {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.hero-cta {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* 2x2 PROMPT CARDS GRID */
.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 640px;
}

.prompt-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
}

.prompt-card:hover {
  border-color: var(--card-hover-border);
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.card-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.card-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-content strong {
  font-size: 0.84rem;
  color: var(--text-main);
  font-weight: 600;
}

.card-content small {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==============================================================================
   MESSAGES LIST
   ============================================================================== */
#messages-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.message-row {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row.user-row {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message-row.bot-row {
  align-self: flex-start;
}

.msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-row .msg-avatar {
  background: #1e293b;
  color: #ffffff;
}

.bubble {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.6;
  position: relative;
  word-break: break-word;
}

.user-row .bubble {
  background: var(--user-msg-bg);
  color: var(--user-msg-text);
  border-top-right-radius: 4px;
}

.bot-row .bubble {
  background: var(--bot-msg-bg);
  border: 1px solid var(--bot-msg-border);
  color: var(--bot-msg-text);
  border-top-left-radius: 4px;
}

.bubble p {
  margin-bottom: 8px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

.bubble ul {
  margin-left: 20px;
  margin-bottom: 8px;
}

.bubble li {
  margin-bottom: 4px;
}

.bubble strong {
  color: #0f172a;
  font-weight: 600;
}

.user-row .bubble strong {
  color: #ffffff;
}

.bubble a {
  color: #2563eb;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.bubble a:hover {
  color: #1d4ed8;
  opacity: 0.85;
}

/* TABLE STYLING */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin: 10px 0;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.bubble table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: left;
  background: #ffffff;
}

.bubble th {
  background: #f8fafc;
  color: #1e293b;
  font-weight: 700;
  padding: 8px 12px;
  border-bottom: 2px solid #cbd5e1;
  white-space: nowrap;
}

.bubble td {
  padding: 8px 12px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  vertical-align: top;
  line-height: 1.45;
}

.bubble tr:nth-child(even) td {
  background: #fbfcfe;
}

.bubble tr:last-child td {
  border-bottom: none;
}

/* TYPING INDICATOR */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

/* ==============================================================================
   FLOATING INPUT BAR
   ============================================================================== */
.input-area {
  padding: 14px 24px 16px;
  background: #ffffff;
  border-top: 1px solid var(--panel-border);
}

.input-form {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 8px 6px 18px;
  gap: 10px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.input-form:focus-within {
  background: #ffffff;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-form textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.92rem;
  resize: none;
  max-height: 100px;
  padding: 6px 0;
}

.input-form textarea::placeholder {
  color: var(--text-dim);
}

.send-btn {
  background: var(--accent-primary);
  border: none;
  color: #ffffff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.send-btn:hover {
  background: var(--accent-primary-hover);
  transform: scale(1.05);
}

.send-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
}

.input-footer-note {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 6px;
}

/* ==============================================================================
   MODAL
   ============================================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 460px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.84rem;
  color: var(--text-main);
}

.form-control {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.88rem;
  outline: none;
}

.form-control:focus {
  background: #ffffff;
  border-color: var(--accent-primary);
}

.info-box {
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.15);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: #1e40af;
  line-height: 1.4;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--accent-primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary:hover {
  background: var(--accent-primary-hover);
}

/* RESPONSIVE */
@media (max-width: 640px) {
  body {
    padding: 0;
  }
  .app-container {
    height: 100vh;
    border-radius: 0;
    border: none;
  }
  .prompt-grid {
    grid-template-columns: 1fr;
  }
  .message-row {
    max-width: 95%;
  }
}
