:host {
    display: block;
    width: 100%;
}

.playlist-item {
    width: 100%;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 8px 12px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    cursor: pointer;
    box-sizing: border-box;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        box-shadow 0.18s ease,
        transform 0.18s ease,
        color 0.15s ease;

    &:hover {
        background: color-mix(in srgb, currentColor 8%, transparent);
    }

    &.selected {
        background: linear-gradient(
            135deg,
            var(--app-selection-surface-strong),
            var(--app-selection-surface)
        );
        border-color: var(--app-selection-border);
        color: var(--app-selection-color);
        box-shadow:
            inset 0 0 0 1px var(--app-selection-border),
            0 12px 20px -18px var(--app-selection-glow);
        transform: translateY(-1px);

        .meta,
        .upload-type-icon,
        .drag-icon,
        .action-buttons button,
        .action-buttons mat-icon {
            color: inherit;
        }

        .status-dot {
            border-color: color-mix(
                in srgb,
                var(--app-selection-surface-strong) 85%,
                transparent
            );
        }
    }

    &.is-busy {
        cursor: progress;
    }
}

.playlist-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.playlist-content {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}

.playlist-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.96rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.meta {
    font-size: 0.82rem;
    color: var(--mat-sys-on-surface-variant);
    opacity: 0.84;
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.busy-state {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.7rem;
    color: var(--app-selection-border, #8aa4c8);
    margin-top: 2px;
}

.busy-state__message {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.busy-state__value {
    opacity: 0.8;
}

.busy-state__bar {
    margin-top: 4px;
}

.cdk-drag-preview {
    box-sizing: border-box;
    border-radius: 8px;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.25),
        0 4px 12px rgba(0, 0, 0, 0.15),
        0 2px 6px rgba(0, 0, 0, 0.1);
    opacity: 0.9;
}

.cdk-drag-placeholder {
    opacity: 0;
}

.cdk-drag-animating {
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.drag-icon {
    flex-shrink: 0;
    cursor: move;
    opacity: 0.46;
    transition: opacity 0.15s ease;

    &:hover {
        opacity: 1;
    }
}

.action-buttons {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    margin-inline-start: auto;

    button {
        width: 34px;
        height: 34px;
        border-radius: 10px;
        color: inherit;
        opacity: 0.76;
        transition:
            opacity 0.15s ease,
            background-color 0.15s ease,
            transform 0.15s ease;

        &:hover {
            opacity: 1;
            background: color-mix(in srgb, currentColor 10%, transparent);
            transform: translateY(-1px);
        }

        mat-icon {
            width: 20px;
            height: 20px;
            font-size: 20px;
        }

        &:disabled {
            transform: none;
            opacity: 0.38;
        }
    }
}

.action-spinner {
    display: block;
    margin: 0 auto;
}

.icon-container {
    position: relative;
    display: inline-flex;

    .upload-type-icon {
        opacity: 0.75;
        transition: opacity 0.15s ease;
    }

    .playlist-item:hover & .upload-type-icon {
        opacity: 0.95;
    }
}

.status-dot {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    right: 0;
    bottom: 0;
    border: 2px solid var(--mat-sys-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.15s ease;
}

.status-active {
    background-color: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.status-inactive {
    background-color: #f44336;
    box-shadow: 0 0 8px rgba(244, 67, 54, 0.4);
}

.status-expired {
    background-color: #ff9800;
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.4);
}

.status-unavailable {
    background-color: var(--mat-sys-on-surface-variant);
    opacity: 0.5;
}

.auto-refresh-indicator {
    position: absolute;
    right: -2px;
    bottom: -2px;
    font-size: 14px !important;
    width: 14px !important;
    height: 14px !important;
    color: #4caf50;
    background-color: var(--mat-sys-surface);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    transition: all 0.15s ease;

    .playlist-item:hover & {
        color: #66bb6a;
        transform: rotate(90deg);
    }
}

@media only screen and (max-width: 480px) {
    .upload-type-icon,
    .icon-container,
    .action-buttons .refresh-btn,
    .action-buttons .edit-btn,
    .action-buttons .delete-btn {
        display: none;
    }
}
