/**
 * 文件路径：/css/style.css
 * 说明：静态样式表，基础样式与响应式规则，动态部分由 index.php 中的内联 <style> 覆盖
 *       此文件不包含任何 PHP 变量，可直接作为静态资源请求
 */
 

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}


.container {
    position: relative;
    z-index: 1;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
    /* 以下属性由 index.php 内联样式动态设置：
       max-width, padding-top, padding-bottom, text-align */
}

.top-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
    /* gap, margin-bottom, justify-content 由 index.php 动态设置 */
}

.mode-switch-section {
    flex-shrink: 0;
}

.weather-calendar-wrapper {
    align-items: flex-start;
    flex-wrap: wrap;
    /* display, gap 由 index.php 动态设置 */
}

#weatherCard {
    max-width: 100%;
    /* width 由 index.php 动态设置 */
}

#calendarCard {
    max-width: 100%;
    /* width 由 index.php 动态设置 */
}

.collapse-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 24px;
    transition: border-radius 0.3s ease;
}

.collapse-card:hover .card-header {
    background: rgba(0, 0, 0, 0.3);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

/* 天气头部温度文字 */
#weatherHeaderTemp {
    color: #ffffff;  /* ← 明确指定 */
    font-weight: 500;
}

.card-header-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.collapse-card.expanded .card-header-icon {
    transform: rotate(180deg);
}

.card-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}

.collapse-card.expanded .card-content {
    max-height: 500px;
    opacity: 1;
    padding: 16px;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .top-toolbar {
        flex-direction: column;
        align-items: center;
    }
    .weather-calendar-wrapper {
        justify-content: center;
        width: 100%;
    }
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .monitor-item {
        white-space: normal;
        min-width: 60px;
        padding: 4px 8px;
    }
    .monitor-card {
        flex-direction: column;
        gap: 8px;
    }
    .weather-details {
        grid-template-columns: repeat(2, 1fr);
    }
    .switch-option {
        padding: 6px 16px;
        font-size: 0.8rem;
    }
    .calendar-day {
        min-height: 38px;
    }
    .calendar-lunar {
        font-size: 0.5rem;
        white-space: normal;
    }
    #weatherCard,
    #calendarCard {
        width: 100%;
    }
    /* .cards-grid 的 gap 由 index.php 动态设置 */
}

@media (max-width: 480px) {
    .weather-details {
        grid-template-columns: 1fr;
    }
    .monitor-stats {
        gap: 6px;
    }
    .calendar-lunar {
        font-size: 0.45rem;
    }
}

/* 天气与日历组件 */
.weather-city {
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
    text-align: center;
    font-size: 0.9rem;
}

.weather-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.weather-icon {
    font-size: 2.2rem;
}

.weather-temp {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}

.weather-temp small {
    font-size: 0.7rem;
    font-weight: normal;
    opacity: 0.8;
}

.weather-desc {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 0.75rem;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
}

.weather-details span {
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.calendar-header-year {
    font-weight: 600;
    color: #fff;
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    margin-bottom: 4px;
}

.calendar-weekday {
    color: rgba(255, 255, 255, 0.7);
    padding: 3px 0;
    font-size: 0.6rem;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.calendar-day {
    padding: 4px 2px;
    text-align: center;
    min-height: 45px;
}

.calendar-day-number {
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.2;
}

.calendar-lunar {
    font-size: 0.55rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.3;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-day-other .calendar-day-number {
    color: rgba(255, 255, 255, 0.4);
}

.calendar-day-other .calendar-lunar {
    color: rgba(255, 255, 255, 0.3);
}

.calendar-day-today {
    background: rgba(102, 126, 234, 0.8);
    border-radius: 10px;
}

.calendar-day-today .calendar-day-number {
    color: white;
    font-weight: bold;
}

.calendar-day-today .calendar-lunar {
    color: rgba(255, 255, 255, 0.9);
}

/* Logo 区域 */
.logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 系统监控卡片 */
.greeting-container {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 0.5rem;
    text-align: center;
}

.monitor-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 8px 16px;
    margin-bottom: 8px;
    display: inline-flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.monitor-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.monitor-item {
    flex: 0 1 auto;
    min-width: 80px;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 5px 10px;
    white-space: nowrap;
}

.monitor-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
}

.monitor-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.monitor-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s;
}

/* 搜索容器 */
.search-container {
    max-width: 600px;
    margin: 0 auto;
	/* 🔥 加这两行 == 直接解决遮挡 */
    position: relative;
    z-index: 99999;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 60px;
    padding: 4px 6px 4px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-wrapper:focus-within {
    background: rgba(255, 255, 255, 0.25);
}

.engine-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    position: relative;
}

.engine-icon:hover {
    background: rgba(255, 255, 255, 0.35);
}

.engine-icon img {
    width: 22px;
    height: 22px;
}

.engine-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    padding: 8px 0;
    min-width: 140px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s ease;
}

