/* 전역 스타일 초기화 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 색상 변수 정의 - DIORA 톤 */
:root {
    --primary-black: #1A1A1A;
    --primary-white: #FFFFFF;
    --accent-gold: #B8860B;
    --bg-cream: #FAFAFA;
    --text-dark: #333333;
    --text-light: #666666;
    --border-color: #E8E8E8;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --sidebar-width: 250px;

    /* 유형별 악센트 색상 */
    --egen-accent: #B8860B;
    --teto-accent: #1A1A1A;
}

/* 기본 body 스타일 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
    background-color: var(--bg-cream);
    color: var(--text-dark);
    line-height: 1.6;
}

/* 헤더 스타일 - DIORA 톤 */
.header {
    background: var(--primary-white);
    color: var(--primary-black);
    padding: 0.6rem 2rem;
    box-shadow: var(--shadow);
    height: 50px;
    display: flex;
    align-items: center;
    border-bottom: 2px solid var(--accent-gold);
}

.header-content {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    gap: 20px;
}

.logo {
    font-size: 1.6rem;
    font-weight: bold;
    letter-spacing: 2px;
    transition: transform 0.3s ease, color 0.3s ease;
    justify-self: flex-start;
    color: var(--primary-black);
}

.logo:hover {
    transform: scale(1.05);
    color: var(--accent-gold);
}

.header-title {
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    justify-self: center;
    transition: transform 0.3s ease, color 0.3s ease;
    color: var(--primary-black);
}

.header-title:hover {
    transform: scale(1.02);
    color: var(--accent-gold);
}

.header-test-btn {
    background: var(--primary-white);
    border: 2px solid var(--accent-gold);
    color: var(--accent-gold);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    justify-self: flex-end;
    white-space: nowrap;
}

.header-test-btn:hover {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
    color: white;
    transform: scale(1.05);
}

/* 메인 컨테이너 레이아웃 */
.main-container {
    display: flex;
    height: calc(100vh - 50px);
    overflow: hidden;
}

/* 사이드바 스타일 */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
    position: fixed;
    height: calc(100vh - 50px);
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-toggle {
    display: none;
    position: absolute;
    top: 1rem;
    right: -40px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0 5px 5px 0;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 100;
}

.sidebar-nav {
    padding: 0 1rem;
}

.type-group {
    margin: 1.5rem 0;
}

.type-group h3 {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 0.4rem;
    padding-left: 1rem;
}

.type-btn {
    width: 100%;
    padding: 0.8rem;
    background: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.4rem;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.type-btn:hover {
    background: var(--bg-cream);
    transform: translateX(5px);
}

.type-btn.active {
    background: linear-gradient(135deg, #F5EFE0 0%, #E8E8E8 100%);
    font-weight: bold;
}

.type-btn .icon {
    font-size: 1.3rem;
}

.test-start-btn {
    width: 100%;
    padding: 0.7rem 1.5rem;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--primary-black) 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.test-start-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow);
}

.sidebar-test {
    margin-top: 1.5rem;
}

/* 메인 콘텐츠 영역 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem;
    overflow: hidden;
    height: calc(100vh - 50px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-section {
    display: none;
    animation: fadeIn 0.5s ease;
    width: 100%;
    max-width: 1000px;
}

.content-section.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#home-screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    max-height: calc(100vh - 100px);
}

#type-detail.active {
    display: block;
    overflow-y: auto;
    height: 100%;
    width: 100%;
}

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

/* 홈 화면 스타일 */
.intro-text {
    text-align: center;
    margin-bottom: 1.2rem;
    padding: 0 1rem;
}

.intro-text h2 {
    font-size: 1.6rem;
    margin-bottom: 0.3rem;
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--primary-black) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.intro-text p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.5rem;
}

.stats {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background: #F5EFE0;
    border-radius: 20px;
    font-size: 0.8rem;
}

/* 카드 레이아웃 */
.type-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    margin-bottom: 1rem;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

