/* Merged CSS file - All styles combined */

/* Custom styles and Pico CSS integration */

/* Hide sections by default, show only the active one */
.section-content {
    display: block;
    margin-top: 2rem;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.section-content.hidden {
    display: block !important;
    opacity: 0;
    transform: translateY(20px);
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: none;
    pointer-events: none;
}

/* Home section card styling */
#home-section [data-section] {
    transition: all 0.3s ease;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#home-section [data-section]:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    background-color: #f8fafc !important;
}

/* Navigation styling */
nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    padding: 0;
    margin: 1rem 0;
}

nav li {
    list-style: none;
}

.nav-link {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    background-color: var(--nav-link-bg-color, var(--background-color));
    color: var(--color);
}

.nav-link.active {
    background-color: var(--primary);
    color: var(--primary-inverse);
}

/* Form styling */
form {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background-color: var(--card-background-color);
    border-radius: var(--border-radius);
    max-width: 500px;
}

form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

form input {
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

form button {
    width: 100%;
    padding: 0.75rem;
}

/* Countdown display styling */
.countdown-result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--card-background-color);
    border-radius: var(--border-radius);
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Age result styling */
.age-result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--card-background-color);
    border-radius: var(--border-radius);
}

.age-result h3 {
    margin-top: 0;
}

/* Zodiac result styling */
.zodiac-result {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: var(--card-background-color);
    border-radius: var(--border-radius);
}

.zodiac-result h3 {
    margin-top: 0;
}

/* Timeline container styling */
.timeline-result {
    margin-top: 1.5rem;
    background-color: var(--card-background-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    max-width: 100%;
    overflow-x: auto;
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timeline-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.timeline-item.milestone {
    background-color: rgba(0, 100, 255, 0.1);
    font-weight: bold;
}

/* Reaction test styling */
#reaction-test-container {
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

#reaction-test-area {
    height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid #ccc;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    background-color: #ff6b6b; /* Red background initially */
}

#reaction-target {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.1s;
}

#reaction-test-area.waiting {
    background-color: #ff6b6b; /* Red */
}

#reaction-test-area.ready {
    background-color: #9fdf7c; /* Green */
}

#reaction-instructions {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    font-weight: bold;
}

#reaction-result {
    margin: 1rem 0;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    form {
        padding: 1rem;
    }
    
    .countdown-result {
        font-size: 1.2rem;
        padding: 1rem;
    }
    
    /* Age difference calculator responsive adjustments */
    #age-diff-result .grid {
        grid-template-columns: 1fr !important;
    }
    
    /* Adjust header font size for mobile */
    .bg-gradient-to-r h2 {
        font-size: 2rem !important;
    }
}

/* Add hover effects to result cards */
.bg-gray-50.rounded-lg.p-4.text-center.border.border-gray-200 {
    transition: all 0.3s ease;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.bg-gray-50.rounded-lg.p-4.text-center.border.border-gray-200:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: #f8fafc !important;
}

/* Add transition effects to buttons */
button[type="submit"] {
    transition: all 0.2s ease-in-out !important;
}

button[type="submit"]:hover {
    transform: scale(1.02) !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
}

/* Add smooth transition to result cards */
#age-diff-result {
    transition: all 0.5s ease-in-out;
}

/* Add fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Add fade-out animation */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

.animate-fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}

/* Add subtle background pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle at 100% 100%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
                      radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.05) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

/* Add subtle border radius to all cards */
.rounded-xl {
    border-radius: 0.75rem !important;
}

/* Add shadow to all cards */
.shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.3s ease !important;
}

/* Add hover effect to all cards */
.shadow-lg:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
}

/* Optimize input focus styles */
input[type="date"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1) !important;
    border-color: #6366f1 !important;
}

/* 自定义样式文件 */

/* 导航链接活动状态 */
.nav-link.active {
    @apply bg-primary text-white;
}

.nav-link:not(.active):hover {
    @apply bg-gray-200;
}

