/* redmine_urllist 插件样式 */

/* ---- label 样式（原有） ---- */
label.tabular {
  text-align: right;
  width: 270px;
  display: inline-block;
}

label.tabular2 {
  text-align: right;
  width: 100px;
  display: inline-block;
}

/* ---- 页面标题 ---- */
.urllist-page-title {
  font-size: 1.5em;
  font-weight: 600;
  color: #333;
  margin: 15px 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e2e2;
}

/* ---- 项目筛选区 ---- */
#project_search {
  margin-bottom: 15px;
  padding: 10px 15px;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  display: inline-block;
}

#project_search select {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  min-width: 200px;
  background: #fff;
}

#project_search select:focus {
  border-color: #4d90fe;
  outline: none;
  box-shadow: 0 0 3px rgba(77, 144, 254, 0.3);
}

/* ---- 表格容器 ---- */
.urllist-table-container {
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}

/* ---- 主表格 ---- */
#treetable {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

#treetable thead th {
  background: #5c6bc0;
  color: #fff;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
  white-space: nowrap;
}

#treetable thead th:last-child {
  border-right: none;
}

#treetable thead th a {
  color: #fff;
  text-decoration: none;
  margin-left: 10px;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s;
}

#treetable thead th a:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ---- 表格行 ---- */
#treetable tbody tr {
  border-bottom: 1px solid #eef0f3;
  transition: background-color 0.15s;
}

#treetable tbody tr:hover,
#treetable tbody tr.urllist-row-hover {
  background-color: #f0f4ff !important;
}

/* 目录行 - 稍带底色突出层级 */
#treetable tbody tr.urllist-row-category {
  background-color: #fafbfc;
  font-weight: 600;
}

#treetable tbody tr.urllist-row-category:hover {
  background-color: #f0f4ff !important;
}

/* 链接行 */
#treetable tbody tr.urllist-row-link {
  background-color: #fff;
}

/* 编辑/新增行 */
#treetable tbody tr.urllist-edit-row,
#treetable tbody tr.urllist-add-row {
  background-color: #fffde7 !important;
}

#treetable tbody td {
  padding: 8px 12px;
  vertical-align: middle;
  color: #444;
}

/* ---- 目录图标 ---- */
td.down_category {
  color: #3949ab;
  font-weight: 600;
}

td.down_category::before {
  content: "\1F4C1";
  margin-right: 6px;
  font-size: 14px;
}

/* ---- 链接标题 ---- */
td.down_title {
  color: #555;
}

/* ---- URL 列 ---- */
td.down_url a {
  color: #1a73e8;
  text-decoration: none;
  padding: 3px 10px;
  background: #e8f0fe;
  border-radius: 3px;
  font-size: 12px;
  transition: all 0.2s;
  display: inline-block;
}

td.down_url a:hover {
  background: #1a73e8;
  color: #fff;
}

/* ---- 提取码列 ---- */
td.down_access_code {
  color: #888;
  font-size: 12px;
}

/* ---- 排序列 ---- */
td.down_rank {
  color: #999;
  font-size: 12px;
  text-align: center;
}

/* ---- 操作列 ---- */
td.down_actions {
  white-space: nowrap;
}

td.down_actions .urllist-action-btn {
  display: inline-block;
  padding: 3px 8px;
  margin: 0 2px;
  font-size: 12px;
  text-decoration: none;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.2s;
  color: #555;
  background: #f0f0f0;
  border: 1px solid #ddd;
}

td.down_actions .urllist-action-btn:hover {
  background: #e0e0e0;
  border-color: #bbb;
}

td.down_actions .urllist-btn-save {
  color: #fff;
  background: #43a047;
  border-color: #43a047;
}

td.down_actions .urllist-btn-save:hover {
  background: #2e7d32;
  border-color: #2e7d32;
}

td.down_actions .urllist-btn-cancel {
  color: #c62828;
  background: #ffebee;
  border-color: #ef9a9a;
}

td.down_actions .urllist-btn-cancel:hover {
  background: #ef9a9a;
  color: #fff;
}

/* icon-edit / icon-add / icon-del 配色 */
td.down_actions .icon-edit {
  color: #1565c0;
  background: #e3f2fd;
  border-color: #90caf9;
}

td.down_actions .icon-edit:hover {
  background: #1565c0;
  color: #fff;
}

td.down_actions .icon-add {
  color: #2e7d32;
  background: #e8f5e9;
  border-color: #a5d6a7;
}

td.down_actions .icon-add:hover {
  background: #2e7d32;
  color: #fff;
}

td.down_actions .icon-del {
  color: #c62828;
  background: #ffebee;
  border-color: #ef9a9a;
}

td.down_actions .icon-del:hover {
  background: #c62828;
  color: #fff;
}

/* ---- 表单输入框 ---- */
/* 注意: jquery.treetable.css 有 .treetable td input{width:50px} 会覆盖，
   这里用 !important 确保优先级 */
.urllist-input {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  width: 250px !important;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.urllist-input:focus {
  border-color: #4d90fe;
  outline: none;
  box-shadow: 0 0 3px rgba(77, 144, 254, 0.3);
}

.urllist-input-url {
  width: 300px !important;
}

.urllist-input-code {
  width: 120px !important;
}

.urllist-input-rank {
  width: 60px !important;
  text-align: center;
}

.urllist-select {
  padding: 5px 8px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 13px;
  background: #fff;
}

/* ---- treetable 缩进线美化 ---- */
#treetable tr td .indenter {
  display: inline-block;
}

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  #treetable {
    font-size: 12px;
  }
  .urllist-input-url {
    width: 100%;
  }
  #project_search select {
    min-width: 100%;
  }
}

/* ---- 公开下载页面样式 ---- */
#urllist-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.urllist-table-container {
  border: 1px solid #e0e0e0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ---- 项目页/公开页 下载按钮 ---- */
.urllist-download-btn {
  display: inline-block;
  padding: 3px 14px;
  color: #1a73e8;
  text-decoration: none;
  background: #e8f0fe;
  border-radius: 3px;
  font-size: 12px;
  transition: all 0.2s;
}

.urllist-download-btn:hover {
  background: #1a73e8;
  color: #fff;
}

/* ---- 提取码标签 ---- */
.urllist-access-code {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 8px;
  color: #888;
  font-size: 12px;
  background: #f5f5f5;
  border-radius: 3px;
  border: 1px dashed #ddd;
}

/* ---- 拖拽排序 ---- */
.urllist-td-drag {
  width: 36px;
  text-align: center;
  padding: 8px 4px !important;
}

.urllist-th-drag {
  width: 36px;
}

.urllist-drag-handle {
  display: inline-block;
  cursor: grab;
  color: #bbb;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
  padding: 0 4px;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  transition: color 0.2s;
}

.urllist-drag-handle:hover {
  color: #5c6bc0;
}

.urllist-drag-handle:active {
  cursor: grabbing;
}

/* 正在拖拽的行 */
#treetable tbody tr.urllist-dragging {
  opacity: 0.4;
  background-color: #fff3e0 !important;
}

/* 放置目标指示 - 放在前面 */
#treetable tbody tr.urllist-drop-before {
  box-shadow: inset 0 3px 0 0 #43a047;
}

/* 放置目标指示 - 放在后面 */
#treetable tbody tr.urllist-drop-after {
  box-shadow: inset 0 -3px 0 0 #43a047;
}

/* 放置目标指示 - 放入目录内部 */
#treetable tbody tr.urllist-drop-inside {
  background-color: #e8f5e9 !important;
  box-shadow: inset 0 0 0 2px #43a047;
}
