/* 
 * OriFamily - Healing Journey Design System 
 * Style: "Xiaohongshu" / Little Red Book Aesthetic
 * Theme: Warm, Soft, Healing (Morandi Palette)
 */

:root {
    /* Color Palette - Morandi / Healing Tones */
    --color-bg-start: #FAFAFA;
    --color-bg-end: #F5F2F0;
    
    /* Primary: Warm Terracotta / Clay */
    --color-primary: #D8B4A5; 
    --color-primary-dark: #B58A7A;
    --color-primary-light: #EEE0DA;
    
    /* Secondary: Sage Green (Growth/Healing) */
    --color-secondary: #A6B09B;
    --color-secondary-dark: #849178;
    
    /* Accent: Soft Apricot / Beard */
    --color-accent: #F4E3D7; 
    
    /* Text */
    --color-text-main: #5D5550; /* Warm Grey instead of harsh black */
    --color-text-light: #908885;
    
    /* Charts */
    --color-chart-health: #D8B4A5;
    --color-chart-pain: #8DA399; /* Morandi Blue-Grey */
    --color-chart-hl: #CC8B80; /* Muted Red */
    --color-chart-grid: #E8E5E2;

    /* Base */
    --color-white: #FFFFFF;
    
    /* Shadows - Soft & Diffused */
    --shadow-card: 0 8px 24px rgba(181, 138, 122, 0.08); /* Tinted shadow */
    --shadow-float: 0 12px 32px rgba(181, 138, 122, 0.12);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.03);
    
    /* Radius */
    --radius-lg: 20px; /* Sligthly smaller radius */
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 40px;
    
    /* Spacing - Compact Mode */
    --spacing-xs: 6px;
    --spacing-sm: 12px;
    --spacing-md: 16px; /* Was 24px */
    --spacing-lg: 24px; /* Was 32px */
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(180deg, var(--color-bg-start) 0%, var(--color-bg-end) 100%);
    color: var(--color-text-main);
    line-height: 1.6; /* Tighter line height */
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--color-text-main);
}

h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { font-size: 14px; margin-bottom: 10px; text-align: justify; }

