/* Footer Component - Apple Style Design */

/* CSS Variables */
:root {
    --footer-bg: #ffffff;
    --footer-text: #86868b;
    --footer-text-hover: #1d1d1f;
    --footer-border: #d2d2d7;
    --footer-link: #86868b;
    --footer-link-hover: #1d1d1f;
    --footer-separator: #d2d2d7;
    --footer-select-hover-bg: rgba(0, 0, 0, 0.02);
    --footer-select-active: #0071e3;
    --footer-select-active-text: #ffffff;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --footer-bg: #1c1c1e;
        --footer-text: #98989d;
        --footer-text-hover: #f5f5f7;
        --footer-border: #38383a;
        --footer-link: #98989d;
        --footer-link-hover: #f5f5f7;
        --footer-separator: #38383a;
        --footer-select-hover-bg: rgba(255, 255, 255, 0.05);
        --footer-select-active: #0a84ff;
        --footer-select-active-text: #ffffff;
    }
}

/* 通用字体样式 */
.site-footer,
.site-footer * {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.site-footer {
    background: transparent;
    padding: 0;
    margin-top: 0;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 40px;
    background: var(--footer-bg);
}

/* 在灰色背景页面上，页脚背景也使用灰色 */
body:has(.help-page-wrapper) .site-footer,
body:has(.support-page-wrapper) .site-footer,
body:has(.privacy-page-wrapper) .site-footer,
body:has(.sitemap-page-wrapper) .site-footer,
body:has(.product-detail-page) .site-footer {
    background: #f5f5f7;
}

body:has(.help-page-wrapper) .site-footer .footer-container,
body:has(.support-page-wrapper) .site-footer .footer-container,
body:has(.privacy-page-wrapper) .site-footer .footer-container,
body:has(.sitemap-page-wrapper) .site-footer .footer-container,
body:has(.product-detail-page) .site-footer .footer-container {
    background: transparent;
}

/* 兼容不支持 :has() 的浏览器，使用类名方式 */
.help-page-wrapper ~ .site-footer,
.support-page-wrapper ~ .site-footer,
.privacy-page-wrapper ~ .site-footer,
.sitemap-page-wrapper ~ .site-footer,
.product-detail-page ~ .site-footer {
    background: #f5f5f7;
}

.help-page-wrapper ~ .site-footer .footer-container,
.support-page-wrapper ~ .site-footer .footer-container,
.privacy-page-wrapper ~ .site-footer .footer-container,
.sitemap-page-wrapper ~ .site-footer .footer-container,
.product-detail-page ~ .site-footer .footer-container {
    background: transparent;
}

/* 分隔线 */
.footer-divider {
    height: 1px;
    background: var(--footer-border);
    margin-bottom: 20px;
}

/* 页脚内容 */
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
}

.footer-content > * {
    flex: 0 0 auto;
}

/* 左侧：版权信息 */
.footer-left {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-right: 32px;
}

.footer-copyright {
    font-size: 0.75rem;
    color: var(--footer-text);
    margin: 0;
    line-height: 1.5;
}

/* 中间：链接导航 */
.footer-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    flex: 0 0 auto;
    margin-right: auto;
}

.footer-nav-link {
    font-size: 0.75rem;
    color: var(--footer-link);
    text-decoration: none;
    transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    line-height: 1.5;
    white-space: nowrap;
}

.footer-nav-link:hover {
    color: var(--footer-link-hover);
    text-decoration: underline;
}

.footer-nav-separator {
    font-size: 0.75rem;
    color: var(--footer-separator);
    user-select: none;
}

/* 右侧：语言切换 */
.footer-right {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
}

.footer-language {
    position: relative;
}

.footer-language-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 24px 4px 8px;
    font-size: 0.75rem;
    color: var(--footer-text);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 80px;
    position: relative;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2386868b' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 10px 6px;
}

.footer-language-select:hover {
    color: var(--footer-text-hover);
    border-color: var(--footer-border);
    background-color: var(--footer-select-hover-bg);
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%231d1d1f' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.footer-language-select:focus {
    outline: none;
    border-color: var(--footer-border);
    background-color: var(--footer-select-hover-bg);
}

.footer-language-select option {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 8px 12px;
    font-size: 0.75rem;
}

.footer-language-select option:checked {
    background: var(--footer-select-active);
    color: var(--footer-select-active-text);
}

/* 响应式设计 */

/* 平板端 (768px - 991.98px) */
@media (max-width: 991.98px) and (min-width: 768px) {
    .site-footer {
        margin-top: 0;
    }

    .footer-container {
        padding: 18px 24px;
    }

    .footer-divider {
        margin-bottom: 18px;
    }
}

/* 移动端 (≤767.98px) */
@media (max-width: 767.98px) {
    .site-footer {
        margin-top: 0;
    }

    .footer-container {
        padding: 16px;
    }

    .footer-divider {
        margin-bottom: 16px;
    }

    .footer-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* 语言选择器 - 顶部 */
    .footer-right {
        order: 1;
        width: 100%;
        margin-left: 0;
    }

    .footer-language {
        width: 100%;
    }

    .footer-language-select {
        padding-right: 24px;
        min-width: auto;
        width: auto;
    }

    /* 版权信息 - 中间 */
    .footer-left {
        order: 2;
        width: 100%;
        margin-right: 0;
    }

    .footer-copyright {
        margin: 0;
    }

    /* 链接导航 - 底部，水平排列 */
    .footer-nav {
        order: 3;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        width: 100%;
        margin-right: 0;
        flex-wrap: wrap;
    }

    .footer-nav-link {
        display: inline-block;
    }

    .footer-nav-separator {
        display: inline;
    }
}

/* 小屏移动端 (≤575.98px) */
@media (max-width: 575.98px) {
    .site-footer {
        margin-top: 0;
    }

    .footer-container {
        padding: 14px 12px;
    }

    .footer-divider {
        margin-bottom: 14px;
    }

    .footer-content {
        gap: 10px;
    }

    .footer-copyright {
        font-size: 0.6875rem;
    }

    .footer-nav-link {
        font-size: 0.6875rem;
    }

    .footer-nav-separator {
        font-size: 0.6875rem;
    }

    .footer-language-select {
        font-size: 0.6875rem;
        padding-right: 20px;
    }
}
