/* Five Consulting – Audit Portal */
:root {
  --cyan: #00AEEF;
  --dark-blue: #1C3F5F;
  --gray: #7F7F7F;
  --light-bg: #F7F9FB;
  --white: #FFFFFF;
  --red: #E74C3C;
  --green: #27AE60;
  --yellow: #F39C12;
  --border: #E2E8F0;
  --shadow: rgba(28,63,95,0.08);
}

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

body {
  font-family: Calibri, 'Segoe UI', system-ui, sans-serif;
  background: var(--light-bg);
  color: var(--dark-blue);
  min-height: 100vh;
}

.portal-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* --- Header --- */
.portal-header {
  background: var(--white);
  border-bottom: 3px solid var(--cyan);
  padding: 16px 24px;
}

.header-content {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  height: 44px;
  width: auto;
}

/* --- Main --- */
.portal-main {
  flex: 1;
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px;
}

/* --- Footer --- */
.portal-footer {
  background: var(--dark-blue);
  color: rgba(255,255,255,0.7);
  text-align: center;
  padding: 20px 24px;
  font-size: 13px;
  line-height: 1.6;
}

.portal-footer a {
  color: var(--cyan);
  text-decoration: none;
}

/* --- Loading --- */
.loading-state {
  text-align: center;
  padding: 80px 0;
  color: var(--gray);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* --- Error state --- */
.error-state {
  text-align: center;
  padding: 80px 0;
}

.error-state h2 {
  color: var(--red);
  margin-bottom: 12px;
}

/* --- Completed state --- */
.completed-state {
  text-align: center;
  padding: 60px 0;
}

.completed-state .check-icon {
  font-size: 64px;
  margin-bottom: 16px;
}

/* --- Audit content --- */
.audit-header {
  margin-bottom: 32px;
}

.audit-meta {
  background: var(--white);
  border-radius: 8px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px var(--shadow);
  margin-bottom: 12px;
}

.meta-row {
  display: flex;
  padding: 4px 0;
  font-size: 14px;
}

.meta-label {
  color: var(--gray);
  min-width: 140px;
  font-size: 13px;
}

.meta-value {
  font-weight: 600;
  color: var(--dark-blue);
}

.meta-value.overdue {
  color: var(--red);
}

.info-banner {
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(0,174,239,0.06);
  border-left: 3px solid var(--cyan);
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: var(--dark-blue);
  line-height: 1.5;
}

.info-banner strong {
  color: var(--cyan);
}

.audit-header .description {
  color: var(--gray);
  font-size: 15px;
  line-height: 1.6;
  margin-top: 8px;
}

/* --- Progress bar --- */
.progress-bar-container {
  background: var(--border);
  border-radius: 8px;
  height: 8px;
  margin-bottom: 32px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--cyan);
  border-radius: 8px;
  transition: width 0.3s ease;
}

.progress-label {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 8px;
  text-align: right;
}

/* --- Chapter --- */
.chapter {
  margin-bottom: 32px;
}

.chapter-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark-blue);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--cyan);
  margin-bottom: 20px;
}

/* --- Question card --- */
.question-card {
  background: var(--white);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: 0 1px 4px var(--shadow);
  border-left: 4px solid var(--border);
  transition: border-color 0.2s;
}

.question-card.answered {
  border-left-color: var(--green);
}

.question-card.required {
  border-left-color: var(--cyan);
}

.question-card.required.answered {
  border-left-color: var(--green);
}

.question-number {
  font-size: 12px;
  color: var(--gray);
  margin-bottom: 4px;
}

.question-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark-blue);
  margin-bottom: 4px;
  line-height: 1.5;
}

.question-hint {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 12px;
  font-style: italic;
}

.question-legal {
  font-size: 12px;
  color: var(--cyan);
  margin-bottom: 12px;
}

.required-badge {
  font-size: 11px;
  color: var(--red);
  font-weight: 600;
  margin-left: 8px;
}