/* 动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

/* 时间线样式 */
.timeline-item {
    @apply relative pl-8 pb-8 border-l-2 border-gray-200;
}

.timeline-item:last-child {
    @apply border-l-0;
}

.timeline-item::before {
    content: '';
    @apply absolute left-0 top-0 w-4 h-4 bg-primary rounded-full -translate-x-1/2;
    transform: translateX(-50%);
}

.timeline-date {
    @apply text-sm text-gray-500 font-medium mb-2;
}

.timeline-content {
    @apply bg-gray-50 rounded-lg p-4 shadow-sm;
}

/* 反应测试区域 */
.reaction-test-area {
    transition: all 0.1s ease;
    /* 移除可能影响居中的样式 */
}

/* 卡片悬停效果 */
.card-hover {
    @apply transition-all duration-200 hover:shadow-lg hover:-translate-y-1;
}

/* 响应式网格 */
.grid-responsive {
    @apply grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4;
}

/* 表单输入框增强 */
.form-input {
    @apply w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-primary focus:border-primary transition-colors;
}

/* 按钮样式增强 */
.btn-primary {
    @apply py-3 px-4 bg-primary hover:bg-primary-dark text-white font-medium rounded-lg transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary;
}

/* 结果显示区域 */
.result-card {
    @apply bg-white rounded-xl shadow-lg p-6 border border-gray-100;
}

/* 统计数字 */
.stat-number {
    @apply text-3xl font-bold text-primary;
}

.stat-label {
    @apply text-sm text-gray-600 font-medium;
}

/* 进度条 */
.progress-bar {
    @apply w-full bg-gray-200 rounded-full h-2 overflow-hidden;
}

.progress-fill {
    @apply bg-primary h-full rounded-full transition-all duration-500 ease-out;
}

/* 标签样式 */
.tag {
    @apply inline-block px-3 py-1 text-xs font-medium rounded-full;
}

.tag-primary {
    @apply bg-blue-100 text-blue-800;
}

.tag-secondary {
    @apply bg-green-100 text-green-800;
}

.tag-accent {
    @apply bg-purple-100 text-purple-800;
}

/* 分割线 */
.divider {
    @apply border-t border-gray-200 my-6;
}

/* 加载动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.loading {
    animation: spin 1s linear infinite;
}

/* 错误消息样式 */
.error-message {
    @apply bg-red-50 border border-red-200 text-red-700 px-4 py-3 rounded-lg flex items-center;
}

.success-message {
    @apply bg-green-50 border border-green-200 text-green-700 px-4 py-3 rounded-lg flex items-center;
}

.warning-message {
    @apply bg-yellow-50 border border-yellow-200 text-yellow-700 px-4 py-3 rounded-lg flex items-center;
}

/* 工具提示 */
.tooltip {
    @apply relative inline-block;
}

.tooltip:hover .tooltip-text {
    @apply opacity-100 visible;
}

.tooltip-text {
    @apply invisible opacity-0 absolute bottom-full left-1/2 transform -translate-x-1/2 mb-2 px-2 py-1 text-xs text-white bg-gray-800 rounded whitespace-nowrap transition-all duration-200 z-10;
}

/* 响应式文字大小 */
.text-responsive {
    @apply text-sm sm:text-base;
}

.text-responsive-lg {
    @apply text-lg sm:text-xl lg:text-2xl;
}

/* 滚动条美化 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #6366f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4f46e5;
}

/* Reaction Time Test - Modern Design */

/* Reset and base styles */
#reaction-section {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow: hidden;
}

/* Container styles */
#reaction-section > div {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
}

/* Test area styles - initial state (blue) */
#reaction-test-area {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
    position: relative;
    overflow: hidden;
}

/* Test area - waiting state (red) */
#reaction-test-area.waiting {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

/* Test area - ready state (green) */
#reaction-test-area.ready {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

