/* ============================================
   토스 디자인 시스템 (Toss Design System)
   https://tossmini-docs.toss.im/
   ============================================ */

/* ============ 색상 시스템 (Colors) ============ */
:root {
  /* Grey */
  --grey-50: #f9fafb;
  --grey-100: #f2f4f6;
  --grey-200: #e5e8eb;
  --grey-300: #d1d6db;
  --grey-400: #b0b8c1;
  --grey-500: #8b95a1;
  --grey-600: #6b7684;
  --grey-700: #4e5968;
  --grey-800: #333d4b;
  --grey-900: #191f28;
  
  /* Blue */
  --blue-50: #e8f3ff;
  --blue-100: #c9e2ff;
  --blue-200: #90c2ff;
  --blue-300: #64a8ff;
  --blue-400: #4593fc;
  --blue-500: #3182f6;
  --blue-600: #2272eb;
  --blue-700: #1b64da;
  --blue-800: #1957c2;
  --blue-900: #194aa6;
  
  /* Red */
  --red-50: #ffeeee;
  --red-100: #ffd4d6;
  --red-200: #feafb4;
  --red-300: #fb8890;
  --red-400: #f66570;
  --red-500: #f04452;
  --red-600: #e42939;
  --red-700: #d22030;
  --red-800: #bc1b2a;
  --red-900: #a51926;
  
  /* Green */
  --green-50: #f0faf6;
  --green-100: #aeefd5;
  --green-200: #76e4b8;
  --green-300: #3fd599;
  --green-400: #15c47e;
  --green-500: #03b26c;
  --green-600: #02a262;
  --green-700: #029359;
  --green-800: #028450;
  --green-900: #027648;
  
  /* Yellow */
  --yellow-50: #fff9e7;
  --yellow-100: #ffefbf;
  --yellow-200: #ffe69b;
  --yellow-300: #ffdd78;
  --yellow-400: #ffd158;
  --yellow-500: #ffc342;
  --yellow-600: #ffb331;
  --yellow-700: #faa131;
  --yellow-800: #ee8f11;
  --yellow-900: #dd7d02;
  
  /* Teal */
  --teal-50: #edf8f8;
  --teal-100: #bce9e9;
  --teal-200: #89d8d8;
  --teal-300: #58c7c7;
  --teal-400: #30b6b6;
  --teal-500: #18a5a5;
  --teal-600: #109595;
  --teal-700: #0c8585;
  --teal-800: #097575;
  --teal-900: #076565;
  
  /* Background */
  --background: #ffffff;
  --grey-background: var(--grey-100);
  
  /* Shadow */
  --shadow-1: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-3: 0 8px 16px rgba(0, 0, 0, 0.12);
  
  /* Border Radius */
  --radius-4: 4px;
  --radius-6: 6px;
  --radius-8: 8px;
  --radius-12: 12px;
  --radius-16: 16px;
}

/* ============ 기본 스타일 ============ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--grey-900);
  background: var(--grey-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ Typography ============ */
/* 참고: https://tossmini-docs.toss.im/tds-mobile/foundation/typography/ */