.engine-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.engine-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    cursor: pointer;
    color: #f1f5f9;
    font-size: 0.85rem;
}

.engine-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.engine-dropdown-item img {
    width: 18px;
    height: 18px;
}

.search-divider {
    width: 1px;
    height: 28px;
    background: rgba(255, 255, 255, 0.3);
}

.search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 0;
    font-size: 1rem;
    color: #fff;
    outline: none;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.search-engine-select {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px 28px 8px 12px;
    border-radius: 40px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-color: rgba(40, 40, 40, 0.4);

    /* 🔥 关键：自适应宽度（手机完美） */
    width: fit-content;
    white-space: nowrap; /* 防止文字折行 */
}

.search-engine-select option {
    background-color: #2c2c2c !important;
    color: #ffffff !important;
}

/* 模式切换按钮 */
.mode-switch {
    display: flex;
}

.switch-btn {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 60px;
    padding: 4px;
    display: inline-flex;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.switch-option {
    padding: 8px 24px;
    border-radius: 60px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
}

.switch-option.active {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

/* 内容卡片网格 */
.cards-grid {
    display: grid;
    /* grid-template-columns, gap 由 index.php 动态设置 */
    margin-top: 1rem;
	padding-bottom: 1rem;      /* 横线与卡片之间的间距 */
	border-bottom: 1px solid rgba(255, 255, 255, 0.5);  /* 内容下方横线 */
}

.link-item {
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.card {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
    /* background, border-radius, width, height 由 index.php 动态设置 */
}

.card:hover {
    transform: translateY(-4px);
    /* hover 的背景和圆角由 index.php 动态设置 */
}

.card-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* border-radius 由 index.php 动态设置 */
}

.card-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: #fff;
    text-align: center;
    word-break: break-word;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card-title-with-badge {
    font-size: 0.8rem;
    font-weight: 500;
    color: #fff;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.card-badge {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.badge-online {
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
}

.badge-offline {
    background: #f87171;
}

/* 区块标题 */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);/* ← 这就是内容框上面横线！ */
}

.section-title h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #fff;
}

.section-title .count {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

/* 内网服务状态分组 */
.status-group {
    margin-bottom: 2rem;
}

.status-group-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.status-dot.online {
    background: #4ade80;
}

.status-dot.offline {
    background: #f87171;
}

.status-group-header h3 {
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== 内网离线图标黑白效果 ==================== */
.offline-icon {
    filter: grayscale(90%) contrast(1.05) brightness(1.03);
    opacity: 0.9;
    transition: filter 0.2s ease, opacity 0.2s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.offline-icon:hover {
    filter: grayscale(70%) contrast(1.02);
    opacity: 0.98;
}

.online-icon {
    filter: grayscale(0%);
    opacity: 1;
}

@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .offline-icon {
        image-rendering: -webkit-optimize-contrast;
    }
}



/* 加载与空状态 */
.loading-spinner {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.5);
}

/* 页脚 */
.footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0); /* ← 这就是📍 来访IP上面横线！ */
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.footer a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    cursor: pointer;
}

.footer a:hover {
    color: #fff;
}

/* IP 显示 */
.ip-display {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    font-family: monospace;
    color: rgba(255, 255, 255, 0.7);
}

.ip-display.hidden {
    display: none;
}

/* 通用隐藏 */
.hidden {
    display: none;
}

/* 进度提示 */
.progress-hint {
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 8px;
}

.progress-bar-container {
    width: 100%;
    max-width: 300px;
    margin: 10px auto;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 4px;
    display: none;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: #4ade80;
    transition: width 0.3s;
    border-radius: 10px;
}

