/* --- 7. Library Styles --- */
.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    padding: 8px;
    max-height: 250px;
    overflow-y: auto;
}
.library-item {
    position: relative;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, transform 0.15s;
}
.library-item:hover { 
    border-color: var(--accent); 
    transform: translateY(-1px);
}
.library-thumb {
    width: 100%;
    height: 70px;
    object-fit: contain;
    background: repeating-linear-gradient(45deg, #111215 0, #111215 10px, #181a1f 10px, #181a1f 20px);
    padding: 2px;
}
.library-name {
    font-size: 14px;
    padding: 5px;
    text-align: center;
    background: var(--bg-panel-alt);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.library-controls {
    position: absolute;
    top: 4px;
    right: 4px;
    display: none;
    gap: 4px;
    z-index: 10;
}
.library-item:hover .library-controls { display: flex; }
.lib-btn {
    width: 24px;
    height: 24px;
    font-size: 11px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 22, 28, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-bright);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.24);
}
.lib-btn:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.28);
}
.lib-del:hover { background: rgba(229, 72, 77, 0.95); border-color: rgba(229, 72, 77, 1); color: white; }
.lib-export:hover { background: rgba(48, 164, 108, 0.95); border-color: rgba(48, 164, 108, 1); color: white; }
.lib-rename:hover { background: rgba(99, 102, 241, 0.95); border-color: rgba(99, 102, 241, 1); color: white; }

/* v4.7.1 — زر تعيين الشكل في المكتبة (احترافي متناسق مع هوية الموقع) */
.lib-assign {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}
.lib-assign:hover {
    background: var(--accent-hover);
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.24);
}
.lib-assign-ready {
    animation: assignPulse 1.6s ease-in-out infinite;
}
@keyframes assignPulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--accent-dim); }
    50%      { box-shadow: 0 0 0 6px rgba(0,0,0,0); }
}

/* Library item in swap mode (when shapes are selected) */
.library-item.swap-mode {
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.2);
}
.library-item.swap-mode:hover {
    border-color: #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.08);
}
.library-item.swap-mode::after {
    content: '\01F504';
    position: absolute;
    bottom: 2px;
    left: 2px;
    font-size: 10px;
    background: rgba(0,0,0,0.7);
    border-radius: 3px;
    padding: 1px 3px;
    line-height: 1;
}

/* Library grid scrollable → merged into .library-grid above */
