/**
 * 整站公共样式 - 页脚及通用组件
 * 与 includes/header.php 内联样式配合，变量来自 :root
 */

/* ========== 全局动画效果 ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

/* 页面加载淡入 */
body {
    animation: fadeIn 0.4s ease-out;
}

/* 滚动动画元素（默认隐藏，JS 控制显示） */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* 延迟动画 */
.animate-on-scroll.delay-1 { transition-delay: 0.1s; }
.animate-on-scroll.delay-2 { transition-delay: 0.2s; }
.animate-on-scroll.delay-3 { transition-delay: 0.3s; }
.animate-on-scroll.delay-4 { transition-delay: 0.4s; }

/* 卡片增强动画 */
.card {
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.card:hover {
    transform: translateY(-4px);
}

/* 按钮增强动画 */
.btn {
    transition: transform 0.2s ease,
                box-shadow 0.2s ease,
                background-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover,
.btn-success:hover,
.btn-info:hover,
.btn-warning:hover,
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* 链接增强动画 */
a:not(.btn):not(.nav-link):not(.dropdown-item) {
    transition: color 0.2s ease, padding-left 0.2s ease;
}

a:not(.btn):not(.nav-link):not(.dropdown-item):hover {
    color: var(--primary);
}

/* 输入框聚焦动画 */
.form-control:focus,
.form-select:focus {
    transform: scale(1.01);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 图片加载动画 */
img {
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img[loading="lazy"].loaded {
    opacity: 1;
}

/* 导航链接动画 */
.nav-link {
    position: relative;
    transition: color 0.2s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease, left 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
    left: 50%;
}

/* 列表项动画 */
.list-group-item {
    transition: background-color 0.2s ease,
                transform 0.2s ease,
                padding-left 0.2s ease;
}

.list-group-item:hover {
    transform: translateX(4px);
    padding-left: 12px;
}

/* 表格行动画 */
.table tbody tr {
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.table tbody tr:hover {
    transform: scale(1.01);
}

/* 模态框动画 */
.modal.fade .modal-dialog {
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    transform: translateY(-50px);
}

.modal.show .modal-dialog {
    transform: translateY(0);
}

/* 下拉菜单动画 */
.dropdown-menu {
    animation: fadeInDown 0.2s ease-out;
}

/* 工具提示动画 */
.tooltip {
    animation: fadeIn 0.2s ease-out;
}

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

/* ========== 光标与指针（按钮、输入框、链接等） ========== */
.btn,
button,
[type="button"],
[type="submit"],
[type="reset"],
a[href],
.nav-link,
.mobile-nav-link,
.form-check-input,
.form-switch .form-check-input,
select.form-select,
select,
[role="button"],
label[for],
.dropdown-item,
.modal .btn-close,
.pagination .page-link {
    cursor: pointer;
}

input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="image"]):not([type="checkbox"]):not([type="radio"]),
textarea {
    cursor: text;
}

/* 一些非“文本输入”的 input 类型，更适合 pointer 光标 */
input[type="range"],
input[type="file"],
input[type="color"] {
    cursor: pointer;
}

/* 输入框左右的单位/前后缀（input-group-text）避免出现“光标跳变” */
.input-group-text {
    cursor: text;
    user-select: none;
}

[disabled],
.disabled,
.form-control:disabled,
.form-select:disabled,
.btn:disabled,
button:disabled {
    cursor: not-allowed !important;
}

/* ========== 页脚样式 ========== */
.site-footer {
    background-color: var(--surface);
    border-top: 1px solid var(--gray-light);
    padding: 30px 0 15px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.5;
    position: relative;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-main {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    padding-bottom: 20px;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--gray-light);
}

.footer-logo-section {
    flex: 1;
    min-width: 220px;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--dark);
    margin-bottom: 12px;
    border-radius: var(--radius);
    transition: var(--transition);
}

.footer-logo:hover {
    color: var(--primary);
}

.footer-logo:focus-visible {
    outline: var(--focus-ring);
    outline-offset: var(--focus-offset);
}

.footer-logo i {
    font-size: 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    flex-shrink: 0;
}

.footer-content .logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.footer-content .logo-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--dark);
    letter-spacing: -0.2px;
}

.footer-content .logo-subtitle {
    font-size: 11px;
    color: var(--gray);
    margin-top: 0;
}

.footer-description {
    color: var(--gray);
    line-height: 1.55;
    font-size: 12px;
    max-width: 280px;
}

.footer-links-section {
    flex: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
}

.footer-links-column {
    flex: 1;
    min-width: 140px;
}

