/* 页面整体 */
body {
    font-family: Arial, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    padding: 1.5em;
    background: #f9f9f9;
    margin: 0;
}

/* 顶部标题栏固定 */
#page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #f9f9f9;
    padding: 0.5em 0.8em;
    z-index: 10;
    border-bottom: 1px solid #ddd;
}

/* 标题文字 */
#page-title {
    font-size: 16px;
    margin: 0;
}

/* 顶部右侧按钮容器 */
#header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* 编辑按钮 */
#edit-toggle {
    font-size: 13px;
    padding: 4px 10px;
    background: #007acc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
#edit-toggle:hover {
    background: #005fa3;
}

/* 编辑模式下的按钮组 */
#editor-buttons {
    display: flex;
    gap: 6px;
}
#editor-buttons button {
    font-size: 13px;
    padding: 4px 10px;
    background: #007acc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
#editor-buttons button:hover {
    background: #005fa3;
}

/* 状态提示 */
#status {
    font-size: 12px;
    color: #666;
    margin: 0.5em 0 1em;
}
#status.error {
    color: red;
}

/* 分组容器 */
section {
    margin-bottom: 1em;
    background: #fff;
    padding: 0.8em;
    border-radius: 5px;
    box-shadow: 0 0 3px rgba(0,0,0,0.08);
}
section[draggable="true"] {
    cursor: move;
}
section.drag-over {
    outline: 2px dashed #007acc;
}

/* 每行布局：flex */
.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.4em;
    font-size: 13px;
    flex-wrap: wrap;
}

/* 左侧文字区域（label + url） */
.item-row .text-group {
    flex: 1;
    display: flex;
    gap: 16px; /* ✅ 保证标题和URL有间距 */
    align-items: center;
    min-width: 200px;
    flex-wrap: wrap;
}

/* 链接自动省略 */
.item-row .text-group span.editable.url {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
    display: inline-block;
}

/* 右侧按钮区域（复制 + 删除） */
.item-row .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto; /* ✅ 按钮组固定在右侧 */
}

/* 图标按钮样式 */
button.icon-btn {
    padding: 4px;
    font-size: 16px;
    background: none;
    border: none;
    color: #007acc;
    cursor: pointer;
    transition: color 0.2s ease;
}
button.icon-btn:hover {
    color: #005fa3;
}

/* 添加链接按钮 */
section button {
    font-size: 13px;
    padding: 4px 10px;
    background: #007acc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
section button:hover {
    background: #005fa3;
}

/* 响应式优化：窄屏下调整布局 */
@media (max-width: 600px) {
    .item-row {
        flex-direction: column;
        align-items: flex-start;
    }
    .item-row .actions {
        margin-top: 4px;
        margin-left: 0;
    }
}

/* 可编辑文字 */
span.editable {
    cursor: pointer;
}

/* 输入框样式 */
input[type="text"] {
    padding: 3px 6px;
    font-size: 13px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
}

/* 页脚说明 */
footer {
    font-size: 12px;
    color: #888;
    margin-top: 2em;
}
