:root {
  --navy: #1a2a5e;
  --navy-mid: #243580;
  --navy-light: #2e4099;
  --sky: #e8f0fb;
  --sky-deep: #ccdaf7;
  --accent: #2955c8;
  --accent-hover: #1e3fa0;
  --gold: #f5a623;
  --white: #ffffff;
  --text: #1a2a5e;
  --text-muted: #6b7a99;
  --red: #e53e3e;
  --green: #38a169;
  --border: #c5d3ef;
  --card-shadow: 0 4px 24px rgba(26,42,94,0.10);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Nunito', sans-serif;
  background: linear-gradient(135deg, #e8f0fb 0%, #ccdaf7 100%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0 0 40px 0;
}

.app-wrapper {
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  background: var(--white);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 60px rgba(26,42,94,0.15);
}

/* HEADER */
.header {
  background: #0f4c75;
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-title {
  font-family: 'Poppins', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.header-btn {
  background: none;
  border: none;
  color: var(--white);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.header-btn:hover { background: rgba(255,255,255,0.15); }
.header-btn svg { width: 22px; height: 22px; }

/* USER CARD */
.user-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 20px;
  background: var(--sky);
  border-bottom: 1px solid var(--border);
}
.user-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 3px solid var(--navy-light);
  object-fit: cover;
  background: var(--sky-deep);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: var(--navy);
  font-weight: 700;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-info { flex: 1; }
.user-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  font-family: 'Poppins', sans-serif;
}
.user-id {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  background: var(--sky-deep);
  border: 1px solid var(--border);
  border-radius: 20px;
  display: inline-block;
  padding: 2px 10px;
  margin-top: 3px;
  letter-spacing: 0.5px;
}

/* FORM */
.form-section {
   padding: 20px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.3px;
}

/* Custom Select */
.custom-select-wrapper { position: relative; }
.custom-select {
  width: 100%;
  padding: 10px 40px 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: var(--text);
  appearance: none;
  cursor: pointer;
  transition: border 0.2s, box-shadow 0.2s;
  outline: none;
}
.custom-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41,85,200,0.12);
}
.custom-select option { color: var(--text); }
.select-arrow {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 38px;
  background:#0f4c75;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.select-arrow svg { width: 16px; height: 16px; fill: white; }

/* Textarea */
.repentance-textarea {
  width: 100%;
  min-height: 100px;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: var(--text);
  resize: vertical;
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
  background: var(--white);
}
.repentance-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41,85,200,0.12);
}
.repentance-textarea.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(229,62,62,0.10);
}

/* Save Button */
.save-btn {
  width: 100%;
  padding: 13px;
  background: #0f4c75;
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 5px;
}
.save-btn:hover { background: var(--navy-light); }
.save-btn:active { transform: scale(0.98); }
.save-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,42,94,0.18);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }
.modal-box {
  background: var(--white);
  border: 3px solid var(--navy);
  border-radius: var(--radius);
  padding: 36px 32px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(26,42,94,0.18);
  min-width: 220px;
  max-width: 280px;
  animation: popIn 0.22s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-text {
  font-family: 'Poppins', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.3;
}
.modal-close-btn {
  margin-top: 20px;
  padding: 8px 28px;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}
.modal-close-btn:hover { background: var(--navy-light); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--green);
  color: white;
  padding: 12px 28px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 14px;
  z-index: 2000;
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(56,161,105,0.3);
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* NOTES SECTION */
.notes-section { padding: 4px 0 0; }
.notes-header {
  background: var(--sky);
  border-top: 2px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  font-family: 'Poppins', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  text-align: center;
  font-style: italic;
}
.notes-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.note-card {
  background: var(--sky);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: box-shadow 0.2s;
}
.note-card:hover { box-shadow: var(--card-shadow); }
.note-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.note-ticket {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}
.note-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
}
.note-mentors {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-style: italic;
}
.no-notes {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
}

/* Mentor Multi-Select Dropdown */
.mentor-dropdown-wrapper { position: relative; }

.mentor-input-box {
  min-height: 44px;
  padding: 6px 40px 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  cursor: pointer;
  transition: border 0.2s, box-shadow 0.2s;
  position: relative;
}
.mentor-input-box.open, .mentor-input-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(41,85,200,0.12);
}
.mentor-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--navy);
  color: var(--white);
  border-radius: 20px;
  padding: 3px 10px 3px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mentor-tag-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.mentor-tag-remove:hover { color: var(--white); }
.mentor-search-input {
  border: none;
  outline: none;
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: transparent;
  min-width: 100px;
  flex: 1;
  padding: 2px 4px;
}
.mentor-search-input::placeholder { color: var(--text-muted); }
.mentor-arrow {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 38px;
  background: var(--navy);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.mentor-arrow svg { width: 16px; height: 16px; fill: white; }

.mentor-dropdown-list {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--white);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(26,42,94,0.15);
  z-index: 200;
  max-height: 220px;
  overflow-y: auto;
}
.mentor-dropdown-list.open { display: block; }

.mentor-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: background 0.15s;
  border-bottom: 1px solid var(--sky);
}
.mentor-option:last-child { border-bottom: none; }
.mentor-option:hover { background: var(--sky); }
.mentor-option.selected { background: var(--sky-deep); font-weight: 700; }
.mentor-option .mentor-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}
.mentor-option.selected .mentor-check {
  background: var(--navy);
  border-color: var(--navy);
}
.mentor-option.selected .mentor-check::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid white;
  border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
  display: block;
}
.mentor-no-results {
  padding: 14px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.loading-dots {
  display: inline-flex; gap: 4px; align-items: center;
}
.loading-dots span {
  width: 6px; height: 6px; background: var(--text-muted);
  border-radius: 50%; animation: blink 1.2s infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
  0%,80%,100% { opacity: 0.2; }
  40% { opacity: 1; }
}
/* TAB BAR */
.tab-bar {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--white);
  position: sticky;
  top: 57px;
  z-index: 99;
}
.tab-btn {
  flex: 1;
  padding: 13px;
  border: none;
  background: none;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  letter-spacing: 0.5px;
  transition: color 0.2s, border-color 0.2s;
}
.tab-btn.active {
  color: var(--navy);
  border-bottom-color: var(--navy);
}
.tab-btn:hover {
  color: var(--accent);
}
/* Save button spacing */
.form-section {
  padding-bottom: 24px;
}

/* Note edit styles */
.note-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
}
.note-edit-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
  transition: background 0.15s;
}
.note-edit-btn:hover { background: var(--sky-deep); }
.note-edit-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  color: var(--text);
  resize: vertical;
  outline: none;
  margin-top: 6px;
}
.note-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.note-save-btn {
  padding: 6px 18px;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.note-save-btn:hover { background: var(--navy-light); }
.note-cancel-btn {
  padding: 6px 18px;
  background: none;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
}
.note-cancel-btn:hover { background: var(--sky); }