/*
  NIRMAAN – Mentee Portal Styles
  Extends style.css variables, adds portal-specific components.
*/

/* ── Layout ─────────────────────────────────────── */

.portal-wrap {
  min-height: 100vh;
  padding: 96px 0 80px;
}

.portal-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.portal-container--narrow {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Loading spinner ──────────────────────────────── */

.portal-spinner-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.portal-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(207, 238, 71, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: portal-spin 0.8s linear infinite;
}

@keyframes portal-spin {
  to { transform: rotate(360deg); }
}

/* ── Gate screens (login / access denied) ─────────── */

.portal-gate {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  background: var(--bg);
  z-index: 500;
}

.portal-gate__icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(207, 238, 71, 0.08);
  border: 1px solid rgba(207, 238, 71, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
}

.portal-gate__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.portal-gate__title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.portal-gate__desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.75;
  max-width: 420px;
  margin: 0 auto 32px;
}

.portal-gate__actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── Section headers ──────────────────────────────── */

.portal-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.portal-section-title {
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

/* ── Portal card (glass) ─────────────────────────── */

.portal-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  transition: border-color 0.2s ease;
}

.portal-card--accent {
  border-color: rgba(207, 238, 71, 0.2);
  background: rgba(207, 238, 71, 0.03);
}

/* ── Welcome header ──────────────────────────────── */

.portal-welcome {
  padding: 48px 0 32px;
}

.portal-welcome__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 16px;
  border: 1px solid rgba(207, 238, 71, 0.35);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 20px;
  background: rgba(207, 238, 71, 0.05);
}

.portal-welcome__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.portal-welcome__title {
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.portal-welcome__sub {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Profile card ────────────────────────────────── */

.profile-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
}

.profile-card__info {}

.profile-card__startup {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.profile-card__bio {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

.profile-card__meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.stage-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(207, 238, 71, 0.1);
  border: 1px solid rgba(207, 238, 71, 0.3);
  color: var(--accent);
}

.stage-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.profile-card__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

/* Profile edit mode */
.profile-edit-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.portal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.portal-field label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.portal-input,
.portal-textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}

.portal-input:focus,
.portal-textarea:focus {
  border-color: rgba(207, 238, 71, 0.4);
}

.portal-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

.portal-select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  width: 100%;
  cursor: pointer;
  transition: border-color 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239e9e9a' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.portal-select:focus {
  border-color: rgba(207, 238, 71, 0.4);
}

.portal-select option {
  background: #1a1a18;
  color: var(--text);
}

/* ── Progress Tracker ────────────────────────────── */

.progress-tracker {
  padding: 32px 0 8px;
  overflow-x: auto;
}

.progress-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-width: 560px;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
}

.progress-step::before {
  content: '';
  position: absolute;
  top: 15px;
  left: calc(-50% + 15px);
  right: calc(50% + 15px);
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.progress-step:first-child::before {
  display: none;
}

.progress-step--done::before {
  background: var(--accent);
}

.progress-step--current::before {
  background: linear-gradient(90deg, var(--accent), rgba(207,238,71,0.3));
}

.progress-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.progress-step--done .progress-dot {
  background: var(--accent);
  border-color: var(--accent);
}

.progress-step--current .progress-dot {
  background: rgba(207, 238, 71, 0.15);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(207, 238, 71, 0.12);
}

.progress-dot svg {
  opacity: 0;
}

.progress-step--done .progress-dot svg {
  opacity: 1;
}

.progress-step--current .progress-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}

.progress-label {
  margin-top: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
  letter-spacing: 0.02em;
  padding: 0 4px;
}

.progress-step--done .progress-label {
  color: var(--accent);
}

.progress-step--current .progress-label {
  color: var(--text);
  font-weight: 700;
}

/* ── Stage Notes ─────────────────────────────────── */

.stage-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.stage-tab {
  padding: 7px 16px;
  border-radius: 100px;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
}

.stage-tab:hover {
  border-color: rgba(207, 238, 71, 0.3);
  color: var(--text);
}

.stage-tab--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  max-height: 320px;
  overflow-y: auto;
}

.note-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.note-item__content {
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--text);
  flex: 1;
}

.note-item__meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.note-item__delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s, background 0.2s;
}

.note-item__delete:hover {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.08);
}

.notes-empty {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
  font-style: italic;
}

.add-note-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.add-note-row .portal-textarea {
  flex: 1;
  min-height: 60px;
}

/* ── Messaging ───────────────────────────────────── */