.text-title1 {
  font-size: 26px;
  line-height: 35px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.text-title2 {
  font-size: 22px;
  line-height: 31px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.text-title3 {
  font-size: 20px;
  line-height: 29px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.text-title4 {
  font-size: 18px;
  line-height: 27px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.text-body1 {
  font-size: 17px;
  line-height: 25.5px;
  font-weight: 400;
  letter-spacing: -0.2px;
}

.text-body2 {
  font-size: 15px;
  line-height: 22.5px;
  font-weight: 400;
  letter-spacing: -0.1px;
}

.text-body3 {
  font-size: 13px;
  line-height: 19.5px;
  font-weight: 400;
  letter-spacing: -0.1px;
}

.text-caption {
  font-size: 12px;
  line-height: 18px;
  font-weight: 400;
  letter-spacing: 0;
}

/* ============ 버튼 (Button) ============ */
/* 참고: https://tossmini-docs.toss.im/tds-mobile/components/button/ */

button {
  font-family: 'Pretendard', sans-serif;
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
}

button:active {
  transform: scale(0.98);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* 버튼 크기 */
.btn-xlarge {
  height: 56px;
  padding: 0 24px;
  font-size: 17px;
  font-weight: 600;
  border-radius: var(--radius-12);
  letter-spacing: -0.2px;
}

.btn-large {
  height: 48px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-12);
  letter-spacing: -0.2px;
}

.btn-medium {
  height: 40px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-8);
  letter-spacing: -0.1px;
}

.btn-small {
  height: 32px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-8);
  letter-spacing: -0.1px;
}

/* 버튼 variant - fill */
.btn-primary {
  background: var(--blue-500);
  color: white;
  box-shadow: var(--shadow-1);
}

.btn-primary:hover:not(:disabled) {
  background: var(--blue-600);
  box-shadow: var(--shadow-2);
}

.btn-danger {
  background: var(--red-500);
  color: white;
  box-shadow: var(--shadow-1);
}

.btn-danger:hover:not(:disabled) {
  background: var(--red-600);
  box-shadow: var(--shadow-2);
}

.btn-dark {
  background: var(--grey-900);
  color: white;
  box-shadow: var(--shadow-1);
}

.btn-dark:hover:not(:disabled) {
  background: var(--grey-800);
  box-shadow: var(--shadow-2);
}

/* 버튼 variant - weak */
.btn-weak-primary {
  background: rgba(49, 130, 246, 0.12);
  color: var(--blue-600);
}

.btn-weak-primary:hover:not(:disabled) {
  background: rgba(49, 130, 246, 0.18);
}

.btn-weak-danger {
  background: rgba(240, 68, 82, 0.12);
  color: var(--red-600);
}

.btn-weak-danger:hover:not(:disabled) {
  background: rgba(240, 68, 82, 0.18);
}

.btn-weak-dark {
  background: rgba(25, 31, 40, 0.08);
  color: var(--grey-800);
}

.btn-weak-dark:hover:not(:disabled) {
  background: rgba(25, 31, 40, 0.12);
}

/* 아이콘 버튼 */
.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--grey-600);
  border-radius: var(--radius-8);
}

.btn-icon:hover:not(:disabled) {
  background: var(--grey-100);
  color: var(--grey-900);
}

/* ============ Badge ============ */
/* 참고: https://tossmini-docs.toss.im/tds-mobile/components/badge/ */

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: -0.1px;
}

/* Badge 크기 */
.badge-xsmall {
  height: 18px;
  padding: 0 6px;
  font-size: 11px;
  border-radius: 4px;
}

.badge-small {
  height: 20px;
  padding: 0 6px;
  font-size: 12px;
  border-radius: 4px;
}

.badge-medium {
  height: 22px;
  padding: 0 8px;
  font-size: 13px;
  border-radius: 6px;
}

.badge-large {
  height: 26px;
  padding: 0 10px;
  font-size: 14px;
  border-radius: 6px;
}

/* Badge variant - fill */
.badge-fill-blue {
  background: var(--blue-500);
  color: white;
}

.badge-fill-teal {
  background: var(--teal-500);
  color: white;
}

.badge-fill-green {
  background: var(--green-500);
  color: white;
}

.badge-fill-red {
  background: var(--red-500);
  color: white;
}

.badge-fill-yellow {
  background: var(--yellow-500);
  color: var(--grey-900);
}

.badge-fill-grey {
  background: var(--grey-200);
  color: var(--grey-700);
}

/* Badge variant - weak */
.badge-weak-blue {
  background: var(--blue-50);
  color: var(--blue-600);
}

.badge-weak-teal {
  background: var(--teal-50);
  color: var(--teal-700);
}

.badge-weak-green {
  background: var(--green-50);
  color: var(--green-700);
}

.badge-weak-red {
  background: var(--red-50);
  color: var(--red-600);
}

.badge-weak-yellow {
  background: var(--yellow-50);
  color: var(--yellow-800);
}

.badge-weak-grey {
  background: var(--grey-100);
  color: var(--grey-600);
}

/* Purple badge variants */
.badge-fill-purple {
  background: var(--purple-600);
  color: white;
}

.badge-fill-purple:hover {
  background: var(--purple-700);
}

.badge-weak-purple {
  background: var(--purple-50);
  color: var(--purple-700);
}

.badge-weak-purple:hover {
  background: var(--purple-100);
}

/* ============ Card ============ */
.card {
  background: white;
  border-radius: var(--radius-16);
  box-shadow: var(--shadow-1);
  transition: all 0.2s ease;
}

.card-hover:hover {
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

.card-hover:active {
  transform: scale(0.99);
}

/* ============ Input ============ */
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 400;
  color: var(--grey-900);
  background: white;
  border: 1.5px solid var(--grey-200);
  border-radius: var(--radius-12);
  outline: none;
  transition: all 0.2s ease;
  font-family: 'Pretendard', sans-serif;
  letter-spacing: -0.1px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus {
  border-color: var(--blue-500);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
textarea::placeholder {
  color: var(--grey-400);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 22.5px;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif !important;
}

/* ============ Tab ============ */
.tab-button {
  position: relative;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  color: var(--grey-500);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: -0.1px;
}

.tab-button:hover {
  color: var(--grey-700);
}

.tab-button.active {
  color: var(--blue-500);
}

.tab-button.active:hover {
  color: var(--blue-600);
}

.tab-button.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--blue-500);
  transition: background 0.2s ease;
}

