/* ============================================================
   shortcuts.css —— 网站快捷方式区
   快捷方式网格（每行最多 10 个，窄屏逐级减少）、网站卡片图标/名称/删除、
   “添加网站”虚线卡片、空状态提示。
   ============================================================ */

/* ===== 网站快捷方式区 =====
   .shortcuts 与 .shortcut-grid 已 display: contents（样式见 widgets.css），
   快捷方式项直接作为 .main-grid 的网格项，与组件卡片在同一网格排列。
   因此这里不再单独定义 flex/grid 容器样式。 */

/* 快捷方式项：作为 .main-grid 的普通网格项，默认占 1 列 */
.shortcut-item,
.shortcut-add {
    width: 100%;
}
.shortcut-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--icon-gap, 8px);
    cursor: pointer;
    position: relative;
    transition: transform 0.18s var(--ease-out);
}
/* 关闭图标名称：名称不占位（每个图标项只剩图标方块高度） */
.shortcut-item.no-name .shortcut-name { display: none; }
/* 圆形图标样式：图标与内部图片统一为 50% 圆角（由 JS 在 html 上设置 data-icon-style） */
:root[data-icon-style="circle"] .shortcut-icon,
:root[data-icon-style="circle"] .shortcut-icon.is-nav-icon img,
:root[data-icon-style="circle"] .shortcut-add-icon,
:root[data-icon-style="circle"] .shortcut-drag-ghost {
    border-radius: 50%;
}
.shortcut-item:hover { transform: translateY(-2px); }
.shortcut-item:active { transform: translateY(0) scale(0.96); }
/* 桌面端拖拽排序态：浮动态跟随指针（位移/缩放由 JS 内联 transform 控制），
   关掉过渡/动画避免回位抖动 */
.shortcut-item.dragging {
    transition: none;
    opacity: 0.92;
    z-index: 100;
    cursor: grabbing;
    will-change: transform;
}
.shortcut-item.dragging .shortcut-icon {
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
}

/* 拖拽占位框：被拖图标脱离网格后占据目标位的虚线块（与图标顶对齐） */
.shortcut-drag-ghost {
    justify-self: center;
    align-self: start;
    width: 56px;
    height: 56px;
    border: 2px dashed rgba(255, 140, 26, 0.55);
    border-radius: 16px;
    background: rgba(255, 140, 26, 0.08);
    box-sizing: border-box;
    pointer-events: none;
}
@media (min-width: 621px) {
    .shortcut-item { touch-action: none; }   /* 触屏设备上长按拖拽，抑制页面滚动 */
}
/* 图标容器：白色实底（favicon 透明区域不露出壁纸），负责定位/圆角裁剪/投影；
   自定义背景色时内联 style.background 铺实色块覆盖白底。 */
.shortcut-icon {
    width: var(--icon-size, 56px);
    height: var(--icon-size, 56px);
    border-radius: var(--icon-radius, 16px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
    opacity: var(--icon-opacity, 1);
    transition: transform 0.22s var(--ease-out), box-shadow 0.22s ease;
}
.shortcut-item:hover .shortcut-icon {
    transform: translateY(-4px) scale(1.05);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.4);
}
/* 图片撑满整个容器：cover 等比填充，圆角由容器裁剪 */
.shortcut-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    image-rendering: auto;
}
/* “网址导航”图标多为全出血色块：容器透明、圆角直接作用于图片本身，
   避免白色实底在圆角/缩放的亚像素缝隙处透出形成白边 */
.shortcut-icon.is-nav-icon {
    background: transparent;
}
.shortcut-icon.is-nav-icon img {
    border-radius: 16px;
}
/* 文字图标 / 加载失败兜底：自身承载橙色圆角块（容器透明时仍有完整图标视觉）；
   容器铺了自定义色时由 JS 置为 transparent 露出底色 */