.card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card img {
    width: 70px;
    height: 70px;
    margin-bottom: 1rem;
    border-radius: 50%;
    background: white;
}

.card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

.card p {
    color: var(--text-light);
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 500;
}

.main-test {
    display: block;
    margin: 1.5rem auto 0;
    padding: 1rem 3rem;
    font-size: 1.1rem;
    max-width: 300px;
}

/* 모달 스타일 */
.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
}

.modal.active {
    display: block;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    min-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

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

/* 성별 선택 모달 */
.gender-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.gender-btn {
    flex: 1;
    padding: 2rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.gender-btn:hover {
    border-color: var(--primary-black);
    transform: scale(1.05);
}

.gender-icon {
    font-size: 3rem;
}

/* 테스트 모달 */
.test-modal-content {
    min-width: 600px;
    max-width: 800px;
}

.progress-bar {
    position: relative;
    height: 30px;
    background: var(--border-color);
    border-radius: 15px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-gold) 0%, var(--primary-black) 100%);
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 8.33%;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.question-container {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.question-text {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.answer-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-btn {
    padding: 1.5rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 15px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.answer-btn:hover {
    background: var(--bg-cream);
    border-color: var(--primary-black);
    transform: translateX(10px);
}

.answer-btn.selected {
    background: linear-gradient(135deg, #F5EFE0 0%, #E8E8E8 100%);
    border-color: var(--primary-black);
    font-weight: bold;
}

/* 테스트 네비게이션 */
.test-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

.nav-btn {
    padding: 0.8rem 2rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
    background: var(--bg-cream);
    border-color: var(--primary-black);
}

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

/* 오버레이 */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.overlay.active {
    display: block;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
    
    .type-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .card img {
        width: 80px;
        height: 80px;
    }
    
    .modal-content {
        min-width: 90vw;
        padding: 1.5rem;
    }
    
    .test-modal-content {
        min-width: 90vw;
        max-width: 90vw;
    }
    
    .intro-text h2 {
        font-size: 2rem;
    }
    
    .gender-buttons {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .type-cards {
        grid-template-columns: 1fr;
    }
    
    .intro-text h2 {
        font-size: 1.5rem;
    }
    
    .question-text {
        font-size: 1.2rem;
    }
}
/* 뒤로가기 버튼 스타일 */
.back-button {
    background: white;
    border: 2px solid var(--accent-gold);
    color: var(--text-dark);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    align-self: flex-start;
}

.back-button:hover {
    background: var(--accent-gold);
    color: white;
    transform: scale(1.05);
}

/* 헤더 반응형 */
@media (max-width: 768px) {
    .header-content {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
        padding: 0 1rem;
    }
    
    .logo {
        font-size: 1.5rem;
        letter-spacing: 1px;
    }
    
    .header-title {
        font-size: 1rem;
    }
    
    .header-test-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .header-title {
        font-size: 0.9rem;
        font-weight: 500;
    }
    
    .header-test-btn {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* 새로운 컴팩트 상세페이지 스타일 */
.detail-container {
    height: calc(100vh - 50px);
    overflow: hidden;
    padding: 15px;
    position: relative;
}

.detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.type-icon {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.type-icon.egen-male {
    background: linear-gradient(135deg, var(--accent-gold), #F5EFE0);
}

.type-icon.teto-male {
    background: linear-gradient(135deg, var(--primary-black), #E8E8E8);
}

.type-icon.egen-female {
    background: linear-gradient(135deg, var(--accent-gold), #ff8fab);
}

.type-icon.teto-female {
    background: linear-gradient(135deg, var(--primary-black), #2196f3);
}

.header-text {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-title {
    font-size: 1.3rem;
    margin: 0;
    color: var(--text-dark);
    font-weight: 700;
}

.detail-subtitle {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
    font-weight: 400;
}

.detail-content-grid {
    display: grid;
    grid-template-columns: 35% 65%;
    gap: 15px;
    height: calc(100vh - 120px);
    overflow: hidden;
}

.detail-content-single {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 10px;
}

/* 새로운 컴팩트 헤더 스타일 */
.detail-header-compact {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.title-compact {
    display: flex;
    align-items: center;
    gap: 10px;
}

.type-symbol {
    font-size: 1.5rem;
}

.title-compact .detail-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--text-dark);
}

.title-compact .detail-subtitle {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: normal;
}

/* 새로운 그리드 레이아웃 */
.detail-content-grid-enhanced {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 20px;
    height: calc(100vh - 200px);
    overflow-y: auto;
}

.traits-card {
    grid-column: 1 / -1;
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.match-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.stories-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.traits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 15px;
}

.trait-item {
    background: linear-gradient(135deg, #F5EFE0, #E8E8E8);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.1);
}

.stories-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.story-item {
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.story-number {
    background: var(--accent-gold);
    color: white;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.story-text {
    flex: 1;
    line-height: 1.6;
    font-size: 0.95rem;
}

.match-info {
    background: linear-gradient(135deg, #F5EFE0, #E8E8E8);
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    border: 1px solid rgba(0,0,0,0.1);
    font-size: 1rem;
    line-height: 1.6;
}

.detail-left-column {
    overflow-y: auto;
    padding-right: 10px;
}

.detail-right-column {
    overflow-y: auto;
    padding-left: 10px;
}

.detail-left {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.detail-right {
    display: flex;
    flex-direction: column;
}

.detail-section {
    background: white;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 10px;
}

.traits-section {
    flex: 1;
    min-height: 100px;
    max-height: 150px;
}

.match-section {
    flex: 1;
    min-height: 80px;
    max-height: 120px;
}

.story-section {
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
}

.story-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 350px;
    overflow: hidden;
}

.story-item {
    background: var(--bg-cream);
    padding: 10px 12px;
    border-radius: 8px;
    border-left: 3px solid var(--accent-gold);
    margin-bottom: 5px;
}

.story-item h4 {
    color: var(--accent-gold);
    font-size: 13px;
    margin: 0 0 5px 0;
    font-weight: 600;
}

.story-text {
    color: var(--text-dark);
    font-size: 12px;
    line-height: 1.4;
    margin: 0;
}

.detail-section h3 {
    font-size: 0.9rem;
    margin: 0 0 8px 0;
    color: var(--text-dark);
    font-weight: 600;
}

.traits-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.trait-tag {
    background: #F5EFE0;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-dark);
    border: 1px solid var(--accent-gold);
}

.match-info {
    font-size: 0.85rem;
    line-height: 1.3;
    color: var(--text-dark);
    margin: 0;
}

.story-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.story-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-light);
    margin: 0;
    padding: 8px;
    background: var(--bg-cream);
    border-radius: 8px;
}

.summary-text {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-dark);
    margin: 0;
    font-weight: 500;
}

/* 뒤로가기 버튼 수정 */
.back-button {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    border: 2px solid var(--accent-gold);
    color: var(--text-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.back-button:hover {
    background: var(--accent-gold);
    color: white;
    transform: scale(1.1);
}

/* 반응형 최적화 */
@media (max-width: 1200px) {
    .detail-content-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        height: calc(100vh - 180px);
        overflow-y: auto;
    }
    
    .detail-left, .detail-right {
        gap: 10px;
    }
    
    .detail-section {
        padding: 12px;
        flex: none;
        min-height: auto;
    }
}

/* BAAL 임베딩 모드 */
body.embed-mode {
    background: #faf8f4;
    min-height: auto;
}
body.embed-mode .header,
body.embed-mode .sidebar,
body.embed-mode .sidebar-toggle {
    display: none !important;
}
body.embed-mode .main-container {
    margin-left: 0 !important;
    padding-top: 10px !important;
    max-width: 100% !important;
}
body.embed-mode .main-content {
    margin-left: 0 !important;
    padding-top: 10px !important;
    max-width: 100% !important;
}

