:root {
  --primary-color: #6f93ff;
  --primary-hover: #5a7cdb;
  --bg-primary: #ffffff;
  --bg-secondary: #f7f8fa;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --border-light: #e6e6e6;
  --radius-md: 12px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f7;
  height: 100vh;
  overflow: hidden;
}

.container {
  display: flex;
  height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 340px;
  background: white;
  padding: 32px 24px;
  overflow-y: auto;
  border-right: 1px solid #e6e6e6;
}

.profile { text-align: center; }

.avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--primary-color);
  margin-bottom: 16px;
}

.profile h1 { margin-bottom: 8px; }

.tagline {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 24px;
}

.profile p,
.profile li {
  color: var(--text-secondary);
  line-height: 1.6;
  text-align: left;
}

.divider { margin: 24px 0; }

.preset-section h3,
.resume-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #888;
}

.preset-questions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preset-btn,
.resume-link {
  background: var(--bg-secondary);
  border: 2px solid var(--border-light);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: 0.2s ease;
  text-align: left;
  font-size: 13px;
  text-decoration: none;
  color: var(--text-primary);
}

.preset-btn:hover,
.resume-link:hover {
  border-color: var(--primary-color);
  background: #edf3ff;
}

.resume-downloads {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-btn-sidebar {
  width: 100%;
  margin-top: 24px;
  padding: 14px;
  border: none;
  border-radius: var(--radius-md);
  background: var(--primary-color);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

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

/* MAIN CHAT */
.main-chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 16px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.chat-window {
  flex: 1;
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  overflow-y: auto;
}

.chat-input-area {
  display: flex;
  gap: 12px;
  background: white;
  padding: 16px;
  border-radius: var(--radius-lg);
}

#userInput {
  flex: 1;
  padding: 14px 18px;
  font-size: 15px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border-light);
  font-family: inherit;
  text-indent: 0;
  overflow-x: hidden;
  white-space: nowrap;
}

#userInput:focus {
  outline: none;
  border-color: var(--primary-color);
}