.shortcut-icon-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, #ff9a3d, #ff7a1a);
}
.shortcut-name {
    font-size: var(--icon-name-size, 12px);
    line-height: var(--icon-name-h); /* 固定 16px 行高，保证每个图标项正好 80px 高，与组件卡片两排高度对齐 */
    color: var(--icon-name-color, rgba(255, 255, 255, 0.92));
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    transition: color 0.15s ease;
}
.shortcut-item:hover .shortcut-name { color: #fff; }
.shortcut-del {
    position: absolute;
    top: -6px;
    right: 8px;
    width: 20px;
    height: 20px;
    line-height: 18px;
    text-align: center;
    border-radius: 50%;
    font-size: 13px;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.25);
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease, transform 0.15s var(--ease-out), background 0.15s ease;
}
.shortcut-item:hover .shortcut-del { opacity: 1; transform: scale(1); }
.shortcut-del:hover { background: rgba(255, 95, 109, 0.9); transform: scale(1.1); }

/* “添加网站”虚线卡片 */
.shortcut-add {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--icon-gap, 8px);
    cursor: pointer;
}
.shortcut-add-icon {
    width: var(--icon-size, 56px);
    height: var(--icon-size, 56px);
    border-radius: var(--icon-radius, 16px);
    border: 1px dashed rgba(255, 255, 255, 0.4);
    background: rgba(20, 20, 25, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: calc(var(--icon-size, 56px) * 0.46);
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s var(--ease-out);
}
.shortcut-add:hover .shortcut-add-icon {
    border-color: var(--brand);
    color: #ffc98a;
    background: rgba(255, 140, 26, 0.16);
    transform: translateY(-4px) scale(1.05);
}
.shortcut-empty {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    transform: translateY(-100%);
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    text-align: center;
    padding: 0 0 18px;
    pointer-events: none;
}

/* 卡片错位淡入：网格项按出现顺序逐个延迟（最多 12 个） */
.shortcut-item,
.shortcut-add {
    animation: shortcut-in 0.45s var(--ease-out) both;
}
.shortcut-item:nth-child(1),  .shortcut-add:nth-child(1)  { animation-delay: 0.02s; }
.shortcut-item:nth-child(2),  .shortcut-add:nth-child(2)  { animation-delay: 0.05s; }
.shortcut-item:nth-child(3),  .shortcut-add:nth-child(3)  { animation-delay: 0.08s; }
.shortcut-item:nth-child(4),  .shortcut-add:nth-child(4)  { animation-delay: 0.11s; }
.shortcut-item:nth-child(5),  .shortcut-add:nth-child(5)  { animation-delay: 0.14s; }
.shortcut-item:nth-child(6),  .shortcut-add:nth-child(6)  { animation-delay: 0.17s; }
.shortcut-item:nth-child(7),  .shortcut-add:nth-child(7)  { animation-delay: 0.20s; }
.shortcut-item:nth-child(8),  .shortcut-add:nth-child(8)  { animation-delay: 0.23s; }
.shortcut-item:nth-child(9),  .shortcut-add:nth-child(9)  { animation-delay: 0.26s; }
.shortcut-item:nth-child(10), .shortcut-add:nth-child(10) { animation-delay: 0.29s; }
.shortcut-item:nth-child(11), .shortcut-add:nth-child(11) { animation-delay: 0.32s; }
.shortcut-item:nth-child(12), .shortcut-add:nth-child(12) { animation-delay: 0.35s; }
@keyframes shortcut-in {
    from { opacity: 0; transform: translateY(10px) scale(0.92); }
    to   { opacity: 1; transform: none; }
}

/* 窄屏自适应：列数由 shortcuts.js 按实时轨道宽/图标尺寸/列距动态计算并写入
   <html> 内联 --icon-cols（默认 14 列、最多 16 列，收窄逐列换行），无需固定媒体查询断点。
   .shortcut-grid 已 display: contents，快捷方式项直接跟随 .main-grid 列数变化；
   widgets.js 实时读 --icon-cols 并在 resize 时重算组件卡片装箱。 */
