/* style.css */
/* 基础重置与字体 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4efe9 100%);
    color: #333;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    transition: background-image 0.8s ease;
    position: relative;
    animation: containerReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* 修改背景透明度为0.2 */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.2);
    z-index: -1;
}

/* 背景控制按钮 - 添加自动隐藏功能 */
.bg-controls {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    opacity: 0.3;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* 鼠标悬停时显示控制按钮 */
.bg-controls:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.02) translateX(-5px);
    -webkit-transform: scale(1.02) translateX(-5px);
}

/* 控制按钮的连续微弹效果 */
.bg-controls:hover .bg-btn {
    animation: gentleBounce 3s ease-in-out infinite;
}

.bg-controls:hover .bg-btn:nth-child(2) {
    animation-delay: 0.2s;
}

.bg-controls:hover .bg-btn:nth-child(3) {
    animation-delay: 0.4s;
}

.bg-btn {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 3px 12px rgba(37, 117, 252, 0.2);
    position: relative;
    overflow: hidden;
    transform: scale(1);
}

.bg-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.bg-btn:hover {
    transform: scale(1.05);
    -webkit-transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(37, 117, 252, 0.4);
}

.bg-btn:hover::before {
    left: 100%;
}

.bg-btn:active {
    transform: scale(0.92);
    -webkit-transform: scale(0.92);
    transition-duration: 0.1s;
}

.bg-btn.active {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    box-shadow: 0 3px 12px rgba(255, 107, 107, 0.3);
}

/* API状态指示器 */
.api-status {
    font-size: 0.7rem;
    text-align: center;
    padding: 4px 0;
    color: #28a745;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.api-status.error {
    color: #dc3545;
    animation: statusShake 0.5s ease;
}

.api-status.warning {
    color: #ffc107;
}

/* 背景加载提示 */
.bg-loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    -webkit-transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.bg-loading.show {
    opacity: 1;
}

.bg-loading.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 布局容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

header:hover {
    transform: translateY(-3px) scale(1.01);
    -webkit-transform: translateY(-3px) scale(1.01);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    -webkit-background-clip: text;
    -moz-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -moz-text-fill-color: transparent;
    color: transparent;
    margin-bottom: 15px;
    animation: titleBounce 1s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.description {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 800px;
    margin: 0 auto;
}

/* 高亮提示框 */
.highlight {
    background-color: rgba(255, 249, 230, 0.8);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #ffc107;
    margin-bottom: 20px;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.highlight:hover {
    transform: scale(1.02);
    -webkit-transform: scale(1.02);
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.2);
}

/* 水平容器 */
.horizontal-container {
    display: flex;
    gap: 25px;
    margin-bottom: 30px;
}

/* 卡片设计 - 修复完整样式 */
.card {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 30px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    flex: 1;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3, #54a0ff);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    -webkit-transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 0 80px rgba(37, 117, 252, 0.1);
}

.card-title {
    font-size: 1.4rem;
    color: #2575fc;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(37, 117, 252, 0.1);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.card:hover .card-title {
    transform: translateX(5px);
    -webkit-transform: translateX(5px);
}

/* 信息项样式 */
.info-item {
    margin-bottom: 20px;
}

.info-label {
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-size: 0.95rem;
}

.info-value {
    background: rgba(248, 249, 250, 0.7);
    padding: 14px 16px;
    border-radius: 10px;
    font-family: 'Monaco', 'Consolas', monospace;
    word-break: break-all;
    font-size: 0.9rem;
    min-height: 20px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-left: 4px solid;
    animation: colorCycle 15s infinite;
    cursor: pointer;
    user-select: all;
    -webkit-user-select: all;
    -moz-user-select: all;
}

.info-value:hover {
    transform: scale(1.02) translateX(5px);
    -webkit-transform: scale(1.02) translateX(5px);
    background: rgba(248, 249, 250, 0.9);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* IP容器 */
.ip-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.ip-item {
    flex: 1;
}

/* 应用程序检测区域 */
#detected-app-container {
    margin: 25px 0;
}

.detected-app {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 25px;
    border-radius: 16px;
    margin: 20px 0;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
    animation: appReveal 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.app-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    animation: iconBounce 2s ease-in-out infinite;
}

/* 用户代理列表 */
.ua-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 20px;
    margin-top: 10px;
}