.footer-column-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 12px;
    position: relative;
    padding-bottom: 6px;
    letter-spacing: -0.2px;
}

.footer-column-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 24px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 1px;
}

.footer-links-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links-list li {
    margin-bottom: 8px;
}

.footer-links-list a {
    color: var(--gray);
    text-decoration: none;
    font-size: 12px;
    border-radius: var(--radius-sm);
    padding: 2px 0;
    transition: var(--transition-fast);
    display: inline-block;
}

.footer-links-list a:hover {
    color: var(--primary);
    padding-left: 4px;
}

.footer-links-list a:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.contact-info {
    margin-top: 5px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--gray);
}

.contact-item i {
    color: var(--primary);
    font-size: 12px;
    width: 14px;
    flex-shrink: 0;
}

.social-links {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.social-link {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    background-color: var(--lighter);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
}

.social-link:hover {
    background-color: var(--primary);
    color: var(--surface);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.social-link:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-bottom .copyright {
    color: var(--gray);
    font-size: 12px;
    line-height: 1.5;
}

.separator {
    margin: 0 8px;
    color: var(--gray-light);
}

.footer-stats {
    display: flex;
    gap: 15px;
}

.footer-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--gray);
}

.footer-stats .stat-item i {
    color: var(--primary);
    font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
    .footer-logo,
    .footer-links-list a,
    .social-link {
        transition-duration: 0.01ms;
    }
    .social-link:hover {
        transform: none;
    }
}

/* ========== 响应式 - 页脚 ========== */
@media (max-width: 991.98px) {
    .footer-main {
        flex-direction: column;
        gap: 25px;
    }
    .footer-links-section {
        width: 100%;
    }
    .footer-logo-section {
        min-width: 100%;
    }
}

@media (max-width: 767.98px) {
    .site-footer {
        padding: 25px 0 12px;
    }
    .footer-main {
        padding-bottom: 15px;
        margin-bottom: 12px;
        gap: 20px;
    }
    .footer-logo {
        margin-bottom: 10px;
    }
    .footer-logo i {
        font-size: 22px;
    }
    .footer-content .logo-title {
        font-size: 15px;
    }
    .footer-content .logo-subtitle {
        font-size: 10px;
    }
    .footer-description {
        font-size: 11px;
        max-width: 100%;
    }
    .footer-links-section {
        gap: 20px;
    }
    .footer-links-column {
        min-width: calc(50% - 20px);
    }
    .footer-column-title {
        font-size: 13px;
        margin-bottom: 10px;
        padding-bottom: 5px;
    }
    .footer-links-list li {
        margin-bottom: 6px;
    }
    .footer-links-list a {
        font-size: 11px;
    }
    .contact-item {
        font-size: 11px;
        margin-bottom: 8px;
    }
    .contact-item i {
        font-size: 11px;
    }
    .social-links {
        margin-top: 10px;
        gap: 8px;
    }
    .social-link {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
        font-size: 12px;
    }
    .footer-bottom {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    .footer-bottom .copyright {
        font-size: 11px;
        order: 2;
    }
    .footer-stats {
        order: 1;
        justify-content: center;
        gap: 12px;
    }
    .footer-stats .stat-item {
        font-size: 11px;
    }
}

@media (max-width: 575.98px) {
    .site-footer {
        padding: 20px 0 10px;
    }
    .footer-links-section {
        display: flex;
        flex-wrap: wrap;
        gap: 15px;
    }
    .footer-links-column {
        margin-bottom: 5px;
    }
    .footer-links-column:nth-child(1),
    .footer-links-column:nth-child(2) {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }
    .footer-links-column:nth-child(3) {
        flex: 1 1 100%;
        min-width: 100%;
    }
    .footer-column-title {
        font-size: 12px;
    }
    .footer-links-list a {
        font-size: 11px;
    }
    .footer-stats {
        width: 100%;
        justify-content: space-around;
    }
    .footer-bottom .copyright {
        line-height: 1.4;
    }
    .separator {
        display: block;
        margin: 5px 0;
        color: transparent;
    }
}

@media (max-width: 375.98px) {
    .site-footer {
        padding: 18px 0 10px;
    }
    .footer-logo {
        gap: 8px;
    }
    .footer-logo i {
        font-size: 20px;
    }
    .footer-content .logo-title {
        font-size: 14px;
    }
    .footer-stats {
        flex-wrap: wrap;
        gap: 8px;
    }
    .footer-stats .stat-item {
        min-width: 45%;
        justify-content: center;
    }
}