/* ============ Modal ============ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  padding: 16px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  border-radius: var(--radius-16);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--shadow-3);
  animation: slideUp 0.3s ease;
}

.modal-content.large {
  max-width: 800px;
}

@media (max-width: 768px) {
  .modal-content {
    width: 100%;
    max-height: 95vh;
    border-radius: var(--radius-12);
  }
  .modal-content.large {
    max-width: 100%;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--grey-100);
}

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .modal-header {
    padding: 16px 20px;
  }
  .modal-body {
    padding: 20px;
    max-height: 70vh;
  }
  .modal-footer {
    padding: 12px 20px;
    flex-wrap: wrap;
  }
  .modal-footer button {
    flex: 1;
    min-width: 100px;
  }
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--grey-100);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 14px 20px;
  background: var(--grey-900);
  color: white;
  border-radius: var(--radius-12);
  box-shadow: var(--shadow-3);
  font-size: 14px;
  font-weight: 600;
  z-index: 2000;
  animation: slideInRight 0.3s ease;
  letter-spacing: -0.1px;
  min-width: 200px;
}

@media (max-width: 768px) {
  .toast {
    top: 16px;
    right: 16px;
    left: 16px;
    min-width: auto;
    font-size: 13px;
    padding: 12px 16px;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  background: var(--green-600);
  color: white;
}

.toast.error {
  background: var(--red-600);
  color: white;
}

.toast.warning {
  background: var(--yellow-600);
  color: var(--grey-900);
}

/* ============ Project List ============ */
.project-item {
  padding: 16px;
  background: white;
  border-radius: var(--radius-12);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1.5px solid transparent;
}

.project-item:hover {
  background: var(--grey-50);
  transform: translateY(-1px);
}

.project-item.active {
  border-color: var(--blue-500);
  background: var(--blue-50);
}

/* ============ Question Tree ============ */
.question-node {
  padding: 16px;
  background: white;
  border-radius: var(--radius-12);
  border: 1.5px solid var(--grey-200);
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.question-node.main {
  border-color: var(--blue-500);
  background: linear-gradient(135deg, var(--blue-50) 0%, white 100%);
}

.question-node:hover {
  box-shadow: var(--shadow-1);
}

.question-node.answered {
  border-color: var(--green-500);
  background: var(--green-50);
}

/* ============ PRD Document (Notion Style) ============ */
.prd-document {
  max-width: 900px;
  margin: 0 auto;
  padding: 60px 80px;
  background: white;
  border-radius: var(--radius-16);
  box-shadow: var(--shadow-1);
  line-height: 1.8;
}

.prd-document h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--grey-900);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--grey-200);
  letter-spacing: -0.5px;
}

.prd-document h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--grey-900);
  margin-top: 48px;
  margin-bottom: 20px;
  letter-spacing: -0.3px;
}

.prd-document h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--grey-800);
  margin-top: 32px;
  margin-bottom: 16px;
  letter-spacing: -0.2px;
}

.prd-document h4 {
  font-size: 17px;
  font-weight: 600;
  color: var(--grey-800);
  margin-top: 24px;
  margin-bottom: 12px;
  letter-spacing: -0.2px;
}

.prd-document p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--grey-700);
  margin-bottom: 16px;
  letter-spacing: -0.1px;
}

.prd-document ul,
.prd-document ol {
  margin: 16px 0;
  padding-left: 28px;
}

.prd-document li {
  font-size: 15px;
  line-height: 1.8;
  color: var(--grey-700);
  margin-bottom: 8px;
  letter-spacing: -0.1px;
}

.prd-document blockquote {
  margin: 20px 0;
  padding: 16px 20px;
  background: var(--grey-50);
  border-left: 4px solid var(--blue-500);
  border-radius: var(--radius-8);
  font-size: 15px;
  color: var(--grey-700);
  font-style: italic;
}

.prd-document code {
  padding: 2px 6px;
  background: var(--grey-100);
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Monaco', 'Courier New', monospace;
  color: var(--red-600);
}

.prd-document hr {
  margin: 32px 0;
  border: none;
  border-top: 1px solid var(--grey-200);
}

.prd-document table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 24px 0;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-12);
  overflow: hidden;
  box-shadow: var(--shadow-1);
}

