/**
 * IPV4管理系统自定义样式
 * 包含排序功能的完整样式定义
 */

/* 霓虹文本效果 */
@keyframes neon-pulse {
    0%, 100% {
        text-shadow: 0 0 10px rgba(0, 229, 255, 0.8),
                     0 0 20px rgba(0, 229, 255, 0.5),
                     0 0 30px rgba(0, 229, 255, 0.3);
    }
    50% {
        text-shadow: 0 0 15px rgba(0, 229, 255, 1),
                     0 0 25px rgba(0, 229, 255, 0.7),
                     0 0 35px rgba(0, 229, 255, 0.5);
    }
}

.neon-text {
    animation: neon-pulse 2s infinite;
    color: #00E5FF;
}

/* 霓虹按钮效果 */
.neon-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.neon-btn::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    background: linear-gradient(45deg, #00E5FF, #D500F9, #76FF03, #00E5FF);
    background-size: 400%;
    z-index: -1;
    animation: neon-border 5s linear infinite;
    filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s;
}

.neon-btn:hover::before {
    opacity: 1;
}

@keyframes neon-border {
    0% {
        background-position: 0 0;
    }
    50% {
        background-position: 400% 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* 表格样式增强 */
.table-enhanced {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-enhanced thead th {
    background-color: #263238;
    color: white;
    padding: 12px;
    font-weight: 600;
    text-align: left;
    border-top: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    position: relative;
}

.table-enhanced thead th:first-child {
    border-left: 1px solid #ddd;
    border-top-left-radius: 6px;
}

.table-enhanced thead th:last-child {
    border-right: 1px solid #ddd;
    border-top-right-radius: 6px;
}

.table-enhanced tbody tr:hover {
    background-color: rgba(0, 229, 255, 0.05);
}

.table-enhanced tbody td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
    border-left: 1px solid #ddd;
}

.table-enhanced tbody td:last-child {
    border-right: 1px solid #ddd;
}

.table-enhanced tbody tr:last-child td:first-child {
    border-bottom-left-radius: 6px;
}

.table-enhanced tbody tr:last-child td:last-child {
    border-bottom-right-radius: 6px;
}

/* ===== 排序功能样式 ===== */

/* 可排序表头基础样式 */
.sortable-header {
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    position: relative;
}

.sortable-header:hover {
    background-color: rgba(0, 229, 255, 0.15);
    color: #00E5FF;
}

.sortable-header:active {
    background-color: rgba(0, 229, 255, 0.25);
}

/* 排序链接样式 */
.sortable-header a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
}

.sortable-header a:hover {
    color: #00E5FF;
}

/* 排序指示器容器 */
.sort-indicator-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* 排序图标基础样式 */
.sort-icon {
    margin-left: 8px;
    width: 16px;
    height: 16px;
    transition: all 0.2s ease;
    opacity: 0.6;
    flex-shrink: 0;
}

.sortable-header:hover .sort-icon {
    opacity: 1;
    color: #00E5FF;
}

/* 当前排序列的样式 */
.current-sort-column {
    background-color: rgba(0, 229, 255, 0.08) !important;
    font-weight: 700;
    position: relative;
}

.current-sort-column a {
    color: #00E5FF !important;
}

.current-sort-column .sort-icon {
    opacity: 1;
    color: #00E5FF;
    filter: drop-shadow(0 0 3px rgba(0, 229, 255, 0.5));
}

/* 升序排序样式 */
.sort-asc .sort-icon {
    transform: rotate(180deg);
}

/* 降序排序样式 */
.sort-desc .sort-icon {
    transform: rotate(0deg);
}

/* 排序列数据的对齐优化 */
.sort-column-ip .sortable-header {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.sort-column-number .sortable-header {
    text-align: right;
}

.sort-column-status .sortable-header {
    text-align: center;
}

/* 排序状态动画效果 */
@keyframes sort-flash {
    0% { background-color: rgba(0, 229, 255, 0.3); }
    100% { background-color: rgba(0, 229, 255, 0.08); }
}

.sort-changing {
    animation: sort-flash 0.3s ease-out;
}

/* 排序加载状态 */
.sort-loading .sort-icon {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* 移动端排序优化 */
@media (max-width: 768px) {
    .sortable-header {
        font-size: 0.875rem;
        padding: 8px;
    }
    
    .sort-icon {
        width: 14px;
        height: 14px;
        margin-left: 4px;
    }
    
    .sort-indicator-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
}

/* 排序提示工具提示 */
.sort-tooltip {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(38, 50, 56, 0.95);
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 1000;
}

.sort-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(38, 50, 56, 0.95);
}

.sortable-header:hover .sort-tooltip {
    opacity: 1;
}

/* ===== 原有样式继续 ===== */

/* 状态标签 */
.status-badge {
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.status-badge-active {
    background-color: rgba(118, 255, 3, 0.2);
    color: #4caf50;
}

.status-badge-idle {
    background-color: rgba(0, 229, 255, 0.2);
    color: #00b0ff;
}

.status-badge-cooling {
    background-color: rgba(213, 0, 249, 0.2);
    color: #d500f9;
}

/* 输入框聚焦效果 */
.input-focus {
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-focus:focus {
    border-color: #00E5FF;
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.25);
    outline: none;
}

/* 卡片悬停效果 */
.card-hover {
    transition: transform 0.3s, box-shadow 0.3s;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* 霓虹光边框 */
.neon-border {
    position: relative;
}

.neon-border::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px solid transparent;
    border-radius: inherit;
    background: linear-gradient(45deg, #00E5FF, #D500F9, #76FF03, #00E5FF) border-box;
    -webkit-mask: 
        linear-gradient(#fff 0 0) padding-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask-composite: exclude;
    animation: rotate-gradient 5s linear infinite;
    background-size: 400% 400%;
    pointer-events: none;
}

@keyframes rotate-gradient {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

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

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #00E5FF;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #00c4d9;
}

/* 过渡效果 */
.transition-all {
    transition: all 0.3s ease;
}

/* Alpine.js 过渡效果 */
[x-cloak] {
    display: none !important;
}

.fade-enter-active, .fade-leave-active {
    transition: opacity 0.3s;
}

.fade-enter, .fade-leave-to {
    opacity: 0;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .sidebar-mobile-hidden {
        display: none;
    }
}