/* 全局交互动效 - 按钮反馈、淡入淡出、移动端优化 */

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

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

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

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ripple {
    to { transform: scale(2.5); opacity: 0; }
}

.page-enter {
    animation: fadeInUp 0.45s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

.fade-in-up {
    animation: fadeInUp 0.45s ease forwards;
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* 按钮点击反馈 */
.btn, .tab, .filter-tab, .card a.card-title {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn {
    position: relative;
    overflow: hidden;
    user-select: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.96);
    transition-duration: 0.1s;
}

.btn .btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    transform: scale(0);
    animation: ripple 0.55s ease-out;
    pointer-events: none;
}

.btn-outline:active:not(:disabled),
.btn-ghost:active:not(:disabled) {
    background: rgba(91, 181, 213, 0.2);
}

.card:active {
    transition-duration: 0.12s;
}

/* 弹窗动效增强 */
.modal-overlay.show .modal {
    animation: modalIn 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.closing {
    opacity: 0;
    visibility: hidden;
}

.modal-overlay.closing .modal {
    animation: fadeOut 0.2s ease forwards;
}

/* 天气面板 */
.weather-panel {
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(91, 181, 213, 0.12), rgba(126, 200, 227, 0.08));
    border: 1px solid rgba(91, 181, 213, 0.25);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    font-size: 0.88rem;
    line-height: 1.65;
}

.weather-line {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
    align-items: baseline;
}

.weather-line + .weather-line {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed rgba(91, 181, 213, 0.25);
}

.weather-line strong {
    color: var(--color-primary-dark);
    font-weight: 600;
    white-space: nowrap;
}

.weather-hint {
    color: var(--color-text-muted);
    margin: 0;
}

.weather-loading {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* 活动详情页进入 */
#activityContent.page-ready {
    animation: fadeInUp 0.4s ease forwards;
}

#activityLoading, #activityError, #passwordGate {
    animation: fadeIn 0.3s ease;
}

/* 移动端增强 */
@media (max-width: 768px) {
    html {
        touch-action: manipulation;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    body {
        touch-action: manipulation;
        overscroll-behavior-y: contain;
    }

    body.modal-open {
        overflow: hidden;
        touch-action: none;
    }

    .form-input, .form-textarea, .form-select, .search-input {
        font-size: 16px;
    }

    .map-preview, .map-picker {
        touch-action: pan-x pan-y;
        -webkit-user-select: none;
        user-select: none;
    }

    .recaptcha-wrap > div {
        transform: scale(0.92);
    }

    :root {
        --nav-height: 56px;
    }

    .main-content {
        padding-top: calc(var(--nav-height) + 16px);
        padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    }

    .navbar-inner { padding: 0 12px; }

    .btn {
        min-height: 44px;
        padding: 12px 20px;
    }

    .btn-sm { min-height: 38px; }

    .detail-card { padding: 20px 16px; }

    .detail-hero-overlay h1 { font-size: 1.35rem; }

    .detail-content { padding: 0 12px; margin-top: -32px; }

    .detail-section h3 { font-size: 0.95rem; }

    .map-preview { height: 180px; }

    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-wrapper, .search-bar .form-select {
        width: 100%;
        min-width: 0;
    }

    .filter-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .filter-tabs::-webkit-scrollbar { display: none; }

    .filter-tab { flex-shrink: 0; }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .tabs::-webkit-scrollbar { display: none; }

    .tab { flex: 0 0 auto; min-width: 88px; padding: 10px 14px; }

    .modal {
        width: 94%;
        max-height: 90vh;
        padding: 22px 18px;
        margin: auto 0 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .modal-overlay {
        align-items: flex-end;
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .modal-overlay.show .modal {
        animation: modalSheetIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    @keyframes modalSheetIn {
        from { transform: translateY(100%); opacity: 0.8; }
        to { transform: translateY(0); opacity: 1; }
    }

    .hero { padding: 32px 16px 24px; }

    .hero-actions .btn { width: 100%; max-width: 280px; }

    .activity-grid { gap: 14px; }

    .card:hover { transform: none; }

    .card:active { transform: none; }

    .btn:active:not(:disabled) {
        transform: none;
    }

    .detail-actions .btn-lg { font-size: 1rem; }

    .weather-panel { font-size: 0.85rem; padding: 12px 14px; }

    .carpool-step { font-size: 0.85rem; }

    .toast {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        max-width: calc(100% - 32px);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .detail-hero { height: 200px; border-radius: 0; }

    .detail-hero-overlay { padding: 24px 16px; }

    .join-status-banner { padding: 14px; font-size: 0.88rem; }
}

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