/* ==================== HECVAT Builder Styles ==================== */

.hecvat-page {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 64px);
}

/* ---- Sheet Navigation Sidebar ---- */
.hecvat-sheet-nav {
  width: 240px;
  min-width: 240px;
  background: var(--bg-secondary, #1a1d23);
  border-right: 1px solid var(--border-color, #2a2d35);
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.hecvat-sheet-nav-header {
  padding: 8px 16px 12px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary, #8b8fa3);
  font-weight: 600;
}

.hecvat-sheet-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  margin: 0 8px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-secondary, #a0a4b8);
  cursor: pointer;
  font-size: 13px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  width: calc(100% - 16px);
}

.hecvat-sheet-btn:hover {
  background: var(--bg-hover, #252830);
  color: var(--text-primary, #e0e2eb);
}

.hecvat-sheet-btn.active {
  background: var(--accent-primary-dim, rgba(124, 92, 255, 0.15));
  color: var(--accent-primary, #7c5cff);
  font-weight: 600;
}

.hecvat-sheet-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hecvat-sheet-btn .sheet-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hecvat-sheet-progress {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-tertiary, #2a2d35);
  color: var(--text-tertiary, #8b8fa3);
  white-space: nowrap;
  margin-left: 8px;
}

.hecvat-sheet-btn.active .hecvat-sheet-progress {
  background: var(--accent-primary-dim, rgba(124, 92, 255, 0.2));
  color: var(--accent-primary, #7c5cff);
}

.hecvat-sheet-na-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-tertiary, #2a2d35);
  color: var(--text-tertiary, #8b8fa3);
  margin-left: 8px;
}

/* ---- Main Content Area ---- */
.hecvat-main {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
  max-width: 960px;
}

.hecvat-header {
  margin-bottom: 24px;
}

.hecvat-title-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.hecvat-title-row h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary, #e0e2eb);
  margin: 0;
}

.hecvat-version-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-primary-dim, rgba(124, 92, 255, 0.15));
  color: var(--accent-primary, #7c5cff);
  font-weight: 600;
}

.hecvat-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary, #2a2d35);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
}

.hecvat-progress-fill {
  height: 100%;
  background: var(--accent-secondary, #00d4aa);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.hecvat-progress-text {
  font-size: 12px;
  color: var(--text-tertiary, #8b8fa3);
  margin-top: 4px;
}

/* ---- Section Accordion ---- */
.hecvat-section {
  margin-bottom: 16px;
  border: 1px solid var(--border-color, #2a2d35);
  border-radius: 8px;
  overflow: hidden;
}

.hecvat-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-secondary, #1a1d23);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.hecvat-section-header:hover {
  background: var(--bg-hover, #252830);
}

.hecvat-section-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e0e2eb);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hecvat-section-header .section-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary, #8b8fa3);
  transition: transform 0.2s;
}

.hecvat-section.collapsed .section-chevron {
  transform: rotate(-90deg);
}

.hecvat-section-count {
  font-size: 12px;
  color: var(--text-tertiary, #8b8fa3);
  font-weight: 400;
}

.hecvat-section-body {
  padding: 0;
}

.hecvat-section.collapsed .hecvat-section-body {
  display: none;
}

/* ---- Question Card ---- */
.hecvat-question {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color, #2a2d35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hecvat-question:first-child {
  border-top: none;
}

.hecvat-question-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.hecvat-qid {
  font-size: 11px;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--accent-primary, #7c5cff);
  background: var(--accent-primary-dim, rgba(124, 92, 255, 0.1));
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.hecvat-qid.critical {
  color: var(--non-compliant, #ff5566);
  background: rgba(255, 85, 102, 0.1);
}

.hecvat-qid.critical::after {
  content: ' *';
}

.hecvat-qtext {
  font-size: 13px;
  color: var(--text-primary, #e0e2eb);
  line-height: 1.5;
  flex: 1;
}

.hecvat-answer-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding-left: 0;
}

.hecvat-answer-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hecvat-answer-group label {
  font-size: 11px;
  color: var(--text-tertiary, #8b8fa3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hecvat-answer-select,
.hecvat-answer-textarea {
  background: var(--bg-primary, #13151a);
  border: 1px solid var(--border-color, #2a2d35);
  border-radius: 6px;
  color: var(--text-primary, #e0e2eb);
  font-size: 13px;
  padding: 8px 10px;
  transition: border-color 0.15s;
}

.hecvat-answer-select:focus,
.hecvat-answer-textarea:focus {
  outline: none;
  border-color: var(--accent-primary, #7c5cff);
}

.hecvat-answer-select {
  min-width: 120px;
}

/* Full-width expanding textarea for free-text answer fields */
.hecvat-answer-textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
  overflow: hidden; /* let autoResize control height */
  box-sizing: border-box;
}

.hecvat-answer-textarea-main {
  min-height: 80px;
}

.hecvat-answer-textarea-info {
  min-height: 100px; /* more room for supporting detail */
}

/* Make answer group full-width when it contains a textarea */
.hecvat-answer-group-full {
  width: 100%;
}

/* Additional info section */
.hecvat-additional-body {
  margin-top: 6px;
  padding-top: 6px;
}

.hecvat-additional-label {
  display: block;
  font-size: 11px;
  color: var(--text-tertiary, #8b8fa3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.hecvat-additional-toggle {
  font-size: 12px;
  color: var(--accent-primary, #7c5cff);
  cursor: pointer;
  background: none;
  border: none;
  padding: 2px 0;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.hecvat-additional-toggle:hover {
  text-decoration: underline;
}

.hecvat-guidance {
  font-size: 12px;
  color: var(--text-tertiary, #8b8fa3);
  background: var(--bg-secondary, #1a1d23);
  border-radius: 4px;
  padding: 8px 10px;
  line-height: 1.5;
  margin-top: 4px;
  display: none;
}

.hecvat-question.show-guidance .hecvat-guidance {
  display: block;
}

/* ---- Floating Action Bar ---- */
.hecvat-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-secondary, #1a1d23);
  border: 1px solid var(--border-color, #2a2d35);
  border-radius: 10px;
  padding: 10px 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.hecvat-save-status {
  font-size: 12px;
  color: var(--text-tertiary, #8b8fa3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.hecvat-save-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-secondary, #00d4aa);
}

.hecvat-save-status .dot.unsaved {
  background: var(--partial, #ffaa00);
}

.hecvat-save-status .dot.saving {
  background: var(--accent-primary, #7c5cff);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hecvat-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
}

.hecvat-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.hecvat-btn-primary {
  background: var(--accent-primary, #7c5cff);
  color: #fff;
}

.hecvat-btn-primary:hover:not(:disabled) {
  background: var(--accent-primary-hover, #6b4de0);
}

.hecvat-btn-secondary {
  background: var(--bg-tertiary, #2a2d35);
  color: var(--text-primary, #e0e2eb);
}

.hecvat-btn-secondary:hover:not(:disabled) {
  background: var(--bg-hover, #353840);
}

.hecvat-btn-success {
  background: var(--accent-secondary, #00d4aa);
  color: #111;
}

.hecvat-btn-success:hover:not(:disabled) {
  background: #00c49d;
}

/* ---- Empty State / Landing ---- */
.hecvat-landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 32px;
  text-align: center;
  flex: 1;
}

.hecvat-landing h2 {
  font-size: 20px;
  color: var(--text-primary, #e0e2eb);
  margin-bottom: 8px;
}

.hecvat-landing p {
  font-size: 14px;
  color: var(--text-secondary, #a0a4b8);
  max-width: 480px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.hecvat-submissions-list {
  width: 100%;
  max-width: 600px;
  margin-top: 24px;
}

.hecvat-submission-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-secondary, #1a1d23);
  border: 1px solid var(--border-color, #2a2d35);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}

.hecvat-submission-card:hover {
  border-color: var(--accent-primary, #7c5cff);
}

.hecvat-submission-card .sub-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e0e2eb);
}

.hecvat-submission-card .sub-meta {
  font-size: 12px;
  color: var(--text-tertiary, #8b8fa3);
  margin-top: 2px;
}

.hecvat-submission-card .sub-progress {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-secondary, #00d4aa);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hecvat-page {
    flex-direction: column;
  }

  .hecvat-sheet-nav {
    width: 100%;
    min-width: unset;
    flex-direction: row;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
    border-right: none;
    border-bottom: 1px solid var(--border-color, #2a2d35);
  }

  .hecvat-sheet-btn {
    white-space: nowrap;
    margin: 0;
    width: auto;
    padding: 8px 12px;
  }

  .hecvat-main {
    padding: 16px;
  }

  .hecvat-answer-row {
    flex-direction: column;
  }

  .hecvat-action-bar {
    left: 16px;
    right: 16px;
    transform: none;
    bottom: 16px;
  }
}
