
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Patrick+Hand&display=swap');

:root {
  --bg: #f7f8fc;
  --white: #ffffff;
  --text: #202438;
  --muted: #858ba0;
  --border: #e9ebf2;
  --purple: #8171e9;
  --purple-light: #f0edff;
  --blue: #78a8ed;
  --green: #56b99b;
  --shadow: 0 5px 24px rgba(35, 42, 75, 0.055);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

button {
  font: inherit;
  cursor: pointer;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  width: 245px;
  min-width: 245px;
  background: white;
  border-right: 1px solid var(--border);
  padding: 27px 18px;
  display: flex;
  flex-direction: column;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 5px 35px;
}

.brand-icon {
  width: 39px;
  height: 39px;
  background: linear-gradient(135deg, #a99bf9, #7869dc);
  color: white;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 23px;
  box-shadow: 0 5px 12px #8171e933;
}

.brand h2 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.brand span {
  font-size: 9px;
  letter-spacing: 1.4px;
  color: var(--muted);
}

.new-btn {
  background: var(--purple);
  color: white;
  border: 0;
  padding: 13px;
  border-radius: 11px;
  font-weight: 700;
  box-shadow: 0 5px 12px #8171e933;
  transition: 0.2s;
}

.new-btn:hover {
  background: #6e5dd6;
  transform: translateY(-2px);
}

.new-btn span {
  font-size: 19px;
  margin-right: 7px;
}

.side-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #a1a5b4;
  margin: 30px 8px 12px;
}

.side-link, .subject {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  padding: 11px 12px;
  width: 100%;
  text-align: left;
  border-radius: 9px;
  font-size: 13px;
  color: #62697d;
  margin-bottom: 5px;
}

.side-link span {
  font-size: 18px;
}

.side-link:hover, .subject:hover {
  background: #f7f6ff;
}

.side-link.active {
  color: var(--purple);
  background: var(--purple-light);
  font-weight: 700;
}

.subject-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.biology { background: #6fc5a2; }
.physics { background: #77a8ef; }
.chemistry { background: #edaa73; }
.maths { background: #aa91e9; }
.other { background: #e6a0bb; }

.sidebar-bottom {
  margin-top: auto;
}

.profile {
  border-top: 1px solid var(--border);
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  background: #f0edff;
  color: var(--purple);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.profile strong {
  font-size: 11px;
  display: block;
}

.profile small {
  font-size: 10px;
  color: var(--muted);
}

/* MAIN */

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  height: 70px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
}

.breadcrumb {
  font-size: 12px;
  color: var(--muted);
}

.breadcrumb span {
  margin: 0 8px;
  color: #c5c7d1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #7b8395;
}

.online-dot {
  height: 8px;
  width: 8px;
  border-radius: 50%;
  background: #54c69d;
}

.mobile-menu {
  display: none !important;
}

.workspace {
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 23px;
  max-width: 1800px;
  margin: auto;
}

/* BOARD */

.board-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 10px;
}

.eyebrow {
  font-size: 10px;
  letter-spacing: 1.8px;
  color: var(--purple);
  font-weight: 800;
  margin-bottom: 7px;
}

.board-heading h1 {
  font-size: 25px;
  letter-spacing: -0.8px;
}

.board-heading p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.export-btn {
  border: 1px solid var(--border);
  background: white;
  color: #5f6579;
  padding: 10px 13px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.export-btn:hover {
  border-color: var(--purple);
  color: var(--purple);
}

.board-card {
  border: 1px solid var(--border);
  border-radius: 15px;
  background: white;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.board-toolbar {
  height: 53px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
}

.tool-group {
  display: flex;
  gap: 5px;
}

.tool, .board-zoom button {
  border: 0;
  background: white;
  color: #737b8d;
  border-radius: 7px;
  width: 31px;
  height: 31px;
  font-size: 16px;
}

.tool:hover, .tool.active {
  background: var(--purple-light);
  color: var(--purple);
}

.board-zoom {
  display: flex;
  align-items: center;
  gap: 5px;
}

.board-zoom span {
  font-size: 10px;
  color: #737b8d;
  min-width: 39px;
  text-align: center;
}

.board-canvas {
  height: 570px;
  position: relative;
  overflow: auto;
  background: #fff;
  touch-action: pan-x pan-y;
}

.board-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(#e3e6f0 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
}

#whiteboard {
  position: relative;
  display: block;
  width: 100%;
  min-width: 500px;
  height: 100%;
  min-height: 400px;
  z-index: 1;
  transform-origin: top left;
  overflow: visible;
}

#drawLayer {
  pointer-events: none;
}

#drawLayer path {
  pointer-events: stroke;
  cursor: pointer;
}

.board-empty {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: 80%;
  max-width: 360px;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.empty-icon {
  font-size: 35px;
  color: #a194f0;
  margin-bottom: 10px;
}

.board-empty h3 {
  font-size: 17px;
  margin-bottom: 9px;
}

.board-empty p {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.board-empty span {
  display: inline-block;
  margin-top: 16px;
  font-size: 10px;
  color: var(--purple);
  background: var(--purple-light);
  padding: 9px 12px;
  border-radius: 20px;
}

.board-footer {
  border-top: 1px solid var(--border);
  padding: 12px 15px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
}

.board-tip {
  display: flex;
  gap: 10px;
  padding: 14px;
  margin-top: 14px;
  background: #f0edff;
  border-radius: 10px;
  color: #7065b5;
  font-size: 11px;
  line-height: 1.6;
}

/* AI PANEL */

.tutor-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 700px;
  max-height: calc(100vh - 130px);
  position: sticky;
  top: 15px;
}

.tutor-header {
  height: 72px;
  min-height: 72px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 13px;
  gap: 11px;
}

.tutor-avatar {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #a99bf9, #7869dc);
  color: white;
  border-radius: 12px;
  font-size: 22px;
}

.tutor-header h3 {
  font-size: 13px;
}

.tutor-header span {
  font-size: 10px;
  color: var(--green);
}

.tutor-header span i {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: 50%;
  margin-right: 4px;
}

.icon-btn {
  border: 0;
  background: transparent;
  margin-left: auto;
  color: #8a90a1;
  font-size: 17px;
  padding: 6px;
}

.icon-btn:hover {
  color: var(--purple);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
}

.welcome-message {
  text-align: center;
  margin: 48px 5px 24px;
}

.welcome-star {
  color: var(--purple);
  font-size: 29px;
  margin-bottom: 14px;
}

.welcome-message h2 {
  font-size: 18px;
  letter-spacing: -0.5px;
  margin-bottom: 9px;
}

.welcome-message p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.suggestions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggestion {
  border: 1px solid var(--border);
  background: white;
  color: #656d82;
  text-align: left;
  padding: 11px;
  border-radius: 9px;
  font-size: 11px;
  transition: 0.2s;
}

.suggestion:hover {
  border-color: #a99bf9;
  background: #faf9ff;
  color: var(--purple);
}

/* CHAT BUBBLES */

.message {
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.message.user {
  align-items: flex-end;
}

.message-label {
  font-size: 9px;
  color: #999fb0;
}

.message-bubble {
  max-width: 92%;
  padding: 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.message.user .message-bubble {
  background: var(--purple-light);
  color: #5146a0;
  border-bottom-right-radius: 3px;
}

.message.ai .message-bubble {
  background: #f6f7fa;
  color: #454c60;
  border-bottom-left-radius: 3px;
}

.message-bubble strong {
  font-weight: 700;
}

.message-bubble ul {
  padding-left: 17px;
  margin: 7px 0;
}

.typing {
  color: var(--purple);
  font-size: 11px;
  padding: 10px;
}

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 13px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.upload-btn {
  background: #f4f2ff;
  border: 0;
  color: var(--purple);
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 10px;
  font-weight: 700;
}

.upload-row span {
  color: #a0a5b3;
  font-size: 9px;
}

.attachment-preview {
  margin: 0 13px 10px;
  background: #f4f2ff;
  color: #685bc1;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.attachment-preview[hidden] {
  display: none;
}

.attachment-preview button {
  border: 0;
  background: none;
  color: inherit;
  font-size: 17px;
}

.input-box {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 9px;
  display: flex;
  align-items: flex-end;
  gap: 7px;
  transition: 0.2s;
}

.input-box:focus-within {
  border-color: #a99bf9;
  box-shadow: 0 0 0 3px #8171e915;
}

.input-box textarea {
  border: 0;
  outline: 0;
  resize: none;
  width: 100%;
  font: inherit;
  font-size: 11px;
  color: var(--text);
  padding: 5px;
  max-height: 100px;
}

.input-box textarea::placeholder {
  color: #a0a5b3;
}

.send-btn {
  border: 0;
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 9px;
  background: var(--purple);
  color: white;
  font-size: 20px;
  transition: 0.2s;
}

.send-btn:hover {
  background: #6b5bd3;
  transform: translateY(-2px);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.input-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 9px;
  color: #a2a6b4;
}

/* TOAST */

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 20px);
  opacity: 0;
  background: #292d3c;
  color: white;
  padding: 11px 18px;
  border-radius: 9px;
  font-size: 11px;
  transition: 0.25s;
  pointer-events: none;
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* SMALL SCREENS */

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 310px;
    padding: 18px;
  }

  .board-canvas {
    height: 500px;
  }
}

@media (max-width: 800px) {
  .sidebar {
    position: fixed;
    z-index: 20;
    left: -260px;
    top: 0;
    bottom: 0;
    transition: 0.25s;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-menu {
    display: block !important;
    margin-right: 12px;
  }

  .topbar {
    padding: 0 15px;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .tutor-panel {
    position: relative;
    top: 0;
    min-height: 580px;
    max-height: 700px;
  }

  .board-canvas {
    height: 460px;
  }
}

@media (max-width: 480px) {
  .board-heading h1 {
    font-size: 20px;
  }

  .export-btn {
    font-size: 9px;
    padding: 9px;
  }

  .board-canvas {
    height: 370px;
  }

  .board-footer {
    font-size: 9px;
  }
}

/* WHITEBOARD DRAWING STYLES */

.handwritten {
  font-family: 'Patrick Hand', cursive;
}

.board-text {
  font-family: 'DM Sans', sans-serif;
  fill: #30374c;
}

.ai-shape {
  stroke-linejoin: round;
  stroke-linecap: round;
}

#whiteboard text {
  user-select: none;
}

#whiteboard .free-drawing {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}
