/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    --bg-white: #ffffff;
    --bg-light: #f8fafc;
    --bg-dark: #0f172a;
    --border-light: #e2e8f0;
    --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-large: 0 20px 25px rgba(0, 0, 0, 0.08);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-light);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== 主容器布局 ===== */
.main-container {
    display: grid;
    grid-template-columns: 420px 1fr;
    min-height: 100vh;
    background: var(--bg-white);
}

/* ===== 左侧面板 ===== */
.left-panel {
    background: var(--bg-dark);
    color: white;
    padding: 60px 50px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.left-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(30, 64, 175, 0.05) 100%);
    pointer-events: none;
}

.branding {
    position: relative;
    z-index: 1;
    text-align: center;
}

.logo-wrapper {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.logo-icon {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 4px 12px rgba(37, 99, 235, 0.3));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #e0e7ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: 0.95rem;
    color: #94a3b8;
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* ===== 输入区域 ===== */
.input-wrapper {
    position: relative;
    z-index: 1;
    margin-top: 60px;
}

.input-field {
    margin-bottom: 24px;
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #cbd5e1;
    margin-bottom: 12px;
    letter-spacing: 0.01em;
}

/* 输入方式切换标签 */
.input-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.tab-btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-family: inherit;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: white;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.input-tab-content {
    display: none;
}

.input-tab-content.active {
    display: block;
}

.date-input,
.time-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-family: inherit;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.date-input:hover,
.time-input:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
}

.date-input:focus,
.time-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.date-input::-webkit-calendar-picker-indicator,
.time-input::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.5);
    cursor: pointer;
    width: 20px;
    height: 20px;
}

/* 占位符样式 */
.date-input::-webkit-datetime-edit-text,
.date-input::-webkit-datetime-edit-month-field,
.date-input::-webkit-datetime-edit-day-field,
.date-input::-webkit-datetime-edit-year-field {
    color: rgba(255, 255, 255, 0.6);
}

.time-input::-webkit-datetime-edit-text,
.time-input::-webkit-datetime-edit-hour-field,
.time-input::-webkit-datetime-edit-minute-field {
    color: rgba(255, 255, 255, 0.9);
}

/* 未选择时的提示 */
.date-input:invalid {
    color: rgba(255, 255, 255, 0.5);
}

.date-input::before {
    content: attr(placeholder);
    color: rgba(255, 255, 255, 0.5);
}

.date-input:focus::before,
.date-input:valid::before {
    content: '';
}

/* 手动输入框样式 */
.date-input-manual {
    width: 100%;
    padding: 14px 18px;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: white;
    font-family: inherit;
    transition: var(--transition-smooth);
    backdrop-filter: blur(10px);
}

.date-input-manual::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.date-input-manual:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}

.date-input-manual:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.input-hint {
    margin-top: 8px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.4;
}

.calc-button {
    width: 100%;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--bg-dark);
    background: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-top: 32px;
    letter-spacing: 0.02em;
}

.calc-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(255, 255, 255, 0.2);
}

.calc-button:active {
    transform: translateY(0);
}

/* ===== 错误消息 ===== */
.error-message {
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 0.875rem;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.error-message::before {
    content: '⚠ ';
    margin-right: 6px;
}

/* ===== 页脚信息 ===== */
.footer-info {
    position: relative;
    z-index: 1;
    font-size: 0.875rem;
    color: #64748b;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-info p {
    margin-bottom: 12px;
}

.footer-link {
    display: inline-block;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 6px 14px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
    letter-spacing: 0.02em;
}

.footer-link:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.footer-link:active {
    transform: translateY(0);
}

/* ===== 右侧面板 ===== */
.right-panel {
    background: var(--bg-light);
    padding: 70px 80px;
    overflow-y: auto;
    position: relative;
}

.right-panel::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 200px;
    background: linear-gradient(180deg, rgba(37, 99, 235, 0.03) 0%, transparent 100%);
    pointer-events: none;
}

/* ===== 欢迎状态 ===== */
.welcome-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    text-align: center;
    animation: fadeIn 0.6s ease;
}

.welcome-icon {
    font-size: 5rem;
    margin-bottom: 30px;
    opacity: 0.3;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.welcome-state h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.welcome-state p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    margin: 8px 0;
}

