/* 环形进度条样式 */
.circular-progress {
    transform: rotate(-90deg);
}
.circular-progress circle {
    fill: none;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}
.circular-progress .bg {
    stroke: #e5e7eb;
}
.dark .circular-progress .bg {
    stroke: #374151;
}
.circular-progress .progress {
    stroke: url(#progressGradient);
}

/* 渐变进度条增强 */
.progress-bar-gradient {
    background: linear-gradient(90deg, #6d4aff 0%, #8b6bff 100%);
    box-shadow: 0 0 10px rgba(109, 74, 255, 0.3);
}

.progress-bar-green {
    background: linear-gradient(90deg, #10b981 0%, #34d399 100%);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.progress-bar-amber {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.progress-bar-red {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* 侧边栏导航样式增强 */
.sidebar-link {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 60%;
    background: linear-gradient(90deg, #6d4aff 0%, transparent 100%);
    opacity: 0;
    transition: all 0.3s ease;
    border-radius: 0 4px 4px 0;
}
.sidebar-link:hover {
    background: linear-gradient(90deg, rgba(109, 74, 255, 0.08) 0%, transparent 100%);
    transform: translateX(2px);
}
.sidebar-link:hover::before {
    width: 3px;
    opacity: 1;
}
.sidebar-link.active {
    background: linear-gradient(90deg, rgba(109, 74, 255, 0.12) 0%, transparent 100%);
    color: #6d4aff;
    font-weight: 600;
}
.sidebar-link.active::before {
    width: 3px;
    opacity: 1;
}
.sidebar-link.active svg {
    color: #6d4aff;
}
.sidebar-link:active {
    transform: translateX(1px);
}

/* 移动端底部导航增强 */
.mobile-nav-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.mobile-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #6d4aff 0%, #8b6bff 100%);
    border-radius: 0 0 3px 3px;
    transition: width 0.3s ease;
}
.mobile-nav-item:active {
    transform: scale(0.95);
}
.mobile-nav-item.active {
    color: #6d4aff;
}
.mobile-nav-item.active svg {
    color: #6d4aff;
}
.mobile-nav-item.active::before {
    width: 40px;
}

/* 状态徽章动画增强 */
@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.1);
    }
}
.status-dot-animated {
    animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 状态徽章样式增强 */
.status-badge {
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px -2px currentColor;
}
.status-badge:hover {
    transform: scale(1.05);
}

/* 数据高亮动画 */
@keyframes number-highlight {
    0% { color: inherit; }
    50% { color: #6d4aff; }
    100% { color: inherit; }
}

.highlight-on-change {
    animation: number-highlight 0.6s ease;
}

/* 在线状态脉冲 */
@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.online-indicator {
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* 卡片悬停效果增强 */
.dashboard-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(109, 74, 255, 0.05), transparent);
    transition: left 0.5s ease;
    pointer-events: none;
}
.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px -8px rgba(109, 74, 255, 0.15), 0 8px 15px -5px rgba(0, 0, 0, 0.08);
}
.dashboard-card:hover::before {
    left: 100%;
}

/* 数据卡片增强 */
.stat-card {
    background: linear-gradient(135deg, rgba(109, 74, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    overflow: hidden;
}
.dark .stat-card {
    background: linear-gradient(135deg, rgba(109, 74, 255, 0.1) 0%, rgba(31, 41, 55, 0) 100%);
}

/* 订阅页面套餐卡片 - 确保 Most Popular 标签不被遮挡 */
#subscription-plans-grid {
    padding-top: 0.75rem;
}

#subscription-plans-grid .dashboard-card {
    overflow: visible;
}

/* 订阅页面卡片禁用伪元素动画，避免光标闪烁 */
#subscription-plans-grid .dashboard-card::before {
    display: none;
}

/* Most Popular 标签样式 */
.popular-badge {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(109, 74, 255, 0.4);
    pointer-events: none;
}

/* Server Status：圆角国旗，无外圈圆形容器 */
.server-node-flag.fi {
    border-radius: 0.375rem;
    overflow: hidden;
}

/* 服务器节点卡片优化 */
.server-node-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.server-node-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(109, 74, 255, 0.08));
    opacity: 0;
    transition: opacity 0.3s ease;
}
.server-node-card:hover {
    transform: translateX(4px);
    background: linear-gradient(90deg, rgba(109, 74, 255, 0.08) 0%, transparent 100%);
}
.server-node-card:hover::after {
    opacity: 1;
}

/* 悬浮侧边栏样式 */
.floating-sidebar {
    position: sticky;
    top: 6rem;
    height: fit-content;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
}

/* 侧边栏折叠动画 */
.sidebar-collapsed {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 移动端抽屉式侧边栏 */
.mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85vw;
    background: white;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
}
.dark .mobile-sidebar {
    background: #1f2937;
}

.mobile-sidebar.active {
    transform: translateX(0);
}

/* 移动端菜单按钮 - 右上角，与导航栏按钮位置和样式一致 */
.mobile-menu-button {
    position: fixed;
    top: 0.75rem;
    right: 1rem;
    z-index: 60;
    background: transparent;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: none;
    transition: all 0.2s ease;
}

@media (min-width: 640px) {
    .mobile-menu-button {
        right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .mobile-menu-button {
        right: 2rem;
        display: none;
    }
}

.mobile-menu-button:hover {
    background: rgba(0, 0, 0, 0.05);
    box-shadow: none;
}
.dark .mobile-menu-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 在dashboard页面隐藏base.html的移动菜单按钮 */
#mobileMenuButton {
    display: none !important;
}

/* 国旗图标样式 */
.country-flag {
    display: inline-block;
    width: 1.5em;
    height: 1.125em;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    vertical-align: middle;
}
.country-flag.rounded {
    border-radius: 0.25rem;
}

/* 页面淡入动画 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-section {
    animation: fadeInUp 0.5s ease-out;
}

/* 按钮悬停效果增强 */
button, a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 平滑滚动 */
html {
    scroll-behavior: smooth;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(109, 74, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(109, 74, 255, 0.5);
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(109, 74, 255, 0.4);
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(109, 74, 255, 0.6);
}

/* 加载骨架屏动画 */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}