#sendBtn,
.util-btn {
  border: none;
  background: var(--primary-color);
  color: white;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

#sendBtn:hover,
.util-btn:hover { background: var(--primary-hover); }

#sendBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* CHAT BUBBLES */
.message-wrapper {
  display: flex;
  margin-bottom: 16px;
}

.message-wrapper.user { justify-content: flex-end; }
.message-wrapper.bot { justify-content: flex-start; }

.bubble {
  max-width: 75%;
  padding: 14px 18px;
  border-radius: 16px;
  line-height: 1.6;
  font-size: 15px;
}

.bubble.user { background: #dfeaff; color: var(--text-primary); }
.bubble.bot { background: #f3f4f6; color: var(--text-primary); }

.bubble.bot p { margin: 0 0 12px 0; }
.bubble.bot p:last-child { margin-bottom: 0; }
.bubble.bot strong { color: var(--text-primary); font-weight: 600; }
.bubble.bot a { color: var(--primary-color); text-decoration: underline; }
.bubble.bot a:hover { color: var(--primary-hover); }
.bubble.bot br { display: block; content: ""; margin-top: 4px; }

/* TYPING INDICATOR */
.bubble.typing {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 16px 20px;
  min-width: 60px;
}

.bubble.typing span {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aab;
  animation: bounce 1.2s infinite ease-in-out;
}

.bubble.typing span:nth-child(1) { animation-delay: 0s; }
.bubble.typing span:nth-child(2) { animation-delay: 0.2s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* MODAL */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}

.modal-content {
  background: white;
  width: 90%;
  max-width: 500px;
  margin: 5% auto;
  padding: 32px;
  border-radius: var(--radius-lg);
}

.close {
  float: right;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-secondary);
}

.close:hover { color: var(--text-primary); }

.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border-light);
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-primary,
.btn-secondary {
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  transition: background 0.2s ease;
}

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

.btn-secondary { background: #ececec; color: var(--text-primary); }
.btn-secondary:hover { background: #ddd; }

/* MOBILE TOGGLE BUTTON */
.mobile-toggle {
  display: none;
  background: none;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
  width: 100%;
  text-align: left;
}

.visually-hidden {
  position: absolute;
  left: -9999px;
}

/* ── MOBILE ── */
@media (max-width: 900px) {

  body { overflow: auto; }

  .container { flex-direction: column; }

  .sidebar {
    width: 100%;
    padding: 16px 20px;
  }

  .mobile-toggle {
    display: block;
    margin-bottom: 16px;
  }

  /* Everything hidden when collapsed */
  .sidebar.collapsed .preset-section,
  .sidebar.collapsed .resume-section,
  .sidebar.collapsed .portfolio-section,
  .sidebar.collapsed .nav-links-section,
  .sidebar.collapsed .sidebar-contact,
  .sidebar.collapsed ul,
  .sidebar.collapsed p,
  .sidebar.collapsed .divider,
  .sidebar.collapsed .profile {
    display: none;
  }

  /* When expanded, show everything */
  .sidebar:not(.collapsed) .preset-section,
  .sidebar:not(.collapsed) .resume-section,
  .sidebar:not(.collapsed) .portfolio-section,
  .sidebar:not(.collapsed) .nav-links-section,
  .sidebar:not(.collapsed) .sidebar-contact,
  .sidebar:not(.collapsed) ul,
  .sidebar:not(.collapsed) p,
  .sidebar:not(.collapsed) .divider,
  .sidebar:not(.collapsed) .profile {
    display: block;
  }

  .sidebar:not(.collapsed) .preset-questions,
  .sidebar:not(.collapsed) .resume-downloads,
  .sidebar:not(.collapsed) .portfolio-grid {
    display: flex;
  }

  /* Chat area */
  .main-chat-area {
    padding: 12px;
    gap: 10px;
    min-height: 70vh;
  }

  .chat-window {
    padding: 16px;
    max-height: 55vh;
    overflow-y: auto;
  }

  /* Sticky input */
  .chat-input-area {
    position: sticky;
    bottom: 0;
    z-index: 10;
    padding: 12px;
    gap: 8px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  }

  /* Prevent iOS zoom on input focus */
  #userInput {
    font-size: 16px;
    padding: 12px 14px;
  }

  #sendBtn {
    padding: 12px 16px;
    font-size: 14px;
  }

  .bubble {
    max-width: 95%;
    font-size: 14px;
  }

  /* Modal */
  .modal-content {
    width: 95%;
    margin: 10px auto;
    padding: 20px;
    max-height: 90vh;
    overflow-y: auto;
  }

  .chat-title { font-size: 16px; }

  .util-btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Avatar */
  .avatar {
    width: 80px;
    height: 80px;
  }

  .profile h1 { font-size: 1.2rem; }

  .tagline {
    font-size: 0.85rem;
    margin-bottom: 16px;
  }
}

/* ── PORTFOLIO SECTION (sidebar nav cards on the chat homepage) ── */
.portfolio-section { margin-top: 0; }
.portfolio-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: inherit;
}
.portfolio-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.portfolio-item {
  display: block;
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.09);
  border-left: 3px solid transparent;
  border-radius: 8px;
  padding: 10px 13px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
  min-height: 44px;
}
.portfolio-item:hover {
  background: rgba(91,127,232,0.06);
  border-left-color: #5b7fe8;
  border-color: rgba(91,127,232,0.2);
}
.portfolio-item-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 2px;
  line-height: 1.3;
}
.portfolio-item-tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #5b7fe8;
  margin-bottom: 3px;
}
.portfolio-item-desc {
  font-size: 0.72rem;
  color: #666;
  line-height: 1.4;
}
.portfolio-item-arrow {
  font-size: 0.7rem;
  color: #5b7fe8;
  margin-top: 4px;
  display: block;
  font-weight: 600;
}

/* ── NAV LINKS ── */
.nav-links-section { margin-top: 0; }
.nav-links-section h3 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: inherit;
}
.nav-link-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #1a1a1a;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  min-height: 44px;
}
.nav-link-item:hover {
  background: rgba(91,127,232,0.06);
  border-color: rgba(91,127,232,0.2);
  color: #5b7fe8;
}
.nav-link-icon {
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ── WELCOME MESSAGE ── */
.welcome-message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 20px;
  margin: 16px;
  background: #f7f9ff;
  border: 1px solid #e0e8f5;
  border-radius: 10px;
}
.welcome-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #5b7fe8;
}
.welcome-text {
  font-size: 0.87rem;
  color: #3a3a4a;
  line-height: 1.6;
}

/* ── SUGGESTION CHIPS ── */
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
}
.chip {
  background: #fff;
  border: 1px solid #d8dfe8;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.75rem;
  color: #3a3a4a;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.chip:hover {
  background: #5b7fe8;
  border-color: #5b7fe8;
  color: #fff;
}

/* ── TAGLINE ── */
.tagline-updated {
  font-size: 0.78rem;
  color: #888;
  text-align: center;
  line-height: 1.5;
  margin-bottom: 10px;
  letter-spacing: 0.1px;
}

/* ── MOBILE ── */
@media (max-width: 640px) {
  .chip { font-size: 0.72rem; padding: 5px 12px; }
  .welcome-message { margin: 10px; padding: 12px 14px; }
  .suggestion-chips { padding: 0 10px 10px; }
}
