/* Professional 3-Pane Layout Style */
@import url('https://fonts.googleapis.com/css2?family=Pretendard:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --sidebar-bg: #0f172a;
    --pane-bg: #1e293b;
    --main-bg: #f8fafc;
    --border: #e2e8f0;
    --text-main: #0f172a;
    --text-sub: #64748b;
}

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

body,
html {
    width: 100%;
    height: 100%;
    font-family: 'Pretendard', sans-serif;
    background-color: var(--main-bg);
    overflow: hidden;
}

.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Pane Base */
.pane {
    height: 100%;
    display: flex;
    flex-direction: column;
    color: white;
}

.pane-header {
    padding: 20px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pane-header h2 {
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.pane-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.pane-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-view-all {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-view-all:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* [1] Archive Pane (Far Left) */
.archive-pane {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.past-session-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.past-session-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.past-session-item.active {
    background: rgba(37, 99, 235, 0.2);
    border-color: var(--primary);
}

.past-session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.past-session-date {
    font-size: 0.65rem;
    opacity: 0.4;
}

.past-session-title {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-delete-session {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-delete-session:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* [2] History Pane (Center Left) */
.history-pane {
    width: 350px;
    background-color: var(--pane-bg);
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.1);
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.history-item.active {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--primary);
}

.history-item.result-item {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.history-item.result-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateX(5px);
    transition: all 0.2s ease;
}

.history-q-line {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
}

.q-num {
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.65rem;
    font-weight: 800;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--primary-light);
    white-space: nowrap;
}

.history-item.active .q-num {
    background: var(--primary);
}

.q-category-badge {
    font-size: 0.65rem;
    font-weight: 800;
    padding: 4px 8px;
    border-radius: 5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.q-category-badge.pre {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.q-category-badge.main {
    background: rgba(249, 115, 22, 0.15);
    color: #ea580c;
}

.q-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: #cbd5e1;
    line-height: 1.4;
}

.history-a-line {
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    padding-left: 32px;
}

.pending {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
    font-style: italic;
}

/* [3] Main Container (Right) */
.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-bar {
    height: 70px;
    background: white;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.brand h1 {
    font-size: 1.1rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.text-primary {
    color: var(--primary);
}

.progress-container {
    width: 300px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.progress-track {
    flex: 1;
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.4s ease;
}

#progressText {
    font-weight: 800;
    font-size: 0.8rem;
    color: var(--primary);
}

/* Interaction Area */
.content-viewport {
    flex: 1;
    padding: 60px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}

.question-card {
    width: 100%;
    max-width: 850px;
    background: white;
    padding: 50px;
    border-radius: 32px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.02);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.question-step {
    color: var(--primary);
    font-weight: 800;
    font-size: 0.85rem;
}

.question-category {
    font-weight: 800;
    font-size: 0.9rem;
    padding: 6px 14px;
    border-radius: 8px;
}

.question-category.pre {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.question-category.main {
    background: rgba(249, 115, 22, 0.15);
    color: #ea580c;
}

.question-type-badge {
    background: var(--primary-light);
    color: var(--primary);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
}

.question-title {
    font-size: 2.2rem;
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 45px;
    letter-spacing: -1px;
}

/* Option Items */
.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 22px 30px;
    border: 2px solid #f1f5f9;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.option-item:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateX(5px);
}

.option-item.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.1);
}

.option-item.disabled {
    cursor: not-allowed;
    opacity: 0.7;
    background: #f8f9fa;
}

.option-item.disabled:hover {
    transform: none;
    border-color: #f1f5f9;
    background: #f8f9fa;
}

.option-indicator {
    width: 24px;
    height: 24px;
    border: 2px solid #cbd5e1;
    margin-right: 18px;
    transition: all 0.2s;
    position: relative;
    flex-shrink: 0;
}

.option-item.single .option-indicator {
    border-radius: 50%;
}

.option-item.single.selected .option-indicator {
    border-color: var(--primary);
    border-width: 7px;
}

.option-item.multiple .option-indicator {
    border-radius: 6px;
}

.option-item.multiple.selected .option-indicator {
    background: var(--primary);
    border-color: var(--primary);
}

.option-item.multiple.selected .option-indicator::after {
    content: '✓';
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 14px;
    font-weight: bold;
}

.option-label {
    font-size: 1.15rem;
    font-weight: 600;
    color: #334155;
}

/* Navigation & Controls */
.navigation-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.btn-nav {
    padding: 12px 25px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: 700;
    color: var(--text-sub);
}

.btn-primary {
    padding: 12px 40px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
}

.btn-new-session {
    background: var(--primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-new-session:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
}

.btn-new-analysis {
    background: var(--primary-light);
    color: var(--primary);
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Result Style */
.result-card {
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border);
    overflow: hidden;
}

.result-header {
    padding: 25px 35px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.result-header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.result-title {
    font-weight: 800;
    font-size: 1.6rem;
    letter-spacing: -0.5px;
    color: var(--sidebar-bg);
    display: flex;
    align-items: center;
}

.result-footer {
    padding: 18px 35px;
    background: #fef3c7;
    border-top: 1px solid #fde68a;
    font-size: 0.88rem;
    color: #92400e;
    text-align: center;
    font-weight: 600;
}

.report-body {
    padding: 35px;
    line-height: 1.65;
    color: #334155;
    font-size: 1.02rem;
}

/* AI 리포트 내부 섹션 스타일링 */
.report-body h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--sidebar-bg);
    margin: 30px 0 18px;
    padding-left: 14px;
    border-left: 4px solid var(--primary);
    letter-spacing: -0.3px;
}

.report-body h2:first-child {
    margin-top: 0;
}

.report-body h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 14px 18px;
    border-radius: 10px;
    margin: 22px 0 14px;
    border-left: 3px solid var(--primary);
}

.report-body p {
    margin-bottom: 0.9rem;
    font-size: 1.02rem;
}

.report-body strong {
    color: var(--sidebar-bg);
    font-weight: 700;
}

.report-body ul {
    margin: 10px 0 18px;
    padding-left: 0;
}

.report-body li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 8px;
    list-style: none;
    font-size: 0.98rem;
    line-height: 1.6;
}

.report-body li::before {
    content: '•';
    position: absolute;
    left: 6px;
    color: var(--primary);
    font-weight: 900;
    font-size: 1.2rem;
}

/* 가능성 스타일링 */
.possibility-high {
    color: #dc2626;
    font-weight: 800;
    background: #fee2e2;
    padding: 2px 8px;
    border-radius: 4px;
}

.possibility-medium {
    color: #d97706;
    font-weight: 800;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 4px;
}

.possibility-low {
    color: #059669;
    font-weight: 800;
    background: #d1fae5;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Content Viewport */
.content-viewport {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* Content with Memo Layout */
.content-with-memo {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

.question-card {
    flex: 1;
    min-width: 0;
}

/* Result Screen - 완전 중앙 정렬 */
#resultScreen {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 0;
}

#resultScreen .result-card {
    width: 90%;
    max-width: 1000px;
    margin: 0 auto;
}

/* Loading Screen - 완전 중앙 정렬 */
#loadingScreen {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 20px;
    text-align: center;
    min-height: 400px;
}

.loading-title {
    font-weight: 800;
    font-size: 1.5rem;
    margin-top: 20px;
    color: var(--text-main);
}

.loading-text {
    color: var(--text-sub);
    margin-top: 10px;
    font-size: 1rem;
}

/* Memo Panel */
.memo-panel {
    width: 320px;
    flex-shrink: 0;
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: calc(100vh - 200px);
    position: sticky;
    top: 20px;
}

.memo-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-main);
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
    border-radius: 16px 16px 0 0;
}

.memo-header i {
    color: var(--primary);
}

#memoArea {
    flex: 1;
    padding: 18px 20px;
    border: none;
    outline: none;
    resize: none;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 300px;
    max-height: 500px;
}

#memoArea::placeholder {
    color: var(--text-sub);
    opacity: 0.5;
}

.memo-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-sub);
    background: #f8fafc;
    border-radius: 0 0 16px 16px;
}

.memo-footer i {
    color: #10b981;
}

/* Responsive layout */
@media (max-width: 1200px) {
    .memo-panel {
        width: 280px;
    }
}

@media (max-width: 992px) {
    .content-with-memo {
        flex-direction: column;
    }

    .memo-panel {
        width: 100%;
        max-height: 250px;
        position: relative;
        top: 0;
    }
}

/* Hidden 클래스 - 완전히 숨김 */
.hidden {
    display: none !important;
    visibility: hidden !important;
}

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

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