/* Layout Helpers */
.container {
    max-width: 480px; 
    margin: 0 auto;
    padding: 16px; /* Reduced from var(--spacing-md) */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.text-center { text-align: center; }
.hidden { display: none !important; }

/* Utility Classes for Text Colors */
.text-primary { color: var(--color-primary-dark); }
.text-secondary { color: var(--color-secondary-dark); }
.text-muted { color: var(--color-text-light); }
.text-hl { color: var(--color-chart-hl); }

/* Buttons & Interactive */
.btn {
    display: block;
    width: 100%;
    padding: 14px 24px;
    border-radius: var(--radius-pill);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    margin-top: var(--spacing-md);
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
    box-shadow: 0 8px 20px rgba(216, 180, 165, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: transparent;
    border: 1.5px solid var(--color-primary);
    color: var(--color-primary-dark);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.8s ease-out forwards;
}

/* [COMPONENT] Result Header & Score Circle */
.result-header {
    text-align: center;
    margin-bottom: var(--spacing-md); /* Reduced from lg */
    position: relative;
    z-index: 10;
}

.date-pill {
    display: inline-block;
    background: #FFF;
    color: var(--color-text-light);
    padding: 4px 12px; /* Smaller padding */
    border-radius: 20px;
    font-size: 11px;
    margin-bottom: 20px; /* Reduced margin */
    box-shadow: var(--shadow-sm);
    letter-spacing: 1px;
}

.score-circle-container {
    position: relative;
    width: 140px; /* Reduced from 160px */
    height: 140px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

.score-circle-ring {
    width: 120px; /* Reduced from 140px */
    height: 120px;
    border-radius: 50%;
    border: 5px solid #FFF; 
    background: var(--color-white);
    box-shadow: var(--shadow-float);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.score-circle-ring::before {
    content: '';
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 50%;
    border: 5px solid var(--color-primary-light);
    z-index: -1;
}

.score-value-large {
    font-family: 'Georgia', serif;
    font-size: 40px; /* Reduced from 48px */
    font-weight: normal;
    color: var(--color-primary-dark);
    line-height: 1;
}

.score-sub {
    font-size: 10px;
    color: var(--color-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.level-desc {
    color: var(--color-text-main);
    font-size: 14px; /* Reduced from 15px */
    padding: 0 10px;
    margin-top: 20px;
    font-weight: 500;
    line-height: 1.6;
}

/* [COMPONENT] Charts */
.chart-section-title {
    text-align: center;
    color: var(--color-primary-dark);
    margin: 30px 0 12px; /* Reduced margins */
    font-size: 18px; /* Reduced from 20px */
    letter-spacing: 0.5px;
}

.chart-container {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 16px 8px; /* Compact padding */
    margin-bottom: var(--spacing-md);
    box-shadow: var(--shadow-card);
    position: relative;
}

.chart-title {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-main);
    margin-bottom: 2px;
}

.chart-subtitle {
    text-align: center;
    font-size: 11px;
    color: var(--color-text-light);
    margin-bottom: 15px;
}

.chart-note {
    font-size: 11px;
    color: var(--color-text-light);
    text-align: center;
    margin-top: 10px;
    font-style: italic;
    opacity: 0.8;
}

/* [COMPONENT] Score Grid (Bento) */
.dimensions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px; /* Reduced gap */
    margin: var(--spacing-md) 0;
}

.dimension-card {
    background: var(--color-white);
    padding: 16px 10px; /* Reduced padding */
    border-radius: var(--radius-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
    border: 1px solid rgba(255,255,255, 0.5);
    margin-bottom: 0; 
}

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

.dim-icon { font-size: 20px; margin-bottom: 6px; display: block; } /* Smaller icons */
.dim-name { font-size: 12px; font-weight: 600; color: var(--color-text-light); display: block; }
.dim-desc { font-size: 11px; color: var(--color-text-light); margin-top: 4px; line-height: 1.4; opacity: 0.8; }
.dim-score { font-size: 18px; font-weight: bold; color: var(--color-primary); margin-top: 4px; display: block; }


/* [COMPONENT] Analysis Cards */
.analysis-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: 24px 16px; /* Reduced horizontal padding */
    margin-top: var(--spacing-md);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

/* Decorative top border via pseudo element */
.analysis-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px; /* Thinner border */
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-accent) 100%);
}

.analysis-title {
    font-size: 16px; /* Reduced from 18px */
    color: var(--color-primary-dark);
    margin-bottom: 16px;
    text-align: center;
    letter-spacing: 1px;
    position: relative;
    display: inline-block;
    width: 100%;
}

.analysis-content {
    color: var(--color-text-main);
    font-size: 14px;
    line-height: 1.6;
    text-align: justify;
}

.wounds-box {
    background: #FFFAF9;
    padding: 16px; /* Reduced padding */
    border-radius: var(--radius-md);
    border: 1px solid var(--color-accent);
}

/* Deep Dive Items in Wounds Box */
.wound-item {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--color-primary-light);
}
.wound-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}
.wound-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.wound-cause {
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-light);
    background: rgba(255,255,255,0.6);
    padding: 6px 8px;
    border-radius: 6px;
}

/* [COMPONENT] 30 Days Guide */
.guide-section {
    margin-top: 30px;
}

.checklist-item {
    background: var(--color-white);
    padding: 16px; /* Reduced padding */
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    border-left: 4px solid transparent; 
}

/* Color coding for days */
.checklist-item.p1 { border-left-color: var(--color-primary); } 
.checklist-item.p2 { border-left-color: var(--color-secondary); } 
.checklist-item.p3 { border-left-color: var(--color-primary-dark); } 

.check-icon {
    min-width: 20px; /* Smaller icon */
    height: 20px;
    border-radius: 50%;
    background: var(--color-bg-start);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 12px;
    margin-top: 2px;
}

.check-content strong {
    display: block;
    color: var(--color-text-main);
    margin-bottom: 4px;
    font-size: 14px;
}
.check-content p {
    margin: 0;
    font-size: 13px;
    color: var(--color-text-light);
}

.book-list {
    margin-top: 15px;
    background: rgba(255,255,255,0.5);
    padding: 16px;
    border-radius: var(--radius-md);
}