/* 管理后台模态框 */
.admin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.admin-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-modal-content {
    width: 90%;
    height: 85%;
    max-width: 1200px;
    background: #fff;
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.admin-modal-header h3 {
    font-size: 1.1rem;
    color: #1e293b;
}

.close-modal {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #64748b;
    padding: 0 8px;
}

.close-modal:hover {
    color: #ef4444;
}

.admin-modal-body {
    flex: 1;
    overflow: auto;
}

.admin-modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* 设置按钮 */
.settings-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(102, 126, 234, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    backdrop-filter: blur(10px);
    font-size: 1.5rem;
    color: white;
}

.settings-btn:hover {
    transform: scale(1.1);
    background: rgba(102, 126, 234, 1);
}

/* 设置面板 */
.settings-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.settings-modal.show {
    display: flex;
}

.settings-modal-content {
    background: white;
    border-radius: 24px;
    padding: 1.5rem;
    width: 90%;
    max-width: 400px;
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.settings-modal-header h3 {
    color: #1e293b;
    margin: 0;
}

.settings-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #94a3b8;
}

.settings-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.settings-option label {
    color: #334155;
    font-weight: 500;
    font-size: 0.85rem;
}

.toggle-switch {
    position: relative;
    width: 46px;
    height: 24px;
    background: #cbd5e1;
    border-radius: 30px;
    cursor: pointer;
    transition: background 0.3s;
}

.toggle-switch.active {
    background: #667eea;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 3px;
    transition: transform 0.3s;
}

.toggle-switch.active::after {
    transform: translateX(22px);
}

.settings-save {
    width: 100%;
    padding: 10px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 40px;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 1rem;
}

.settings-save:hover {
    background: #5b67cd;
}

/* 天气加载占位 */
.weather-loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    padding: 20px;
    font-size: 0.85rem;
}

/* 日历头部时间 */
.calendar-header-time {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-family: monospace;
    font-size: 0.75rem;
    color: white;
}

/* 管理后台链接中的齿轮图标，样式参考原设置按钮 */
.admin-gear-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(102, 126, 234, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    color: white;
    font-size: 0.8rem;
    margin-left: 6px;
    vertical-align: middle;
    transition: transform 0.2s, background 0.2s;
    cursor: pointer;
}
.admin-gear-icon:hover {
    transform: scale(1.1);
    background: rgba(102, 126, 234, 1);
}

/**
 * ============================================
 * 系统监控实时更新过渡动画
 * 说明：为监控项的数值变化添加平滑过渡效果
 * ============================================
 */

/* 监控数值的过渡动画 */
.monitor-value span {
    transition: all 0.3s ease;
}

/* 监控进度条的平滑过渡 */
.monitor-bar-fill {
    transition: width 0.5s ease, background-color 0.5s ease;
}