/* --- Yes/No buttons --- */
.yesno-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.btn-yesno {
  flex: 1;
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-yesno:hover {
  border-color: var(--cyan);
}

.btn-yesno.selected-yes {
  border-color: var(--green);
  background: rgba(39,174,96,0.08);
  color: var(--green);
}

.btn-yesno.selected-no {
  border-color: var(--red);
  background: rgba(231,76,60,0.08);
  color: var(--red);
}

/* --- Evidence section (shown when Yes) --- */
.evidence-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.evidence-section.hidden {
  display: none;
}

.evidence-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark-blue);
  margin-bottom: 6px;
}

textarea.evidence-text {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 12px;
}

textarea.evidence-text:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,174,239,0.1);
}

/* --- File upload --- */
.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
}

.file-upload-area:hover {
  border-color: var(--cyan);
}

.file-upload-area input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-area .upload-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.file-upload-area .upload-text {
  font-size: 13px;
  color: var(--gray);
}

.uploaded-files {
  margin-top: 8px;
}

.uploaded-file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(0,174,239,0.06);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}

.uploaded-file .file-icon { color: var(--cyan); }
.uploaded-file .file-name { flex: 1; }
.uploaded-file .file-status { color: var(--green); font-size: 12px; }

.uploading .file-status {
  color: var(--yellow);
}

/* --- Text question --- */
textarea.text-answer {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

textarea.text-answer:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,174,239,0.1);
}

/* --- Submit section --- */
.submit-section {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.submit-section .missing-hint {
  font-size: 13px;
  color: var(--yellow);
  margin-bottom: 12px;
}

.confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--dark-blue);
  cursor: pointer;
  text-align: left;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.confirm-check input[type="checkbox"] {
  margin-top: 3px;
  min-width: 18px;
  min-height: 18px;
  accent-color: var(--cyan);
}

.btn-submit {
  display: inline-block;
  padding: 14px 48px;
  background: var(--cyan);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.btn-submit:hover {
  background: #0098D4;
}

.btn-submit:disabled {
  background: var(--border);
  cursor: not-allowed;
}

/* --- Auto-save indicator --- */
.autosave-indicator {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  background: var(--dark-blue);
  color: white;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 100;
}

.autosave-indicator.visible {
  opacity: 1;
}

/* --- Step dots --- */
.step-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 24px;
}

.dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--border);
  color: var(--gray);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.dot:hover { background: #d0d8e0; }
.dot.done { background: var(--green); color: white; }
.dot.current { background: var(--cyan); color: white; transform: scale(1.15); }
.dot.submit-dot { background: var(--dark-blue); color: white; font-size: 13px; }
.dot.submit-dot.current { background: var(--cyan); }

/* --- Chapter badge --- */
.chapter-badge {
  display: inline-block;
  background: var(--dark-blue);
  color: white;
  padding: 4px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* --- Wizard card (single question) --- */
.wizard-card {
  border-left: 4px solid var(--cyan);
  min-height: 200px;
}

/* --- Wizard navigation --- */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 16px;
}

.btn-nav {
  padding: 10px 24px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  color: var(--dark-blue);
}

.btn-nav:hover:not(:disabled) {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-next {
  background: var(--cyan);
  color: white;
  border-color: var(--cyan);
}

.btn-next:hover:not(:disabled) {
  background: #0098D4;
  border-color: #0098D4;
  color: white;
}

.step-counter {
  font-size: 13px;
  color: var(--gray);
}

/* --- Submit page --- */
.submit-page {
  margin-top: 8px;
}

.answer-overview {
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 1px 4px var(--shadow);
  margin-bottom: 24px;
  overflow: hidden;
}

.overview-chapter {
  padding: 10px 16px;
  background: var(--dark-blue);
  color: white;
  font-size: 13px;
  font-weight: 600;
}

.overview-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.15s;
}

.overview-row:hover {
  background: rgba(0,174,239,0.04);
}

.overview-row.missing {
  background: rgba(231,76,60,0.04);
}

.overview-num {
  font-weight: 700;
  color: var(--cyan);
  min-width: 28px;
}

.overview-text {
  flex: 1;
  color: var(--dark-blue);
}

.overview-status {
  min-width: 40px;
  text-align: right;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .portal-main {
    padding: 20px 16px;
  }

  .question-card {
    padding: 16px;
  }

  .yesno-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .wizard-nav {
    flex-direction: column;
    gap: 12px;
  }

  .step-dots .dot {
    width: 24px;
    height: 24px;
    font-size: 10px;
  }
}