.book-list li {
    list-style: none;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(0,0,0,0.05);
    font-size: 13px;
    color: var(--color-text-main);
    display: flex;
    align-items: center;
}
.book-list li::before {
    content: '📖';
    font-size: 12px;
    margin-right: 8px;
    opacity: 0.7;
}

/* Responsive adjustment for chart canvas */
canvas {
    max-width: 100%;
}

/* =========================================
   [NEW] Index & Test Page Components
   ========================================= */

/* Hero Section (Index) */
.hero-card {
    background: var(--color-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    padding: 40px var(--spacing-md);
    margin-top: 20px;
    margin-bottom: var(--spacing-lg);
    border: 1px solid rgba(255,255,255,0.8);
}

.hero-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: inline-block;
    filter: drop-shadow(0 4px 12px rgba(216, 180, 165, 0.3));
}

.hero-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--color-primary-dark);
}

.hero-subtitle {
    font-size: 15px;
    color: var(--color-text-light);
    margin-bottom: 24px;
}

.badge-tag {
    display: inline-block;
    background: var(--color-bg-start);
    color: var(--color-secondary-dark);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    border: 1px solid var(--color-secondary);
}

/* Input Group (Index) */
.input-header {
    margin: 40px 0 20px;
    text-align: center;
}

.input-group {
    position: relative;
    margin-bottom: 12px;
}

.input-field {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #EEE0DA; /* Primary Light */
    border-radius: var(--radius-pill);
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
    background: #FFF;
    text-align: center;
    color: var(--color-text-main);
}

.input-field:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(216, 180, 165, 0.15);
}

.input-field::placeholder {
    color: #CCC;
}

.error-msg {
    color: #FF5252; /* Standard Red for Error */
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    display: none;
}


/* Test Page (test.html) */
.card {
    /* Generic Card */
    background: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg) var(--spacing-md);
    box-shadow: var(--shadow-card);
    transition: all 0.3s;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    margin-bottom: 30px;
    position: relative;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: #F0F0F0;
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    border-radius: 10px;
}

.progress-text {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 12px;
    color: var(--color-text-light);
    font-weight: 600;
}

/* Navigation Header */
.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 5px;
}

.nav-back {
    cursor: pointer;
    font-size: 20px;
    color: var(--color-text-light);
    width: 40px;
    transition: color 0.2s;
}

.nav-back:hover { color: var(--color-primary); }

.nav-title {
    font-weight: 600;
    color: var(--color-primary-dark);
    font-size: 16px;
}

/* Question & Options */
.question-text {
    font-size: 20px;
    color: var(--color-text-main);
    margin-bottom: 24px;
    font-weight: 600;
    line-height: 1.5;
    min-height: 60px; /* Prevent jump */
}

.option-item {
    padding: 16px;
    border: 1.5px solid #F0F0F0;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
    color: var(--color-text-main);
    background: #FFF;
    display: flex;
    align-items: center;
}

.option-item:hover {
    border-color: var(--color-primary-light);
    background: #FFFAF9;
    transform: translateY(-1px);
}

.option-item.selected {
    background: var(--color-primary);
    color: #FFF;
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(216, 180, 165, 0.3);
}

.option-item:active {
    transform: scale(0.98);
}

/* ==================== [History Modal] ==================== */
.modal {
    position: fixed;
    top: 0; left: 0; 
    width: 100%; height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #FFF;
    width: 90%;
    max-width: 400px;
    max-height: 80vh;
    border-radius: var(--radius-lg);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-float);
    overflow: hidden;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #F0F0F0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--color-primary-dark);
}

.close-btn {
    font-size: 24px;
    color: var(--color-text-light);
    cursor: pointer;
    line-height: 1;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.history-item {
    background: #FFFAF9;
    border: 1px solid #EEE0DA;
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--color-primary);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.h-date {
    font-size: 14px;
    color: var(--color-text-light);
    font-weight: 500;
}

.h-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.score-tag {
    background: var(--color-primary);
    color: #FFF;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.arrow {
    color: var(--color-text-light);
    font-size: 16px;
}

.history-empty {
    text-align: center;
    color: var(--color-text-light);
    padding: 40px 0;
    font-style: italic;
}

.modal-footer {
    padding: 15px;
    border-top: 1px solid #F0F0F0;
    background: #FAFAFA;
}
