/* Links module — bookmark-tree styles */

.links-content { max-width: 980px; margin: 0 auto; }
.links-intro { color: #666; margin: 0 0 1.25rem; }

.links-tree {
    border: 1px solid #e1e4e8;
    border-radius: 6px;
    background: #fafbfc;
    padding: 0.5rem;
}

.links-folder {
    border: 1px solid transparent;
    border-radius: 4px;
    margin: 2px 0;
    background: #fff;
}
.links-folder + .links-folder { margin-top: 4px; }

.links-folder-summary {
    cursor: pointer;
    list-style: none;
    padding: 8px 12px;
    font-weight: 600;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 4px;
}
.links-folder-summary::-webkit-details-marker { display: none; }
.links-folder-summary::before {
    content: '\25B8'; /* small right-pointing triangle */
    display: inline-block;
    width: 1em;
    color: #888;
    transition: transform 0.12s ease;
    transform: rotate(0deg);
    font-size: 0.85em;
}
.links-folder[open] > .links-folder-summary::before {
    transform: rotate(90deg);
}
.links-folder-summary:hover { background: #f1f4f8; }

.links-folder-name { flex: 1; }
.links-folder-count {
    color: #888;
    font-weight: 400;
    font-size: 0.85em;
    background: #eef1f4;
    padding: 1px 8px;
    border-radius: 10px;
    margin-left: 8px;
    order: 99;
}

.links-folder-body {
    padding: 4px 12px 8px 28px;
}

.links-list {
    list-style: none;
    padding: 0;
    margin: 4px 0;
}
.links-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 3px;
}
.links-item:hover { background: #f1f4f8; }

.links-favicon {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    object-fit: contain;
}
.links-favicon-placeholder {
    display: inline-block;
    background: linear-gradient(135deg, #d8dde3 0%, #b8bfc7 100%);
    border-radius: 3px;
}

.links-anchor {
    color: #0366d6;
    text-decoration: none;
    word-break: break-word;
    flex: 1;
}
.links-anchor:hover { text-decoration: underline; }
.links-anchor:visited { color: #6f42c1; }

/* Nested folder indentation gets a subtle left rule */
.links-folder .links-folder {
    border-left: 2px solid #eef1f4;
    margin-left: 2px;
}

/* ── Header / toolbar ──────────────────────────────────── */
.links-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}
.links-header h2 { margin: 0; }
.links-toolbar { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; margin-top: 20px; }
.links-toolbar-btn {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.85em;
    border: 1px solid #d0d4d9;
    border-radius: 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
    text-decoration: none;
}
.links-toolbar-btn:hover { background: #f1f4f8; }
.links-toolbar-btn-primary {
    background: #0366d6;
    border-color: #0366d6;
    color: #fff;
}
.links-toolbar-btn-primary:hover { background: #0356b6; color: #fff; }

/* ── Admin per-row actions ─────────────────────────────── */
.links-actions {
    display: inline-flex;
    gap: 4px;
    margin-left: auto;
    align-items: center;
    opacity: 0;
    transition: opacity 0.1s ease;
    order: 50;
}
.links-folder-summary:hover .links-actions,
.links-item:hover .links-actions,
.links-actions:focus-within { opacity: 1; }

.links-action-btn {
    font-size: 0.75em;
    padding: 2px 6px;
    background: #eef1f4;
    color: #444;
    border: 1px solid transparent;
    border-radius: 3px;
    text-decoration: none;
    cursor: pointer;
    line-height: 1.4;
    width: auto;
    font-family: inherit;
    display: inline-block;
}
.links-action-btn:hover { background: #d8dde3; color: #000; }
.links-action-danger { color: var(--color-danger); }
.links-action-danger:hover { background: var(--color-danger-soft); color: var(--color-danger-hover); }

/* display: contents removes the form from layout so its button becomes a
   direct flex child of .links-actions — matches sibling <a> action buttons. */
.links-inline-form {
    display: contents;
}
.links-inline-form button {
    font: inherit;
    cursor: pointer;
}

/* ── Drag-and-drop visuals ─────────────────────────────── */
.links-folder-summary[draggable="true"],
.links-item[draggable="true"] { cursor: grab; }
.links-dragging { opacity: 0.5; }

.links-drop-target {
    background: #d6ebff !important;
    outline: 2px dashed #0366d6;
    outline-offset: -2px;
    border-radius: 4px;
}
.links-tree.links-drop-root {
    outline: 2px dashed #28a745;
    outline-offset: -4px;
}
