/* 나의 이야기 — 메인 CSS */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #4a6741;
    --primary-light: #6b8f5e;
    --primary-dark: #35502e;
    --bg: #faf9f6;
    --bg-card: #ffffff;
    --text: #2c2c2c;
    --text-light: #666666;
    --border: #e0ddd5;
    --danger: #c0392b;
    --success: #27ae60;
    --warning: #f39c12;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

html { font-size: 18px; }

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* 헤더 */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.8rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

nav { display: flex; align-items: center; gap: 1.2rem; }
nav a { font-size: 0.9rem; }
.user-name { font-size: 0.85rem; color: var(--text-light); }

/* 메인 */
.main-content {
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

/* 푸터 */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* 플래시 메시지 */
.flash {
    padding: 0.8rem 1.2rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
.flash-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.flash-error { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
.flash-info { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

/* 카드 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

/* 폼 */
.form-group { margin-bottom: 1.2rem; }
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    line-height: 1.5;
    background: var(--bg-card);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74,103,65,0.15);
}
.form-group textarea { resize: vertical; min-height: 120px; }

/* 버튼 */
.btn {
    display: inline-block;
    padding: 0.65rem 1.4rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #d0cdc5; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93226; color: #fff; }
.btn-success { background: #2e7d32; color: #fff; }
.btn-success:hover { background: #1b5e20; color: #fff; }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 페이지 제목 */
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
}
.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* 랜딩 페이지 */
.landing { text-align: center; padding: 3rem 0; }
.landing h1 { font-size: 2.2rem; color: var(--primary-dark); margin-bottom: 1rem; }
.landing p { font-size: 1.1rem; color: var(--text-light); margin-bottom: 2rem; max-width: 600px; margin-left: auto; margin-right: auto; }
.landing .features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2.5rem 0;
    text-align: left;
}
.landing .feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}
.landing .feature-card h3 { color: var(--primary); margin-bottom: 0.5rem; font-size: 1.1rem; }
.landing .feature-card p { font-size: 0.9rem; color: var(--text-light); margin-bottom: 0; }

/* 구조 선택 카드 */
.structure-options { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.structure-card {
    flex: 1; min-width: 140px; padding: 0.8rem; border: 2px solid var(--border);
    border-radius: var(--radius); cursor: pointer; text-align: center;
    transition: all 0.2s; background: var(--bg);
}
.structure-card:hover { border-color: var(--primary-light); }
.structure-card.selected { border-color: var(--primary); background: rgba(74,103,65,0.06); }
.structure-title { display: block; font-weight: 700; font-size: 0.95rem; color: var(--primary-dark); margin-bottom: 0.2rem; }
.structure-desc { display: block; font-size: 0.78rem; color: var(--text-light); }

/* 프로젝트 목록 */
.project-list { display: grid; gap: 1rem; }
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}
.project-card h3 { font-size: 1.1rem; margin-bottom: 0.3rem; }
.project-card .meta { font-size: 0.8rem; color: var(--text-light); }
.project-card .actions { display: flex; gap: 0.5rem; }

/* 챕터 그리드 */
.chapter-grid { display: grid; gap: 0.8rem; }
.chapter-row {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chapter-info h4 { font-size: 1rem; margin-bottom: 0.2rem; }
.chapter-info .sub { font-size: 0.8rem; color: var(--text-light); }
.chapter-actions { display: flex; gap: 0.5rem; align-items: center; }

/* 상태 뱃지 */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-not-started { background: #f5f5f5; color: #999; }
.badge-interviewing { background: #fff3e0; color: #e65100; }
.badge-writing { background: #e3f2fd; color: #1565c0; }
.badge-completed { background: #e8f5e9; color: #2e7d32; }

/* 로딩 */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}
.loading.active { display: block; }
.spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.8rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Harness 평가 박스 */
.eval-box {
    background: #f8f7f4;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    margin: 1rem 0;
    font-size: 0.9rem;
}
.eval-box h4 { margin-bottom: 0.8rem; color: var(--primary-dark); }
.eval-row { display: flex; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px solid #eee; }
.eval-row:last-child { border-bottom: none; }
.eval-score { font-weight: 700; }
.eval-pass { color: var(--success); }
.eval-fail { color: var(--danger); }
.eval-verdict {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
    border-top: 2px solid var(--border);
    font-weight: 700;
    font-size: 1rem;
}
.verdict-approved { color: var(--success); }
.verdict-revision { color: var(--warning); }

/* 인증 폼 */
.auth-container {
    max-width: 420px;
    margin: 2rem auto;
}

/* 모달 */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal-box {
    background: var(--bg-card); border-radius: 12px; padding: 1.8rem;
    max-width: 600px; width: 100%; max-height: 85vh; overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal-box h3 { font-size: 1.2rem; margin-bottom: 0.5rem; color: var(--primary-dark); }
.modal-box textarea { min-height: 200px; }

/* 반응형 */
@media (max-width: 768px) {
    html { font-size: 16px; }
    .header-inner { flex-direction: column; gap: 0.5rem; }
    .main-content { padding: 1rem; }
    .project-card { flex-direction: column; align-items: flex-start; gap: 0.8rem; }
    .chapter-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}