/* Test area - result state (blue again) */
#reaction-test-area.result {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Icon styles */
#reaction-icon {
    transition: all 0.3s ease;
    opacity: 1;
}

/* Hide icon in waiting, ready, and result states */
#reaction-test-area.waiting #reaction-icon,
#reaction-test-area.ready #reaction-icon,
#reaction-test-area.result #reaction-icon {
    opacity: 0;
    transform: scale(0.8);
}

/* Title styles */
#reaction-title {
    transition: all 0.3s ease;
    opacity: 1;
}

/* Hide title in waiting, ready, and result states */
#reaction-test-area.waiting #reaction-title,
#reaction-test-area.ready #reaction-title,
#reaction-test-area.result #reaction-title {
    opacity: 0;
    transform: translateY(-20px);
}

/* Instructions styles */
#reaction-instructions {
    transition: all 0.3s ease;
    opacity: 1;
}

/* Hide instructions in waiting, ready, and result states */
#reaction-test-area.waiting #reaction-instructions,
#reaction-test-area.ready #reaction-instructions,
#reaction-test-area.result #reaction-instructions {
    opacity: 0;
}

/* Start prompt styles */
#reaction-start {
    transition: all 0.3s ease;
    opacity: 0.8;
}

/* Hide start prompt in waiting, ready, and result states */
#reaction-test-area.waiting #reaction-start,
#reaction-test-area.ready #reaction-start,
#reaction-test-area.result #reaction-start {
    opacity: 0;
}

/* Dots container styles */
#reaction-dots {
    transition: all 0.3s ease;
    opacity: 0;
}

/* Show dots in waiting and ready states */
#reaction-test-area.waiting #reaction-dots,
#reaction-test-area.ready #reaction-dots {
    opacity: 1;
}

/* Hide dots in result state */
#reaction-test-area.result #reaction-dots {
    opacity: 0;
}

/* Individual dot styles */
.dot {
    transition: all 0.6s ease;
    animation: pulse 1.5s infinite ease-in-out;
}

/* Dot animation */
@keyframes pulse {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Staggered animation for dots */
.dot:nth-child(1) {
    animation-delay: 0s;
}

.dot:nth-child(2) {
    animation-delay: 0.3s;
}

.dot:nth-child(3) {
    animation-delay: 0.6s;
}

/* Waiting state text */
.waiting-text {
    font-size: 4rem;
    font-weight: bold;
    margin: 0;
    transition: all 0.3s ease;
    opacity: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Show waiting text in waiting state */
#reaction-test-area.waiting .waiting-text {
    opacity: 1;
}

/* Ready state text */
.ready-text {
    font-size: 6rem;
    font-weight: bold;
    margin: 0;
    transition: all 0.3s ease;
    opacity: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Show ready text in ready state */
#reaction-test-area.ready .ready-text {
    opacity: 1;
}

/* Result container styles */
#reaction-result {
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
    position: relative;
    z-index: 10;
    text-align: center !important;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

/* Show result in result state */
#reaction-test-area.result #reaction-result {
    opacity: 1;
    transform: translateY(0);
}

/* Result icon styles */
#result-icon {
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

/* Show result icon in result state */
#reaction-test-area.result #result-icon {
    opacity: 1;
    transform: scale(1);
}

/* Result time styles */
#result-time {
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
}

/* Show result time in result state */
#reaction-test-area.result #result-time {
    opacity: 1;
    transform: scale(1);
}

/* Result unit styles */
#result-unit {
    transition: all 0.3s ease;
    opacity: 0;
}

/* Show result unit in result state */
#reaction-test-area.result #result-unit {
    opacity: 1;
}

/* Result prompt styles */
#result-prompt {
    transition: all 0.3s ease;
    opacity: 0;
    margin-top: 1rem;
}

/* Show result prompt in result state */
#reaction-test-area.result #result-prompt {
    opacity: 0.8;
}

/* Too soon message styles */
#too-soon-message {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 20;
}

