/* ==========================================================================
   Psychtest - 16personalities 스타일 CSS
   ========================================================================== */

/* CSS Variables (16personalities 컬러 팔레트) */
:root {
    --primary-purple: #88619a;
    --primary-blue: #4298b4;
    --primary-green: #33a474;
    --primary-yellow: #e4ae3a;

    --bg-gradient-start: #574476;
    --bg-gradient-end: #1a2b4c;

    --text-primary: #2c3e50;
    --text-secondary: #606f7b;
    --text-light: #ffffff;
    --text-muted: #8795a1;

    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --bg-dark: #1a1a2e;

    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;

    --transition: all 0.3s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body.psychtest-body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.psychtest-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
}

.psychtest-nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.psychtest-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--primary-purple);
    font-weight: 700;
    font-size: 1.25rem;
}

.psychtest-logo img {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.psychtest-nav-links {
    display: flex;
    gap: 30px;
}

.psychtest-nav-links .nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.psychtest-nav-links .nav-link:hover {
    color: var(--primary-purple);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

.mobile-menu {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 10px 0;
    box-shadow: var(--shadow-md);
}

.mobile-menu a {
    padding: 12px 20px;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.mobile-menu a:last-child {
    border-bottom: none;
}

.mobile-menu.active {
    display: flex;
}

/* ==========================================================================
   Main Content
   ========================================================================== */
.psychtest-main {
    flex: 1;
    margin-top: 0px;
    padding: 40px 0px;
}

/* ==========================================================================
   Cards & Containers
   ========================================================================== */
.psychtest-container {
    max-width: 900px;
    margin: 0 auto;
}

.psychtest-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.psychtest-card-header {
    padding: 30px;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
    text-align: center;
}

.psychtest-card-body {
    padding: 30px;
}

/* ==========================================================================
   Test List Page
   ========================================================================== */
.test-list-hero {
    text-align: center;
    padding: 80px 20px 40px;
    color: white;
    background: linear-gradient(180deg, #7eb8c9 0%, #b8d4dc 70%, #d8e8ec 100%);
}

.test-list-hero-bg {
    width: 100%;
    padding: 0;
    margin: 0;
}

.test-list-hero-bg img {
    width: 100%;
    display: block;
}

.test-list-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.test-list-hero p {
    font-size: 1.1rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto;
}

.test-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    max-width: 1000px;
    margin: 40px auto 0;
    padding: 0 20px;
}

.test-item {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    cursor: pointer;
}

.test-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.test-item-header {
    padding: 25px;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
    text-align: center;
}

.test-item-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.test-item-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.test-item-body {
    padding: 20px 25px;
}

.test-item-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 15px;
    line-height: 1.6;
}

.test-item-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.test-item-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.test-item-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.btn-start-test {
    display: inline-block;
    padding: 10px 30px;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
    text-decoration: none;
    border-radius: var(--radius-xl);
    font-weight: 600;
    transition: var(--transition);
}

.btn-start-test:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    color: white;
}

.btn-detail-test {
    display: inline-block;
    padding: 10px 25px;
    background: white;
    color: var(--primary-purple);
    text-decoration: none;
    border-radius: var(--radius-xl);
    font-weight: 600;
    transition: var(--transition);
    border: 2px solid var(--primary-purple);
    margin-right: 10px;
}

.btn-detail-test:hover {
    background: var(--primary-purple);
    color: white;
    transform: scale(1.05);
}

/* ==========================================================================
   Detail Page
   ========================================================================== */
.detail-hero {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-primary);
}

.detail-hero-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.detail-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.detail-hero .subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.detail-content {
    max-width: 800px;
    margin: -30px auto 0;
    padding: 0 20px;
}

.detail-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 25px;
}

