/* TAM-Q 로드맵 마인드맵 스타일 */

:root {
  --brand-main: #1b4298;
  --brand-sub: #f7a007;
  --primary-color: #1b4298;
  --primary-hover: #2654b3;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --background: #f8fafc;
  --surface: #ffffff;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* 메인 컨텐츠 */
.main-content {
  padding: 2rem 0 4rem;
}

.page-header {
  text-align: center;
  margin-bottom: 3rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
}

/* 입력 섹션 */
.input-section {
  margin-bottom: 2rem;
}

.form-card {
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: var(--shadow);
  max-width: 600px;
  margin: 0 auto;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.subsection-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.required {
  color: var(--danger-color);
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: all 0.2s;
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-hint {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* 마인드맵 카드 영역 - 여백 추가 */
.mindmap-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem;
}

.mindmap-card .section-description {
  padding: 1rem 1.5rem;
  margin-bottom: 2rem;
  line-height: 1.7;
}

#mindmap-input-section .form-group {
  margin-bottom: 2rem;
}

#mindmap-input-section .btn-primary-large {
  margin-top: 1rem;
}

.student-info-display {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 2px solid #bae6fd;
  border-radius: 0.75rem;
  padding: 1.5rem 2rem;
  margin-bottom: 1.5rem;
}

.student-info-display .subsection-title {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.info-card {
  background: white;
  border-radius: 0.5rem;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.info-item:last-child {
  border-bottom: none;
}

.info-label {
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.info-value {
  font-weight: 600;
  color: var(--primary-color);
  font-size: 1.05rem;
}

.info-notice {
  background: #fef3c7;
  border: 2px solid #fbbf24;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-top: 1rem;
  text-align: center;
}

.info-notice p {
  margin: 0;
  color: #92400e;
  font-weight: 500;
}

.info-notice a {
  color: var(--primary-color);
  text-decoration: underline;
  font-weight: 600;
}

/* 버튼 */
.btn-primary,
.btn-secondary {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
  background: var(--secondary-color);
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--background);
}

.btn-secondary-small {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-block;
  text-align: center;
  background: var(--surface);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
}

.btn-secondary-small:hover {
  background: var(--background);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* 텍스트 로드맵으로 돌아가기 버튼 */
.back-to-roadmap-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, #1b4298 0%, #b89b5c 100%);
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(27, 66, 152, 0.3);
}

.back-to-roadmap-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(27, 66, 152, 0.4);
}

.back-to-roadmap-btn:active {
  transform: translateY(0);
}

.back-to-roadmap-btn .btn-icon {
  font-size: 1.25rem;
  font-weight: 700;
}

.back-to-roadmap-btn .btn-text {
  font-weight: 600;
}

/* 로딩 상태 */
.loading-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--surface);
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
}

.spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 1rem;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

/* 마인드맵 섹션 */
.mindmap-section {
  background: var(--surface);
  border-radius: 0.75rem;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.mindmap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.mindmap-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mindmap-container {
  position: relative;
  background: var(--background);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.reactflow-wrapper {
  width: 100%;
  height: 600px;
}

/* React Flow 커스텀 노드 스타일 */
.react-flow__node {
  font-family: inherit;
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}

.react-flow__node:hover {
  box-shadow: var(--shadow-lg);
  transform: scale(1.05);
}

.react-flow__node-default {
  padding: 0.75rem 1rem;
  border-width: 2px;
  font-weight: 500;
}

.react-flow__node.type-root {
  background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
  color: white;
  font-size: 1.25rem;
  font-weight: 700;
  border-color: var(--primary-color);
  padding: 1.25rem 1.5rem;
}

.react-flow__node.type-grade {
  background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
  color: white;
  font-size: 1.125rem;
  font-weight: 600;
  border-color: var(--success-color);
}

.react-flow__node.type-subject {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--warning-color);
  border-width: 3px;
}

.react-flow__node.type-keyword {
  background: #fef3c7;
  color: #92400e;
  font-size: 0.875rem;
  border-color: var(--warning-color);
}

.react-flow__edge-path {
  stroke-width: 2;
}

/* 상세 정보 패널 */
.detail-panel {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  box-shadow: var(--shadow-lg);
  z-index: 10;
}

.detail-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-panel-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  transition: all 0.2s;
}

.close-btn:hover {
  background: var(--background);
  color: var(--text-primary);
}

.detail-panel-content {
  padding: 1rem;
  max-height: 400px;
  overflow-y: auto;
}

.detail-panel-content p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.detail-panel-content strong {
  color: var(--primary-color);
}

/* 범례 */
.mindmap-legend {
  padding: 1rem;
  background: var(--background);
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
}

.mindmap-legend h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.legend-items {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-icon {
  width: 20px;
  height: 20px;
  border-radius: 0.25rem;
  border: 2px solid;
}

.legend-icon.root {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

.legend-icon.grade {
  background: var(--success-color);
  border-color: var(--success-color);
}

.legend-icon.subject {
  background: var(--surface);
  border-color: var(--warning-color);
}

.legend-icon.keyword {
  background: #fef3c7;
  border-color: var(--warning-color);
}

.legend-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* 반응형 */
@media (max-width: 768px) {
  .page-title {
    font-size: 2rem;
  }

  .form-card {
    padding: 1.5rem;
  }

  .mindmap-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .mindmap-controls {
    width: 100%;
  }

  .btn-secondary {
    flex: 1;
  }

  .reactflow-wrapper {
    height: 400px;
  }

  .detail-panel {
    position: relative;
    top: 0;
    right: 0;
    width: 100%;
    margin-top: 1rem;
  }
}