.ua-item {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    animation: itemEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.ua-item:nth-child(1) { animation-delay: 0.1s; }
.ua-item:nth-child(2) { animation-delay: 0.2s; }
.ua-item:nth-child(3) { animation-delay: 0.3s; }
.ua-item:nth-child(4) { animation-delay: 0.4s; }

.ua-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #feca57, #ff9ff3, #54a0ff);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

.ua-item:hover {
    transform: scale(1.03) translateY(-5px);
    -webkit-transform: scale(1.03) translateY(-5px);
    box-shadow: 
        0 15px 30px rgba(0, 0, 0, 0.15),
        0 0 40px rgba(37, 117, 252, 0.1);
}

.ua-name {
    font-weight: 600;
    color: #2575fc;
    margin-bottom: 10px;
    font-size: 1.05rem;
}

.ua-value {
    background: rgba(248, 249, 250, 0.7);
    padding: 12px 15px;
    border-radius: 8px;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.85rem;
    word-break: break-all;
    border-left: 3px solid;
    animation: colorCycle 15s infinite;
    user-select: all;
    -webkit-user-select: all;
    -moz-user-select: all;
}

.app-details {
    background: rgba(232, 244, 253, 0.7);
    padding: 12px;
    border-radius: 6px;
    margin-top: 10px;
    font-size: 0.85rem;
}

/* 页脚样式 */
footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 10px;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

footer:hover {
    transform: translateY(-3px);
    -webkit-transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

/* 章节标题 */
.section-title {
    font-size: 1.8rem;
    color: #2575fc;
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(234, 234, 234, 0.7);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.section-title:hover {
    transform: translateX(10px);
    -webkit-transform: translateX(10px);
    border-bottom-color: rgba(37, 117, 252, 0.3);
}

/* 响应式设计 */
@media (max-width: 968px) {
    .horizontal-container {
        flex-direction: column;
    }
    
    .bg-controls {
        position: relative;
        top: auto;
        right: auto;
        flex-direction: row;
        justify-content: center;
        margin-bottom: 20px;
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .ua-list {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .ip-container {
        flex-direction: column;
    }
    
    .bg-controls {
        flex-direction: column;
    }
}

/* ==================== 动画定义 ==================== */

/* 容器弹性入场 */
@keyframes containerReveal {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(30px);
        -webkit-transform: scale(0.95) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        -webkit-transform: scale(1) translateY(0);
    }
}

/* 标题弹性动画 */
@keyframes titleBounce {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(-50px);
        -webkit-transform: scale(0.5) translateY(-50px);
    }
    70% {
        transform: scale(1.1) translateY(10px);
        -webkit-transform: scale(1.1) translateY(10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        -webkit-transform: scale(1) translateY(0);
    }
}

/* 史莱姆弹性动画 */
@keyframes slimeBounce {
    0% {
        transform: scale(1);
        -webkit-transform: scale(1);
    }
    25% {
        transform: scale(0.95) skewX(2deg);
        -webkit-transform: scale(0.95) skewX(2deg);
    }
    50% {
        transform: scale(1.08) skewX(-1deg);
        -webkit-transform: scale(1.08) skewX(-1deg);
    }
    65% {
        transform: scale(0.98) skewX(1deg);
        -webkit-transform: scale(0.98) skewX(1deg);
    }
    80% {
        transform: scale(1.03) skewX(-0.5deg);
        -webkit-transform: scale(1.03) skewX(-0.5deg);
    }
    100% {
        transform: scale(1);
        -webkit-transform: scale(1);
    }
}

/* 控制按钮连续微弹 */
@keyframes gentleBounce {
    0%, 90%, 100% {
        transform: scale(1);
        -webkit-transform: scale(1);
    }
    92% {
        transform: scale(1.02);
        -webkit-transform: scale(1.02);
    }
    96% {
        transform: scale(0.99);
        -webkit-transform: scale(0.99);
    }
}

/* 检测到的应用区域弹性入场 */
@keyframes appReveal {
    0% {
        opacity: 0;
        transform: scale(0.8) translateY(50px);
        -webkit-transform: scale(0.8) translateY(50px);
    }
    70% {
        transform: scale(1.05) translateY(-10px);
        -webkit-transform: scale(1.05) translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
        -webkit-transform: scale(1) translateY(0);
    }
}

/* 应用图标弹性跳动 */
@keyframes iconBounce {
    0%, 100% {
        transform: scale(1);
        -webkit-transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        -webkit-transform: scale(1.1);
    }
}

/* 列表项入场动画 */
@keyframes itemEntrance {
    0% {
        opacity: 0;
        transform: scale(0.8) translateX(-50px);
        -webkit-transform: scale(0.8) translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateX(0);
        -webkit-transform: scale(1) translateX(0);
    }
}

/* 状态抖动效果 */
@keyframes statusShake {
    0%, 100% {
        transform: translateX(0);
        -webkit-transform: translateX(0);
    }
    25% {
        transform: translateX(-3px);
        -webkit-transform: translateX(-3px);
    }
    75% {
        transform: translateX(3px);
        -webkit-transform: translateX(3px);
    }
}

/* 原有动画效果 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
        -webkit-transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        -webkit-transform: translateY(0);
    }
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
        -webkit-background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
        -webkit-background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
        -webkit-background-position: 0% 50%;
    }
}

@keyframes colorCycle {
    0% { border-left-color: #ff6b6b; }
    14% { border-left-color: #4ecdc4; }
    28% { border-left-color: #45b7d1; }
    42% { border-left-color: #96ceb4; }
    57% { border-left-color: #feca57; }
    71% { border-left-color: #ff9ff3; }
    85% { border-left-color: #54a0ff; }
    100% { border-left-color: #ff6b6b; }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* 加载状态的弹性脉冲 */
.info-value.loading {
    animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% {
        transform: scale(1);
        -webkit-transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.03);
        -webkit-transform: scale(1.03);
        opacity: 1;
    }
}

/* 状态类 */
.loading {
    color: #6c757d;
    font-style: italic;
}

.success {
    color: #28a745;
}

.error {
    color: #dc3545;
}

/* 按钮样式 */
.refresh-btn {
    background: linear-gradient(135deg, #2575fc 0%, #6a11cb 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    margin-top: 10px;
    box-shadow: 0 4px 15px rgba(37, 117, 252, 0.2);
    position: relative;
    overflow: hidden;
    transform: scale(1);
}

.refresh-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.refresh-btn:hover {
    transform: scale(1.05);
    -webkit-transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(37, 117, 252, 0.4);
}

.refresh-btn:hover::before {
    left: 100%;
}

.refresh-btn:active {
    transform: scale(0.92);
    -webkit-transform: scale(0.92);
    transition-duration: 0.1s;
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 缓存状态指示器 */
.api-status.cache {
    color: #17a2b8;
}

/* 应用史莱姆动画到按钮 */
.bg-btn.animate, .refresh-btn.animate {
    animation: slimeBounce 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