/* ===== 结果容器 ===== */
.result-container {
    animation: slideInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== 主年龄显示 ===== */
.hero-age {
    margin-bottom: 45px;
    padding-bottom: 35px;
    border-bottom: 2px solid var(--border-light);
}

.age-display {
    display: flex;
    align-items: baseline;
    gap: 18px;
    margin-bottom: 18px;
}

.age-number {
    font-size: 8rem;
    font-weight: 900;
    line-height: 1;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.age-label {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.birth-date {
    font-size: 1.15rem;
    color: var(--text-tertiary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* ===== 详细分解显示 ===== */
.breakdown-display {
    background: white;
    border-radius: 20px;
    padding: 45px 40px;
    margin-bottom: 35px;
    box-shadow: var(--shadow-medium);
}

.breakdown-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 25px;
}

.breakdown-row:last-child {
    margin-bottom: 0;
}

.breakdown-cell {
    text-align: center;
    padding: 24px 16px;
    background: var(--bg-light);
    border-radius: 14px;
    transition: var(--transition-smooth);
}

.breakdown-cell:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-soft);
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.cell-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1.1;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.cell-label {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* ===== 总计数据网格 ===== */
.totals-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 40px;
}

.total-item {
    background: white;
    padding: 28px 20px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--border-light);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 120px;
}

.total-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.total-value {
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.01em;
    line-height: 1.5;
}

.total-value strong {
    display: block;
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.total-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-top: 8px;
}

/* ===== 生日信息 ===== */
.birthday-info {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    padding: 28px 36px;
    border-radius: 16px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: #92400e;
    border: 2px solid #fbbf24;
    animation: fadeIn 0.8s ease;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.2);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== 响应式设计 ===== */
@media (max-width: 1400px) {
    .right-panel {
        padding: 60px 50px;
    }
    
    .age-number {
        font-size: 7rem;
    }
    
    .cell-value {
        font-size: 3rem;
    }
    
    .total-value {
        font-size: 1.85rem;
    }
}

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 380px 1fr;
    }
    
    .right-panel {
        padding: 50px 40px;
    }
    
    .age-number {
        font-size: 6rem;
    }
    
    .age-label {
        font-size: 2.2rem;
    }
    
    .cell-value {
        font-size: 2.8rem;
    }
    
    .total-value {
        font-size: 1.75rem;
    }
    
    .totals-grid {
        gap: 14px;
    }
}

@media (max-width: 968px) {
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .left-panel {
        padding: 40px 30px;
        min-height: auto;
    }
    
    .logo-icon {
        width: 70px;
        height: 70px;
    }
    
    .input-wrapper {
        margin-top: 40px;
    }
    
    .right-panel {
        padding: 40px 30px;
    }
    
    .age-number {
        font-size: 4.5rem;
    }
    
    .age-label {
        font-size: 2rem;
    }
    
    .breakdown-row {
        gap: 15px;
    }
    
    .cell-value {
        font-size: 2rem;
    }
    
    .totals-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .left-panel {
        padding: 30px 20px;
    }
    
    .logo-icon {
        width: 60px;
        height: 60px;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .right-panel {
        padding: 30px 20px;
    }
    
    .age-number {
        font-size: 3.5rem;
    }
    
    .age-label {
        font-size: 1.5rem;
    }
    
    .breakdown-display {
        padding: 24px 20px;
    }
    
    .breakdown-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .breakdown-cell {
        padding: 16px 12px;
    }
    
    .cell-value {
        font-size: 1.75rem;
    }
    
    .cell-label {
        font-size: 0.8rem;
    }
    
    .totals-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .total-item {
        padding: 20px;
    }
    
    .total-value {
        font-size: 1.5rem;
    }
    
    .birthday-info {
        padding: 20px;
        font-size: 0.95rem;
    }
    
    .welcome-state {
        min-height: 300px;
    }
    
    .welcome-icon {
        font-size: 3.5rem;
    }
    
    .welcome-state h2 {
        font-size: 1.5rem;
    }
    
    .welcome-state p {
        font-size: 0.95rem;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .left-panel {
        display: none;
    }
    
    .main-container {
        grid-template-columns: 1fr;
    }
    
    .right-panel {
        padding: 20px;
    }
}

/* ===== 深色模式支持（可选） ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-light: #1e293b;
        --bg-white: #0f172a;
        --text-primary: #f1f5f9;
        --text-secondary: #cbd5e1;
        --text-tertiary: #64748b;
        --border-light: #334155;
    }
}

/* ===== 滚动条美化 ===== */
.right-panel::-webkit-scrollbar {
    width: 8px;
}

.right-panel::-webkit-scrollbar-track {
    background: transparent;
}

.right-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.right-panel::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