/* Show too soon message */
#reaction-test-area.too-soon #too-soon-message {
    display: flex;
}

/* Hide other elements when too soon message is shown */
#reaction-test-area.too-soon #reaction-icon,
#reaction-test-area.too-soon #reaction-title,
#reaction-test-area.too-soon #reaction-instructions,
#reaction-test-area.too-soon #reaction-start,
#reaction-test-area.too-soon #reaction-dots,
#reaction-test-area.too-soon .waiting-text,
#reaction-test-area.too-soon .ready-text,
#reaction-test-area.too-soon #reaction-result {
    opacity: 0;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #reaction-title {
        font-size: 3rem;
    }
    
    #reaction-instructions {
        font-size: 1rem;
    }
    
    #reaction-start {
        font-size: 0.9rem;
    }
    
    .waiting-text {
        font-size: 3rem;
    }
    
    .ready-text {
        font-size: 4rem;
    }
    
    #result-time {
        font-size: 5rem;
    }
    
    #result-unit {
        font-size: 1.5rem;
    }
}

/**
 * Centering Fix for Reaction Speed Test
 * Ensures all elements are perfectly centered regardless of screen size
 */

/* Force centering for critical elements */
#reaction-test-container,
#reaction-test-area,
#reaction-instructions,
#reaction-target,
#reaction-result {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Ensure text elements are centered */
#reaction-instructions,
#reaction-title,
#reaction-result p,
.reaction-benchmark {
    text-align: center !important;
    display: block !important;
    width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Ensure container is centered */
#reaction-test-container {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    position: relative !important;
}

/* Ensure test area is centered */
#reaction-test-area {
    margin: 0 auto 1rem auto !important;
    max-width: 100% !important;
    position: relative !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
}

/* Ensure target is centered */
#reaction-target {
    margin: 0 auto !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
}

/* Ensure result is centered */
#reaction-result {
    margin: 2rem auto !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
}

/* Override any conflicting styles */
.reaction-test-area,
.reaction-test-container {
    justify-content: center !important;
    align-items: center !important;
}

/* For responsive screens */
@media (max-width: 768px) {
    #reaction-test-area {
        max-width: 100% !important;
    }
    
    #reaction-target {
        width: 200px !important;
        height: 200px !important;
    }
}

@media (max-width: 480px) {
    #reaction-test-area {
        max-width: 100% !important;
        padding: 0 10px !important;
    }
    
    #reaction-target {
        width: 150px !important;
        height: 150px !important;
    }
    
    #reaction-instructions {
        font-size: 1.5rem !important;
    }
}

/**
 * Width Synchronization Styles for Reaction Test
 * Ensures reaction-test-area width matches reaction-section width
 */

/* Base styles for width synchronization */
#reaction-test-area.width-synced {
    box-sizing: border-box;
    margin: 0 auto;
    padding: 0;
}

/* Ensure container allows for full width matching */
#reaction-test-container {
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    margin: 0;
}

/* Override any conflicting width styles */
#reaction-test-area.width-synced {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

/* Handle padding inside the section */
#reaction-section .p-6 {
    box-sizing: border-box;
}

/* Ensure the test area fits within the section padding */
#reaction-section #reaction-test-area {
    max-width: 100%;
    margin: 0 auto;
}

/* For smaller screens, ensure full width */
@media (max-width: 768px) {
    #reaction-section #reaction-test-area {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    #reaction-section #reaction-test-area {
        max-width: 100%;
    }
}

/* Visual indicator for debugging (can be removed in production) */
#reaction-test-area.width-synced::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 1px dashed rgba(255, 255, 255, 0.3);
    pointer-events: none;
    z-index: 100;
}

/* Additional centering to complement width synchronization */
#reaction-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#reaction-section > div {
    width: 100%;
    max-width: 100%;
}

/* Ensure the container inside section respects width constraints */
#reaction-section #reaction-test-container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Timeline specific styles */
@import url('css/timeline.css');
