/* =========================================================================
   Entity List - Shared Styles
   ========================================================================= */

/* Sub-tabs (My Lists / Shared Lists) */
.el-sub-tabs .nav-link {
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

/* Rank input (click-to-type position number on ranked lists) */
.eld-rank-input {
    width: 36px;
    text-align: center;
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 0;
    border-radius: 4px;
    font-weight: 600;
    color: inherit;
    -moz-appearance: textfield;
    appearance: textfield;
}
.eld-rank-input::-webkit-outer-spin-button,
.eld-rank-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.eld-rank-input:hover {
    border-color: var(--mv-border-color, var(--mv-border-color));
    cursor: pointer;
}
.eld-rank-input:focus {
    border-color: var(--bs-primary, #0d6efd);
    background: var(--mv-bg-card, #fff);
    outline: none;
    cursor: text;
}
[data-bs-theme="dark"] .eld-rank-input:focus {
    background: var(--mv-bg-card);
}

/* Drag-and-drop visual feedback for ranked lists */
.sortable-enabled .eld-item-row {
    cursor: grab;
}
.sortable-enabled .eld-item-row:active {
    cursor: grabbing;
}
.sortable-chosen {
    opacity: 0.9;
}
.sortable-ghost {
    opacity: 0.4;
    background: var(--mv-bg-surface, #f0f4ff) !important;
}
.sortable-drag {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* List cards */
.el-list-card {
    transition: border-color 0.2s;
}
.el-list-card:hover {
    border-color: var(--bs-primary, #0d6efd);
}

.el-card-img {
    height: 180px;
    object-fit: cover;
}
.el-card-img-placeholder {
    height: 180px;
    background: var(--mv-bg-surface, #f8f9fa);
}

/* Collage grid for list card images */
.el-card-collage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    width: 100%;
    height: 180px;
    overflow: hidden;
    border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0;
}
.el-card-collage img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
}
.el-card-collage-2 {
    grid-template-rows: 1fr;
}

/* Create card */
.el-create-card {
    background: var(--mv-bg-surface, #f8f9fa);
    border-color: var(--mv-border-color, var(--mv-border-color));
}
.el-create-card:hover {
    border-color: var(--bs-primary, #0d6efd);
    background: var(--mv-bg-hover, #f0f0f0);
}

/* Table row hover */
.el-list-clickable:hover td {
    background: var(--mv-bg-hover, #f8f9fa);
}

/* =========================================================================
   Modal styles
   ========================================================================= */

/* Search dropdown (shared between modal and detail) */
.elm-search-dropdown {
    position: absolute;
    z-index: 100;
    background: var(--mv-bg-card, #fff);
    border: 1px solid var(--mv-border-color, var(--mv-border-color));
    border-radius: 0.375rem;
    max-height: 300px;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.elm-search-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-bottom: 1px solid var(--mv-border-light, #f0f0f0);
    cursor: pointer;
}
.elm-search-item:hover {
    background: var(--mv-bg-hover, #f8f9fa);
}
.elm-search-item:last-child {
    border-bottom: none;
}

.elm-search-img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.elm-search-img-placeholder {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--mv-bg-surface, #f8f9fa);
    border-radius: 4px;
    flex-shrink: 0;
    color: var(--mv-text-secondary, #6c757d);
}

/* Modal item list */
.elm-item-list {
    max-height: 300px;
    overflow-y: auto;
}

.elm-modal-item .elm-search-img,
.elm-modal-item .elm-search-img-placeholder {
    width: 32px;
    height: 32px;
}

/* Friend list in sharing tab */
.elm-friend-list {
    max-height: 200px;
    overflow-y: auto;
}

/* Collab section */
.elm-collab-section {
    padding-top: 0.5rem;
    border-top: 1px solid var(--mv-border-light, #f0f0f0);
}

/* =========================================================================
   Detail view
   ========================================================================= */

/* Item rows — default cursor, grab only when sortable is active */
.eld-item-row {
    cursor: default;
}
.eld-item-row.sortable-drag,
.sortable-enabled .eld-item-row {
    cursor: grab;
}
.eld-item-row.sortable-ghost {
    opacity: 0.4;
}

/* Progress bar — scoped to entity list containers */
#elDetailView .progress,
#elTabContainer .progress {
    background-color: var(--mv-bg-surface, #e9ecef);
}

/* Vote buttons compact */
.eld-vote-btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    line-height: 1;
}

/* =========================================================================
   Add-to-List Popover
   ========================================================================= */

.el-list-popover {
    position: absolute;
    min-width: 240px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--mv-bg-card, #fff);
    border: 1px solid var(--mv-border-color, var(--mv-border-color));
    border-radius: 0.375rem;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    padding: 0.375rem 0;
    z-index: 1070;
}

.el-list-popover-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    cursor: pointer;
    font-size: 0.875rem;
    margin: 0;
}

.el-list-popover-item:hover {
    background-color: var(--mv-bg-hover, #f8f9fa);
}

.el-list-popover-name {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.el-list-popover-count {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.el-list-popover-divider {
    border-top: 1px solid var(--mv-border-light, #f0f0f0);
    padding: 0.25rem 0.75rem 0.125rem;
    margin-top: 0.25rem;
}

.el-list-popover-footer {
    border-top: 1px solid var(--mv-border-light, #f0f0f0);
    padding: 0.375rem 0.75rem 0.25rem;
    margin-top: 0.25rem;
}

/* =========================================================================
   Dark mode
   ========================================================================= */

[data-bs-theme="dark"] .el-list-card:hover,
[data-bs-theme="dark"] .el-create-card:hover {
    border-color: var(--bs-primary, #6ea8fe);
}

[data-bs-theme="dark"] .el-create-card {
    background: var(--mv-bg-surface);
    border-color: var(--mv-border-color);
}

[data-bs-theme="dark"] .el-list-clickable:hover td {
    background: var(--mv-bg-hover);
}

[data-bs-theme="dark"] .elm-search-dropdown {
    background: var(--mv-bg-card);
    border-color: var(--mv-border-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

[data-bs-theme="dark"] .elm-search-item:hover {
    background: var(--mv-bg-hover);
}

[data-bs-theme="dark"] .elm-search-item {
    border-bottom-color: var(--mv-border-color);
}

[data-bs-theme="dark"] .elm-search-img-placeholder,
[data-bs-theme="dark"] .el-card-img-placeholder {
    background: var(--mv-bg-surface);
}

[data-bs-theme="dark"] .elm-collab-section {
    border-top-color: var(--mv-border-color);
}

[data-bs-theme="dark"] .el-list-popover {
    background: var(--mv-bg-card);
    border-color: var(--mv-border-color);
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.3);
}

[data-bs-theme="dark"] .el-list-popover-item:hover {
    background-color: var(--mv-bg-hover);
}

[data-bs-theme="dark"] .el-list-popover-footer,
[data-bs-theme="dark"] .el-list-popover-divider {
    border-top-color: var(--mv-border-color);
}

/* =========================================================================
   Mobile responsive
   ========================================================================= */

@media (max-width: 767px) {
    .el-card-img {
        height: 120px;
    }
    .el-card-img-placeholder {
        height: 120px;
    }
    .el-card-collage {
        height: 120px;
    }
}