.detail-card-header {
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.detail-card-body {
    padding: 25px;
}

.scales-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.scale-item {
    padding: 15px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    text-align: center;
}

.scale-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.scale-item-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.start-section {
    text-align: center;
    padding: 40px 20px;
}

.btn-begin {
    display: inline-block;
    padding: 18px 60px;
    background: linear-gradient(135deg, var(--primary-green), #28a745);
    color: white;
    text-decoration: none;
    border: none;
    outline: none;
    border-radius: var(--radius-xl);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.btn-begin:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.btn-begin:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(51, 164, 116, 0.3), var(--shadow-lg);
}

/* ==========================================================================
   Questions Page
   ========================================================================== */
.questions-container {
    max-width: 700px;
    margin: 10px auto 0;
    padding: 20px;
}

@media (max-width: 768px) {
    .questions-container {
        margin-top: 30px;
    }
}

.progress-section {
    margin-bottom: 30px;
}

.progress-bar-container {
    background: rgba(255,255,255,0.2);
    border-radius: var(--radius-xl);
    height: 8px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-green), var(--primary-blue));
    border-radius: var(--radius-xl);
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.question-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px 30px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.question-number {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

.question-text {
    font-size: 1.4rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 35px;
    line-height: 1.5;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-btn {
    padding: 15px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    font-size: 1rem;
    color: var(--text-primary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 15px;
}

.option-btn:hover {
    border-color: var(--primary-purple);
    background: rgba(136, 97, 154, 0.05);
}

.option-btn.selected {
    border-color: var(--primary-purple);
    background: var(--primary-purple);
    color: white;
}

.option-indicator {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.option-btn.selected .option-indicator {
    background: white;
    color: var(--primary-purple);
}

.option-btn.selected .option-indicator::after {
    content: '✓';
    font-size: 0.8rem;
}

.option-text {
    flex: 1;
    text-align: left;
}

.question-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.nav-btn {
    padding: 12px 25px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-btn.prev {
    background: var(--bg-light);
    color: var(--text-primary);
}

.nav-btn.next {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nav-btn:not(:disabled):hover {
    transform: scale(1.02);
}

/* ==========================================================================
   Result Page
   ========================================================================== */
.result-hero {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-primary);
}

.result-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.result-hero .result-date {
    opacity: 0.8;
    font-size: 0.95rem;
}

.result-content {
    max-width: 900px;
    margin: -30px auto 0;
    padding: 0 20px 40px;
}

.result-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 25px;
    overflow: hidden;
}

.result-card-header {
    padding: 20px 25px;
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.result-card-body {
    padding: 25px;
}

/* Chart Container */
.chart-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

/* Rainbow Chart (정규분포 차트) */
.rainbow-chart-container {
    width: 100%;
    height: 200px;
    margin: 0 auto 20px;
}

.rainbow-chart-info {
    text-align: center;
    margin-bottom: 20px;
}

.percentile-display {
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
}

.percentile-label {
    font-size: 1rem;
    color: var(--text-muted);
}

.percentile-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-purple);
    line-height: 1;
}

.percentile-desc {
    color: var(--text-secondary);
    font-size: 1rem;
}

.interpretation-box {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
    padding: 25px;
    border-radius: var(--radius-lg);
    text-align: center;
}

.interpretation-level {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.interpretation-text {
    font-size: 1rem;
    line-height: 1.7;
    opacity: 0.95;
}

/* Gauge Chart (2개 척도용) */
.gauge-chart-pair {
    display: flex;
    justify-content: center;
    gap: 60px;
    flex-wrap: wrap;
    padding: 20px 0;
}

.gauge-chart-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 180px;
}

.gauge-wrapper {
    margin-bottom: 10px;
}

.gauge-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.gauge-value {
    font-size: 2rem;
    font-weight: 700;
}

@media (max-width: 480px) {
    .gauge-chart-pair {
        gap: 30px;
    }

    .gauge-chart-item {
        min-width: 150px;
    }

    .gauge-value {
        font-size: 1.5rem;
    }
}

/* Scale Result Items */
.scale-results {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.scale-result-item {
    padding: 20px;
    background: var(--bg-light);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--primary-purple);
}

.scale-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.scale-result-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.scale-result-percentile {
    background: var(--primary-purple);
    color: white;
    padding: 5px 15px;
    border-radius: var(--radius-xl);
    font-weight: 600;
    font-size: 0.9rem;
}

.scale-result-bar {
    height: 10px;
    background: #e2e8f0;
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 15px;
}

.scale-result-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-blue));
    border-radius: var(--radius-xl);
    transition: width 0.5s ease;
}

.scale-result-interpretation {
    padding: 15px;
    background: white;
    border-radius: var(--radius-sm);
}

.interpretation-title {
    font-weight: 600;
    color: var(--primary-purple);
    margin-bottom: 8px;
}

.interpretation-desc {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Action Buttons */
.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 30px;
}

.result-action-btn {
    padding: 12px 30px;
    border-radius: var(--radius-xl);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-action-btn.primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: white;
}

.result-action-btn.secondary {
    background: var(--bg-light);
    color: var(--text-primary);
}

.result-action-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.psychtest-footer {
    background: #2c3e50;
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
}

.footer-links {
    margin-bottom: 15px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    opacity: 1;
}

.footer-links .divider {
    margin: 0 15px;
    opacity: 0.7;
}

.copyright {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 5px;
}

.disclaimer {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* ==========================================================================
   Loading & Animations
   ========================================================================== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 15px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .psychtest-nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .test-list-hero h1 {
        font-size: 1.8rem;
    }

    .test-list-hero p {
        font-size: 1rem;
    }

    .test-grid {
        grid-template-columns: 1fr;
    }

    .detail-hero h1 {
        font-size: 1.8rem;
    }

    .detail-hero-icon {
        font-size: 3rem;
    }

    .question-text {
        font-size: 1.2rem;
    }

    .question-card {
        padding: 30px 20px;
    }

    .result-hero h1 {
        font-size: 1.8rem;
    }

    .scale-result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .scales-grid {
        grid-template-columns: 1fr;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-action-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .psychtest-main {
        padding: 20px 10px;
    }

    .test-item-header {
        padding: 20px;
    }

    .question-nav {
        flex-direction: column;
        gap: 10px;
    }

    .nav-btn {
        width: 100%;
        justify-content: center;
    }

    .btn-begin {
        width: 100%;
        padding: 15px 30px;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.hidden { display: none !important; }
