/* 日期选择器样式 */
.date-select-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.date-select-btn:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-select-btn:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* 浮动按钮样式 */
#timeCalcFloatBtn {
    animation: floatBounce 3s ease-in-out infinite;
}

#timeCalcFloatBtn:active {
    transform: scale(0.95);
}

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

/* 时长选择按钮样式 */
.duration-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    position: relative;
}

.duration-btn:active {
    transform: scale(0.95);
}

.duration-btn.clicked {
    background-color: #3b82f6 !important;
    color: white !important;
    border-color: #3b82f6 !important;
    transform: scale(1.05);
}

.duration-btn.clicked::after {
    content: '+1';
    position: absolute;
    top: -20px;
    right: 50%;
    transform: translateX(50%);
    font-size: 12px;
    color: #3b82f6;
    font-weight: bold;
    animation: floatUp 0.5s ease-out forwards;
    pointer-events: none;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateX(50%) translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateX(50%) translateY(-15px);
    }
}

/* 时间输入框样式 */
input[type="time"] {
    cursor: pointer;
}

input[type="time"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: opacity(0.6);
    transition: all 0.2s;
}

input[type="time"]::-webkit-calendar-picker-indicator:hover {
    filter: opacity(1);
}

/* 日期选择器模态框 */
.date-picker-modal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.date-picker-modal.show {
    opacity: 1;
    pointer-events: all;
}

.date-picker-modal.show .date-picker-content {
    transform: scale(1);
}

/* 日期导航按钮 */
.date-nav-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.date-nav-btn:active {
    transform: scale(0.95);
}

/* 日期网格 */
.date-day {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    background: transparent;
    color: #374151;
}

.date-day:hover {
    background-color: #e0e7ff;
    color: #3730a3;
}

.date-day.selected {
    background-color: #3b82f6;
    color: white;
    font-weight: 600;
}

.date-day.today {
    background-color: #dbeafe;
    color: #1d4ed8;
    font-weight: 600;
}

.date-day.member-day {
    background-color: #fef3c7;
    color: #d97706;
    position: relative;
}

.date-day.member-day::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background-color: #f59e0b;
    border-radius: 50%;
}

.date-day.member-day.selected {
    background-color: #f59e0b;
    color: white;
}

.date-day.member-day.selected::after {
    background-color: white;
}

.date-day.other-month {
    color: #d1d5db;
}

.date-day.other-month:hover {
    background-color: #f9fafb;
    color: #9ca3af;
}

.date-day:active {
    transform: scale(0.95);
}

/* 日期选择器动画 */
@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.date-picker-content {
    animation: fadeInScale 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tab切换样式 */
.tab-btn, .record-tab-btn, .chart-tab-btn {
    position: relative;
    z-index: 1;
}

.tab-btn.active, .record-tab-btn.active, .chart-tab-btn.active {
    color: white;
    background-color: #3b82f6;
}

.tab-btn:not(.active), .record-tab-btn:not(.active), .chart-tab-btn:not(.active) {
    color: #6b7280;
    background-color: transparent;
}

.tab-content, .record-content {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
}

.tab-content.hidden, .record-content.hidden {
    display: none;
}

/* Tab切换动画 */
.tab-content.slide-in, .record-content.slide-in {
    animation: slideInTab 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInTab {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* iOS风格自定义样式 */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* 余额卡片动画 */
.balance-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.balance-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.balance-amount {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 编辑按钮动画 */
.edit-balance-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.edit-balance-btn:active {
    transform: scale(0.95);
}

/* 服务卡片动画 */
.quick-service-card, .custom-consume-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.quick-service-card:hover, .custom-consume-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
}

/* 数量按钮动画 */
.quantity-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.quantity-btn:active {
    transform: scale(0.9);
    background-color: #e5e7eb;
}

/* 消费按钮动画 */
.consume-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

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

.consume-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    transition: width 0.3s, height 0.3s, top 0.3s, left 0.3s;
    transform: translate(-50%, -50%);
}

.consume-btn:active::before {
    width: 300px;
    height: 300px;
}

/* 消费记录卡片 */
.record-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    opacity: 0;
    transform: translateY(20px);
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.record-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.1);
}

/* 滑动删除动画 */
.record-card.swipe-delete {
    transform: translateX(-100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 删除按钮 */
.delete-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.7;
}

.delete-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.delete-btn:active {
    transform: scale(0.9);
}

/* 会员日横幅 */
.member-day-banner {
    animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(-20px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 模态框动画 */
.modal {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal.show .modal-content {
    transform: scale(1);
}

/* 自定义对话框按钮动画 */
.modal button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal button:active {
    transform: scale(0.98);
}

/* 自定义图标动画 */
.modal #alertIcon {
    animation: iconBounce 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes iconBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 输入框聚焦动画 */
input:focus {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 价格数字动画 */
.price-update {
    animation: priceChange 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes priceChange {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        color: #3b82f6;
    }
    100% {
        transform: scale(1);
    }
}

/* 触觉反馈模拟 */
.haptic-feedback {
    animation: haptic 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes haptic {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.98);
    }
}

/* 加载动画 */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 成功动画 */
.success-animation {
    animation: success 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes success {
    0% {
        transform: scale(1);
        background-color: currentColor;
    }
    50% {
        transform: scale(1.05);
        background-color: #10b981;
    }
    100% {
        transform: scale(1);
        background-color: currentColor;
    }
}

/* 响应式优化 */
@media (max-width: 480px) {
    .balance-card {
        margin: 0 -0.5rem;
    }

    .quick-service-card, .custom-consume-card {
        margin: 0 -0.5rem;
    }
}

/* 深色模式适配 */
@media (prefers-color-scheme: dark) {
    .modal {
        backdrop-filter: blur(10px) brightness(0.7);
        -webkit-backdrop-filter: blur(10px) brightness(0.7);
    }
}

/* 减少动画效果（无障碍性） */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}