/* 
 * Life Audit Design System V3.0
 * Theme: Cyber Fortune Teller x Republican Era Accountant
 */

/* 十神术语悬浮提示 */
.tooltip-term {
    border-bottom: 1px dashed #999;
    cursor: help;
    position: relative;
    display: inline-block;
    /* Ensure proper spacing */
}

.tooltip-term:hover {
    color: var(--vermilion);
    border-bottom-color: var(--vermilion);
}

.tooltip-term::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1F2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.tooltip-term:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

:root {
    /* Colors */
    --bg-paper: #FDFBF7;
    --ink-primary: #1F2937;
    --ink-secondary: #4B5563;
    --vermilion: #C23531;
    /* Stamp Red */
    --gold: #D4AF37;
    /* Metal / Grade S */
    --green: #10B981;
    /* Wood / Grade A */
    --blue: #3B82F6;
    /* Water / Grade B */
    --orange: #F97316;
    /* Fire / Grade C */
    --brown: #92400E;
    /* Earth / Grade N */
    --gray: #9CA3AF;

    /* Typography */
    --font-serif: "Noto Serif SC", "Songti SC", serif;
    --font-sans: "Noto Sans SC", sans-serif;
    --font-hand: "Ma Shan Zheng", cursive;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #f0f0f0;
    font-family: var(--font-sans);
    color: var(--ink-primary);
}

/* --- Container & Views --- */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    min-height: 100vh;
    background-color: var(--bg-paper);
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.05'/%3E%3C/svg%3E");
}

.view {
    display: none;
    min-height: 100vh;
    padding: var(--spacing-lg);
    animation: fadeIn 0.5s ease;
}

.view.active {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* --- High-End Header Styling --- */
.main-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: 60px 20px;
    border-bottom: 2px solid var(--ink-primary);
    position: relative;
    background: radial-gradient(circle at center, rgba(238, 197, 102, 0.1) 0%, transparent 70%);
}

.seal-container {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border: 3px solid var(--vermilion);
    border-radius: 8px;
    box-shadow:
        0 0 0 2px var(--bg-paper),
        0 0 0 4px var(--vermilion),
        0 4px 12px rgba(194, 53, 49, 0.15);
    background-color: rgba(255, 250, 240, 0.5);
    transform: rotate(-2deg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.seal-container:hover {
    transform: rotate(0deg) scale(1.05);
}

.seal-mark {
    font-family: "STKaiti", "KaiTi", "楷体", "Noto Serif SC", serif;
    font-weight: 900;
    font-size: 26px;
    color: var(--vermilion);
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    line-height: 1;
    text-shadow: 0 0 1px rgba(194, 53, 49, 0.2);
    padding: 2px;
}

.app-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
    letter-spacing: 2px;
    color: var(--ink-primary);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.05);
}

.app-subtitle-text {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--ink-secondary);
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 20px;
}

.bazi-pill {
    display: inline-block;
    background: rgba(238, 197, 102, 0.2);
    color: var(--ink-primary);
    padding: 4px 10px;
    margin: 0 4px;
    border-radius: 4px;
    font-weight: bold;
    border: 1px solid rgba(238, 197, 102, 0.5);
    font-family: 'Kaiti', serif;
    font-size: 1.1rem;
}

/* --- Input Section --- */
.input-section {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: var(--spacing-lg);
    text-align: left;
}

.form-group label {
    display: block;
    font-family: var(--font-serif);
    margin-bottom: var(--spacing-sm);
    color: var(--ink-secondary);
}

.ink-input {
    width: 100%;
    padding: var(--spacing-md);
    border: none;
    border-bottom: 2px solid var(--ink-primary);
    background: transparent;
    font-family: var(--font-hand);
    font-size: 1.3rem;
    outline: none;
    transition: border-color 0.3s;
}

.ink-input:focus {
    border-bottom-color: var(--vermilion);
}

.ink-button {
    width: 100%;
    padding: var(--spacing-md);
    background-color: var(--ink-primary);
    color: var(--bg-paper);
    border: none;
    font-family: var(--font-serif);
    font-size: 1.2rem;
    cursor: pointer;
    margin-top: var(--spacing-lg);
    transition: transform 0.1s;
    border-radius: 4px;
}

.ink-button:active {
    transform: scale(0.98);
}

/* --- Ritual View --- */
#ritual-view {
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.ritual-text {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    margin-bottom: var(--spacing-lg);
    text-align: center;
    color: var(--ink-primary);
}

.ritual-progress-bar {
    width: 60%;
    height: 6px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.ritual-progress-fill {
    height: 100%;
    background-color: var(--ink-primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* --- Report View --- */
.report-header {
    border-bottom: 4px solid var(--ink-primary);
    padding-bottom: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.report-title {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    color: var(--ink-primary);
}

.report-meta-grid {
    display: flex;
    gap: var(--spacing-lg);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--ink-secondary);
    margin-top: var(--spacing-sm);
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
    padding-top: 10px;
}

/* Auditor Section */
.opinion-box {
    background-color: rgba(31, 41, 55, 0.03);
    padding: 25px;
    border-left: 5px solid var(--ink-primary);
    margin-bottom: 30px;
    border-radius: 0 8px 8px 0;
}

#roast-text {
    font-family: var(--font-hand);
    font-size: 1.4rem;
    color: var(--vermilion);
    margin-bottom: 15px;
}

#auditor-summary-text {
    font-size: 1.1rem;
    line-height: 1.8;
}

/* Lists */
.card-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    border-bottom: 1px dashed #ddd;
    padding-bottom: 15px;
}

.card-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.grade-badge {
    padding: 4px 12px;
    border-radius: 4px;
    color: white;
    font-weight: bold;
    font-size: 1.1rem;
    font-family: sans-serif;
}

/* Action Note */
.action-note {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    padding: 12px;
    border-radius: 6px;
    color: #991B1B;
    font-size: 0.95rem;
    margin-top: 10px;
}

/* Owner's Equity */
.owners-equity {
    background: #fdfaf5;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 40px;
    margin-top: 50px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.owners-equity::before {
    content: "CONFIDENTIAL";
    position: absolute;
    top: 20px;
    right: -30px;
    background: rgba(200, 0, 0, 0.1);
    color: rgba(200, 0, 0, 0.2);
    padding: 5px 40px;
    transform: rotate(45deg);
    font-weight: bold;
    font-size: 1.2rem;
    pointer-events: none;
}

.handwritten-advice {
    font-family: var(--font-hand);
    font-size: 1.35rem;
    line-height: 1.7;
    color: #4b5563;
}

/* K-Line Chart */
#kline-loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 30px;
    border-radius: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    font-family: var(--font-serif);
    border: 1px solid #eee;
}


/* --- Calibration View (Bazi Pillars) --- */
#bazi-container {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin: 40px auto;
    max-width: 800px;
}

.pillar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.pillar-label {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    color: var(--ink-secondary);
    font-weight: bold;
    border-bottom: 2px solid rgba(0, 0, 0, 0.1);
    padding-bottom: 5px;
    margin-bottom: 5px;
}

.pillar-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom Select Styling for Pillars */
.bazi-select-wrapper {
    position: relative;
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 2rem;
    cursor: pointer;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
}

.bazi-select-wrapper:hover {
    transform: scale(1.1);
    background-color: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
}

.wuxing-tag {
    position: absolute;
    right: -10px;
    top: 0;
    font-size: 0.7rem;
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: var(--font-sans);
    line-height: 1;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- New Header Actions (V4.8) --- */

/* --- Modal Overlay (V5.1) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}