.prd-document table th {
  padding: 14px 16px;
  background: var(--grey-100);
  color: var(--grey-800);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid var(--grey-200);
  letter-spacing: -0.1px;
}

.prd-document table td {
  padding: 14px 16px;
  border-top: 1px solid var(--grey-200);
  font-size: 14px;
  color: var(--grey-700);
  line-height: 1.6;
  vertical-align: top;
  letter-spacing: -0.1px;
  text-align: left; /* 명시적 좌측 정렬 */
}

.prd-document table tbody tr:hover {
  background: var(--grey-50);
  cursor: pointer;
}

.prd-document table tbody tr:first-child td {
  border-top: none;
}

.prd-document details {
  margin: 20px 0;
  padding: 16px 20px;
  background: var(--grey-50);
  border-radius: var(--radius-12);
  border: 1px solid var(--grey-200);
}

.prd-document summary {
  font-size: 15px;
  font-weight: 600;
  color: var(--grey-800);
  cursor: pointer;
  padding: 4px 0;
  letter-spacing: -0.1px;
}

.prd-document summary:hover {
  color: var(--blue-500);
}

/* 반응형 */
@media (max-width: 768px) {
  .prd-document {
    padding: 40px 24px;
  }
  
  .prd-document h1 {
    font-size: 28px;
  }
  
  .prd-document h2 {
    font-size: 22px;
  }
  
  .prd-document h3 {
    font-size: 18px;
  }
}

/* ============ Utility Classes ============ */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-12 {
  margin-bottom: 12px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.p-16 {
  padding: 16px;
}

.p-24 {
  padding: 24px;
}

/* 색상 유틸리티 */
.text-grey-500 {
  color: var(--grey-500);
}

.text-grey-600 {
  color: var(--grey-600);
}

.text-grey-700 {
  color: var(--grey-700);
}

.text-grey-800 {
  color: var(--grey-800);
}

.text-grey-900 {
  color: var(--grey-900);
}

.text-blue-500 {
  color: var(--blue-500);
}

.text-red-500 {
  color: var(--red-500);
}

.text-green-500 {
  color: var(--green-500);
}

.bg-grey-50 {
  background: var(--grey-50);
}

.bg-grey-100 {
  background: var(--grey-100);
}

.bg-white {
  background: white;
}

/* ============ 모바일 반응형 레이아웃 ============ */
@media (max-width: 768px) {
  /* 전역 */
  body {
    font-size: 14px;
  }
  
  /* 버튼 크기 조정 */
  .btn-xlarge {
    height: 48px;
    font-size: 16px;
    padding: 0 20px;
  }
  
  .btn-large {
    height: 44px;
    font-size: 15px;
    padding: 0 16px;
  }
  
  .btn-medium {
    height: 36px;
    font-size: 14px;
    padding: 0 12px;
  }
  
  .btn-small {
    height: 32px;
    font-size: 13px;
    padding: 0 10px;
  }
  
  /* 카드 패딩 */
  .card {
    border-radius: var(--radius-12);
    padding: 16px !important;
  }
  
  /* 타이포그래피 */
  .text-title1 {
    font-size: 22px;
    line-height: 30px;
  }
  
  .text-title2 {
    font-size: 20px;
    line-height: 28px;
  }
  
  .text-title3 {
    font-size: 18px;
    line-height: 26px;
  }
  
  /* Input */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    font-size: 16px; /* iOS 자동 확대 방지 */
    padding: 12px 14px;
  }
  
  /* Tab */
  .tab-button {
    padding: 10px 12px;
    font-size: 14px;
  }
  
  /* 프로젝트 아이템 */
  .project-item {
    padding: 12px;
  }
  
  /* 요건 관리 모바일 최적화 */
  .requirement-card-mobile {
    display: block !important;
  }
  
  .requirement-card-mobile .requirement-header {
    display: block !important;
    margin-bottom: 12px;
  }
  
  .requirement-card-mobile .requirement-actions {
    display: flex !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--grey-200);
  }
  
  .requirement-card-mobile .requirement-actions button {
    flex: 1;
  }
  
  /* Badge 작게 */
  .badge {
    font-size: 11px;
    padding: 2px 6px;
  }
  
  /* 진행바 숨김 (공간 절약) */
  .mobile-hide-progress {
    display: none !important;
  }
  
  .requirement-card-mobile .mobile-hide-progress + div {
    display: block !important;
  }
}

/* ============ Modal Backdrop for New Modal System ============ */
.modal-backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.animate-fade-in {
  animation: fadeIn 0.2s ease;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
