/**
 * Tags Page Styles
 */

.tags-page {
    max-width: 1000px;
    margin: 0 auto;
}

/* ── Tag grid ────────────────────────────────── */
.tags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--spacing-md);
}

.tag-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.tag-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.tag-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.tag-card-body {
    flex: 1;
    min-width: 0;
}

.tag-card-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tag-card-count {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.tag-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.tag-card:hover .tag-card-actions {
    opacity: 1;
}

.tag-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.tag-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-text-primary);
}

.tag-action-btn.danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.tag-action-btn svg {
    width: 14px;
    height: 14px;
}

/* ── Empty state ──────────────────────────────── */
.tags-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-muted);
}

.tags-empty svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.tags-empty-title {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text-primary);
}

.tags-empty-text {
    font-size: 0.9rem;
    opacity: 0.7;
}

/* ── Color picker grid ────────────────────────── */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    padding: 0.5rem 0;
}

.color-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.color-swatch:hover {
    transform: scale(1.15);
}

.color-swatch.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* ── Inline colored tag chips (reusable) ──────── */
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.15em 0.55em;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    border: 1px solid;
}

.tag-chip .chip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Tag picker (dropdown for assigning) ──────── */
.tag-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--glass-bg, rgba(15, 15, 25, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-height: 280px;
    overflow-y: auto;
    margin-top: 4px;
}

.tag-picker-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    transition: background 0.1s;
}

.tag-picker-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.tag-picker-item .checkmark {
    width: 16px;
    color: var(--color-accent);
    flex-shrink: 0;
}

.tag-picker-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
    font-size: 0.85rem;
    outline: none;
}

.tag-picker-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

/* ── Custom checkbox row for tag picker ───────── */
.tag-check-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}

.tag-check-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.tag-check-box {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.tag-check-row.checked .tag-check-box {
    border-color: var(--tag-accent, var(--color-accent));
    background: var(--tag-accent, var(--color-accent));
}

.tag-check-box svg {
    width: 12px;
    height: 12px;
    stroke: #fff;
    stroke-width: 3;
    fill: none;
    opacity: 0;
    transition: opacity 0.12s;
}

.tag-check-row.checked .tag-check-box svg {
    opacity: 1;
}

.tag-check-name {
    flex: 1;
    font-size: 0.9rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-check-count {
    font-size: 0.75rem;
    opacity: 0.45;
    flex-shrink: 0;
}

/* ── Add-tag placeholder in tables ────────────── */
.tag-add-placeholder {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0.15em 0.5em;
    border-radius: 999px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.tag-add-placeholder:hover {
    color: rgba(255, 255, 255, 0.6);
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.04);
}

.tag-add-placeholder svg {
    width: 11px;
    height: 11px;
}

/* Clickable tag chips in table */
.tag-chip-btn {
    cursor: pointer;
    transition: opacity 0.15s;
}

.tag-chip-btn:hover {
    opacity: 0.75;
}

.tags-cell-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}