.message-thread {
  display: flex;
  flex-direction: column;
  height: 380px;
}

.message-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.msg-bubble-wrap {
  display: flex;
  flex-direction: column;
  max-width: 72%;
}

.msg-bubble-wrap--admin {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-bubble-wrap--mentee {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-bubble {
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.6;
  word-break: break-word;
}

.msg-bubble--admin {
  background: rgba(255, 255, 255, 0.06);
  border-bottom-left-radius: 4px;
  color: var(--text);
}

.msg-bubble--mentee {
  background: rgba(207, 238, 71, 0.15);
  border: 1px solid rgba(207, 238, 71, 0.25);
  border-bottom-right-radius: 4px;
  color: var(--text);
}

.msg-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.msg-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  gap: 8px;
}

.message-compose {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.message-compose .portal-textarea {
  flex: 1;
  min-height: 52px;
  max-height: 120px;
}

.msg-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent);
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  color: #000;
}

.msg-send-btn:hover {
  background: #d9fb57;
  transform: scale(1.05);
}

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

/* ── Admin – Mentee Grid ─────────────────────────── */

.mentee-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.mentee-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  transition: border-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mentee-card:hover {
  border-color: rgba(207, 238, 71, 0.25);
  transform: translateY(-2px);
}

.mentee-card__name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.mentee-card__startup {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.mentee-card__bio {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mentee-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.mentee-card__email {
  font-size: 0.74rem;
  color: var(--text-muted);
}

/* ── Admin Stats Bar ─────────────────────────────── */

.admin-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.admin-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 24px;
  min-width: 140px;
  text-align: center;
}

.admin-stat__number {
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.admin-stat__label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Admin Detail View ───────────────────────────── */

.admin-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 0;
  margin-bottom: 24px;
  font-family: var(--font);
  transition: color 0.2s;
}

.admin-detail-back:hover {
  color: var(--text);
}

.admin-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.admin-detail-grid--full {
  grid-column: 1 / -1;
}

/* ── User Management ─────────────────────────────── */

.user-search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.user-search-row .portal-input {
  flex: 1;
}

.user-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  gap: 12px;
}

.user-search-result__info {}

.user-search-result__name {
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.user-search-result__email {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.current-mentees-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.current-mentee-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: 12px;
  gap: 12px;
}

.current-mentee-row__info {
  flex: 1;
  min-width: 0;
}

.current-mentee-row__name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-mentee-row__startup {
  font-size: 0.75rem;
  color: var(--accent);
}

/* ── Tabs for admin messaging ────────────────────── */

.admin-conv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.admin-conv-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}

.admin-conv-item:hover,
.admin-conv-item--active {
  border-color: rgba(207, 238, 71, 0.3);
  background: rgba(207, 238, 71, 0.05);
}

.admin-conv-item__name {
  font-size: 0.88rem;
  font-weight: 600;
  flex: 1;
}

.admin-conv-item__startup {
  font-size: 0.74rem;
  color: var(--accent);
}

/* ── Toast notification ──────────────────────────── */

.portal-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: #1e1e1c;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.85rem;
  color: var(--text);
  z-index: 9999;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toast-in 0.3s ease;
}

.portal-toast--success {
  border-color: rgba(207, 238, 71, 0.4);
  color: var(--accent);
}

.portal-toast--error {
  border-color: rgba(255, 107, 107, 0.4);
  color: #ff6b6b;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Divider ─────────────────────────────────────── */

.portal-divider {
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* ── Utility ─────────────────────────────────────── */

.portal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.portal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.76rem; }
.fw-700 { font-weight: 700; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ── Responsive ──────────────────────────────────── */

@media (max-width: 767px) {
  .portal-container,
  .portal-container--narrow {
    padding: 0 16px;
  }

  .profile-card {
    grid-template-columns: 1fr;
  }

  .profile-card__actions {
    align-items: flex-start;
    flex-direction: row;
  }

  .admin-detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-stats {
    gap: 10px;
  }

  .admin-stat {
    flex: 1;
    min-width: 110px;
  }

  .portal-wrap {
    padding: 80px 0 60px;
  }

  .mentee-grid {
    grid-template-columns: 1fr;
  }

  .progress-tracker {
    padding-bottom: 16px;
  }

  .add-note-row {
    flex-direction: column;
    align-items: stretch;
  }

  .message-compose {
    gap: 8px;
  }

  .portal-welcome__title {
    font-size: 1.6rem;
  }
}
