/* ========================================
   Portal & Auth — Styles
   Extends the Quiet Authority design system.
   ======================================== */

/* ---- AUTH PAGES ---- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  display: block;
  margin-bottom: 2.5rem;
}

.auth-container h1 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.auth-container > p {
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.auth-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--error);
  font-size: 0.88rem;
  padding: 0.75rem 1rem;
  border-radius: 3px;
  margin-bottom: 1.5rem;
}

.auth-form .form-group {
  margin-bottom: 1.25rem;
}

.auth-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.auth-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  transition: border-color 0.3s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.auth-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.auth-footer p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: none;
}

.auth-footer a {
  color: var(--accent);
  font-weight: 500;
}

/* Password Requirements */
.password-requirements {
  margin-top: 0.75rem;
}

.requirement {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-light);
  padding: 0.2rem 0;
  transition: color 0.2s;
}

.req-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
  transition: all 0.2s;
  position: relative;
}

.requirement.met {
  color: var(--success);
}

.requirement.met .req-icon {
  background: var(--success);
  border-color: var(--success);
}

.requirement.met .req-icon::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 2px;
  width: 5px;
  height: 8px;
  border: solid white;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

/* ---- PORTAL PAGES ---- */

.portal-page {
  min-height: 100vh;
  padding: 3rem 1.5rem;
}

.portal-container {
  max-width: 900px;
  margin: 0 auto;
}

.portal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.portal-header h4 {
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.portal-header h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin-bottom: 0.25rem;
}

.portal-header p {
  font-size: 0.95rem;
}

.back-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.75rem;
  transition: color 0.3s;
}

.back-link:hover {
  color: var(--accent);
}

/* ---- PROJECT CARDS ---- */

.projects-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.project-card {
  padding: 2rem 2.5rem;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: border-color 0.3s;
}

.project-card:hover {
  border-color: var(--accent);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.project-header h3 {
  font-size: 1.25rem;
  margin-bottom: 0.3rem;
}

.project-id-tag {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: rgba(43, 58, 46, 0.08);
  padding: 0.2rem 0.6rem;
  border-radius: 2px;
}

.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: white;
  padding: 0.3rem 0.75rem;
  border-radius: 2px;
  white-space: nowrap;
}

/* ---- PROJECT TIMELINE ---- */

.project-timeline {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.timeline-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  min-width: 0;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--bg);
  margin-bottom: 0.4rem;
  position: relative;
  z-index: 1;
  transition: all 0.3s;
}

.timeline-step.completed .timeline-dot {
  background: var(--accent);
  border-color: var(--accent);
}

.timeline-step.active .timeline-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43, 58, 46, 0.2);
}

.timeline-step::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.timeline-step:first-child::before {
  left: 50%;
}

.timeline-step:last-child::before {
  right: 50%;
}

.timeline-step.completed::before,
.timeline-step.active::before {
  background: var(--accent);
}

.timeline-label {
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.timeline-step.active .timeline-label {
  color: var(--accent);
  font-weight: 600;
}

.timeline-step.completed .timeline-label {
  color: var(--text-muted);
}

.project-timeline-detail {
  padding: 1rem 0;
}

.project-timeline-detail .timeline-label {
  font-size: 0.68rem;
}

/* ---- PROJECT ACTIONS ---- */

.project-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* ---- PROJECT SECTIONS ---- */

.project-section {
  margin-bottom: 2.5rem;
  padding-top: 1.5rem;
}

.project-section h2 {
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* ---- MESSAGES ---- */

.messages-container {
  max-height: 500px;
  overflow-y: auto;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-alt);
  border-radius: 4px;
}

.no-messages {
  color: var(--text-light);
  font-size: 0.9rem;
  text-align: center;
  padding: 2rem;
}

.message {
  margin-bottom: 1rem;
  padding: 1rem 1.25rem;
  border-radius: 4px;
  background: var(--white);
  border: 1px solid var(--border);
}

.message:last-child {
  margin-bottom: 0;
}

.message-admin {
  border-left: 3px solid var(--accent);
}

.message-client {
  border-left: 3px solid var(--border);
}

.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.message-meta strong {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.message-meta time {
  font-size: 0.72rem;
  color: var(--text-light);
}

.message-body {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.message-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-form textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--white);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  min-height: 80px;
  resize: vertical;
  transition: border-color 0.3s;
}

.message-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.message-form .btn {
  align-self: flex-end;
}

/* ---- FILES PLACEHOLDER ---- */

.files-placeholder {
  padding: 3rem 2rem;
  text-align: center;
  background: var(--bg-alt);
  border-radius: 4px;
  border: 1px dashed var(--border);
}

.files-icon {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.files-placeholder p {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

/* ---- EMPTY STATE ---- */

.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  background: var(--bg-alt);
  border-radius: 4px;
}

.empty-state p {
  margin: 0 auto 1.5rem;
  font-size: 0.95rem;
}

/* ---- PORTAL RESPONSIVE ---- */

@media (max-width: 768px) {
  .portal-header {
    flex-direction: column;
    gap: 1rem;
  }

  .project-header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .project-card {
    padding: 1.5rem;
  }

  .project-timeline {
    gap: 0;
  }

  .timeline-label {
    font-size: 0.55rem;
  }

  .project-actions {
    flex-direction: column;
  }

  .message-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
  }
}

/* ---- ACCOUNT CREDENTIALS BOX (shown on confirmation) ---- */

.credentials-box {
  background: var(--white);
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 1.5rem 2rem;
  margin: 1.5rem auto;
  max-width: 400px;
  text-align: left;
}

.credentials-box h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  color: var(--accent);
}

.credentials-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.credentials-row:last-child {
  border-bottom: none;
}

.credentials-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-light);
}

.credentials-value {
  font-family: 'DM Sans', monospace;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
}

.credentials-note {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.75rem;
  text-align: center;
}