/* CPU 填充条特定过渡 */
.cpu-fill {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 内存填充条特定过渡 */
.mem-fill {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.5s ease;
}

/* 磁盘填充条特定过渡 */
.disk-fill {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.5s ease;
}

/* 监控项显示/隐藏的过渡 */
.monitor-item {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 监控项隐藏时的效果 */
.monitor-item[style*="display: none"] {
    opacity: 0;
    transform: scale(0.95);
}

/* 
   所有原来通过 PHP echo 的样式（如容器宽度、间距、卡片尺寸等）
   现在由 index.php 中的 <style> 块动态注入，此处保留完整的静态基础样式。
   这样 lighttpd 可直接提供 .css 文件，无需执行 PHP。
*/

/* ==================== 移动端编辑模式样式 ==================== */

/* 编辑模式按钮 */
.edit-mode-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(102, 126, 234, 0.8);
    color: white;
    padding: 8px 20px;
    border-radius: 40px;
    font-size: 0.85rem;
    cursor: pointer;
    margin-left: 12px;
    transition: all 0.2s;
}

.edit-mode-btn:hover {
    background: #5b67cd;
}

.edit-mode-btn.active {
    background: #22c55e;
}

/* 抖动动画 */
@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    20% { transform: translate(-2px, 0px) rotate(1deg); }
    30% { transform: translate(2px, 2px) rotate(0deg); }
    40% { transform: translate(1px, -1px) rotate(1deg); }
    50% { transform: translate(-1px, 2px) rotate(-1deg); }
    60% { transform: translate(-2px, 1px) rotate(0deg); }
    70% { transform: translate(2px, 1px) rotate(-1deg); }
    80% { transform: translate(-1px, -1px) rotate(1deg); }
    90% { transform: translate(1px, 2px) rotate(0deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake-animation {
    animation: shake 0.8s ease-in-out infinite;
}

/* 删除按钮 */
.delete-icon-btn {
    position: absolute;
    top: -10px;
    left: -10px;
    width: 28px;
    height: 28px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.delete-icon-btn:hover {
    transform: scale(1.1);
    background: #dc2626;
}

/* 移动端拖拽手柄 */
.drag-handle-mobile {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    background: rgba(102, 126, 234, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: grab;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.2s;
}

.drag-handle-mobile:active {
    cursor: grabbing;
}

.drag-handle-mobile:hover {
    background: #5b67cd;
    transform: scale(1.05);
}

/* 拖拽克隆体 */
.drag-clone {
    transition: transform 0.1s ease;
    cursor: grabbing;
}

/* 拖拽占位符 */
.drag-placeholder {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    border: 2px dashed #667eea;
    transition: all 0.2s;
}

/* 拖拽时的全局样式 */
body.dragging-active {
    user-select: none;
    -webkit-user-select: none;
}

/* 移动端保存按钮 */
.save-sort-btn-mobile {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: #22c55e;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 40px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    z-index: 10001;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: none;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.save-sort-btn-mobile:hover {
    background: #16a34a;
}

/* 确认弹窗 */
.drag-confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.drag-confirm-modal.show {
    opacity: 1;
    visibility: visible;
}

.drag-confirm-content {
    background: white;
    border-radius: 28px;
    padding: 24px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.drag-confirm-modal.show .drag-confirm-content {
    transform: scale(1);
}

.drag-confirm-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.drag-confirm-content h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: #1e293b;
}

.drag-confirm-content p {
    color: #64748b;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.drag-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.drag-confirm-buttons button {
    padding: 10px 24px;
    border-radius: 40px;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.drag-confirm-cancel {
    background: #f1f5f9;
    color: #475569;
}

.drag-confirm-cancel:hover {
    background: #e2e8f0;
}

.drag-confirm-ok {
    background: #ef4444;
    color: white;
}

.drag-confirm-ok:hover {
    background: #dc2626;
}

/* Toast 提示 */
.drag-toast {
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}


/* 响应式调整 */
@media (max-width: 768px) {
    .edit-mode-btn {
        padding: 6px 16px;
        font-size: 0.75rem;
    }
    
    .delete-icon-btn {
        width: 24px;
        height: 24px;
        font-size: 12px;
        top: -6px;
        left: -6px;
    }
    
    .drag-handle-mobile {
        width: 24px;
        height: 24px;
        font-size: 12px;
        bottom: -6px;
        right: -6px;
    }
    
    .save-sort-btn-mobile {
        padding: 10px 24px;
        font-size: 0.8rem;
        bottom: 80px;
    }
}

/* ==================== 圆形编辑按钮（在设置按钮上方） ==================== */
.edit-mode-circle {
    position: fixed;
    bottom: 88px;      /* 设置按钮在 bottom:20px，这个在上方68px距离 */
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(102, 126, 234, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    backdrop-filter: blur(10px);
    font-size: 1.5rem;
    color: white;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.edit-mode-circle:hover {
    transform: scale(1.1);
    background: rgba(102, 126, 234, 1);
}

.edit-mode-circle.active {
    background: #22c55e;
}

/* ==================== 拖拽优化样式（修复版） ==================== */

/* 拖拽时的全局状态 */
body.dragging-active {
    user-select: none;
    -webkit-user-select: none;
    cursor: grabbing;
}

/* 拖拽克隆体样式 */
.drag-clone {
    will-change: transform;
    backface-visibility: hidden;
    transition: transform 0.05s linear !important;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.3));
    cursor: grabbing;
}

/* 占位符样式 */
.drag-placeholder {
    background: rgba(102, 126, 234, 0.25);
    border-radius: 16px;
    border: 2px dashed #667eea;
    transition: all 0.12s ease;
    animation: placeholderPulse 0.6s ease-in-out infinite alternate;
}

@keyframes placeholderPulse {
    0% {
        background: rgba(102, 126, 234, 0.15);
        border-color: #667eea;
    }
    100% {
        background: rgba(102, 126, 234, 0.35);
        border-color: #818cf8;
    }
}

/* 确保网格稳定 */
.cards-grid {
    transition: none !important;
}

/* 拖拽时原元素隐藏效果 */
.link-item.dragging-source {
    opacity: 0;
    visibility: hidden;
}

/* 改善触摸响应 */
.link-item {
    touch-action: pan-y pinch-zoom;
}

/* 拖拽手柄样式增强 */
.drag-handle-mobile {
    cursor: grab;
    touch-action: none;
}

.drag-handle-mobile:active {
    cursor: grabbing;
}